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

os.path: isabs takes AnyStr, not just unicode #235

Closed
wants to merge 1 commit into from
Closed

os.path: isabs takes AnyStr, not just unicode #235

wants to merge 1 commit into from

Conversation

durin42
Copy link

@durin42 durin42 commented Jun 1, 2016

Noticed this while running pytype on Mercurial.

@gvanrossum
Copy link
Member

Don't they all?

@gvanrossum
Copy link
Member

Also, when something is declared as taking unicode (in the PY2 stubs) then it actually also takes str/bytes. Can you show an example that failed with unicode but passed with AnyStr? I can't think of any.

@matthiaskramm
Copy link
Contributor

@durin42 encountered this problem running pytype, not mypy. The example is simple:

os.path.isabs('foo.txt')

Also, when something is declared as taking unicode (in the PY2 stubs) then it actually also takes str/bytes.

We should document all these special rules.
(This one sounds like a mypy peculiarity that leaked into typeshed. Bound to happen, but let's start a list.)

@gvanrossum
Copy link
Member

OK, let's close this (too specific) PR and continue the discussion at #270 (to document the rules) and also python/typing#208. See also python/mypy#1141.

@durin42
Copy link
Author

durin42 commented Jun 6, 2016

Works for me. Thanks!

On Jun 5, 2016, at 10:49 PM, Guido van Rossum [email protected] wrote:

OK, let's close this (too specific) PR and continue the discussion at #270 #270 (to document the rules) and also python/typing#208 python/typing#208. See also python/mypy#1141 python/mypy#1141.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #235 (comment), or mute the thread https://github.com/notifications/unsubscribe/AABPLXG_AtNtn07XN_oJpOEr2J8KUC3Eks5qI4qzgaJpZM4IrG5P.

@gvanrossum gvanrossum closed this Jun 8, 2016
momandine pushed a commit to momandine/typeshed that referenced this pull request Jul 5, 2016
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

Successfully merging this pull request may close these issues.

3 participants