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
Update shelve.open
and dbm.open
to support path-like objects
#11881
Conversation
Finally `os.fsencode` is called on `filename` argument here: https://github.com/python/cpython/blob/c0d257cc69a943d2c211fe7ad54e706f1085ba1a/Lib/dbm/__init__.py#L112 Which has this type: https://github.com/python/typeshed/blob/72623c6b151db070817ce4b1c1ad70a6a2007197/stdlib/os/__init__.pyi#L484 Closes #11856
shelve.open
to support path-like objectsshelve.open
and dbm.open
to support path-like objects
This comment has been minimized.
This comment has been minimized.
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.
Thanks, I think we need to change the other dbm modules as well? (They also accept StrOrBytesPath because of PyUnicode_FSConverter)
Sure, done. |
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.
According to the docs, this change was introduced in Python 3.11, so we need to version guard it.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.
Thank you!
Finally
os.fsencode
is called onfilename
argument here: https://github.com/python/cpython/blob/c0d257cc69a943d2c211fe7ad54e706f1085ba1a/Lib/dbm/__init__.py#L112Which has this type:
typeshed/stdlib/os/__init__.pyi
Line 484 in 72623c6
Closes #11856