Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isinstance("",str) breaks on Python2 after running futurize #560

Open
avim2809 opened this issue May 19, 2020 · 1 comment
Open

isinstance("",str) breaks on Python2 after running futurize #560

avim2809 opened this issue May 19, 2020 · 1 comment

Comments

@avim2809
Copy link

avim2809 commented May 19, 2020

i have a very big project which i am trying to conver to py3 but keep it working on py2 in the meanwhile
after running futurize it breaks string type checks
from builtins import str
assert isinstance("s",str)

first can someone explains based on what futurize adds from builtins import str import ?

according to the documentation on your website (https://python-future.org/isinstance.html?highlight=isinstance#isinstance)
there would be no alternative but using unicode_literals to avoid this

but it doesnt make sense since everywere i read i see many against it

so bottom line is there a way to avoid this issue without unicode_literals

@ngie-eign
Copy link

@avim2809 : we ran into similar with our group -- the trick is to use six.string_types which will allow isinstance to check the string type properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants