-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
dir argument to tempfile functions may take PathLike #3226
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
Conversation
srittau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing imports for os and Union. Otherwise looks good to me, although personally I'd have left the Optional in the arguments and only put the differing types in _DirT.
oops fixed, I'm spoiled by pre-commit 🙃 |
|
urgh, |
|
hmmm now we're failing pytype 🤔 |
|
The reason for the pytype failure is that pytype looks for the presence of type variables defined in the same pyi file to figure out whether an alias is generic. If you define it should work. |
this has different semantics than |
|
Everywhere you're using And you can always just copy the definition of |
|
This seems to cause a regression on Python 3.5; see #3449. $ echo 'import tempfile; tempfile.mkstemp(dir="/var/tmp")' | mypy /dev/stdin
dev/stdin:1: error: Argument "dir" to "mkstemp" has incompatible type "str"; expected "None"
Found 1 error in 1 file (checked 1 source file) |
Resolves #2749
see also python/cpython#11644