-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[glob] Deprecate glob0
and glob1
functions
#14477
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
stdlib/glob.pyi
Outdated
|
||
__all__ = ["escape", "glob", "iglob"] | ||
|
||
if sys.version_info >= (3, 13): | ||
__all__ += ["translate"] | ||
|
||
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... | ||
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... | ||
if sys.version_info >= (3, 10): |
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.
I'm not sure I understand why this is checking for 3.10 instead of 3.13.
I added a check for 3.10 since the root_dir argument appeared only in this version.
Considering that 3.13 > 3.10, I don't see a problem with mentioning a parameter added in 3.10 in a 3.13+ deprecation message?
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.
I did it because these functions are not documented in any case and nowhere in the message is it said from what version they are considered deprecate. As far as I understand, they began to be considered deprecate because the glob()
function got the root_dir argument.
The explanation is dubious, but I think we can warn about it from 3.10.
I don't insist on this.
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.
and another benefit of the >3.10
option - we'll be able to get rid of the if construct earlier
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.
Ah, I see what you mean now. I didn't pick up on the fact that these functions are undocumented, and hence already "deprecated" before 3.13. In that case I don't really have an opinion, either option seems reasonable
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") | ||
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... | ||
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") |
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.
in general these functions have already been removed from the main branch, so maybe it's worth writing "Removed in ..."
?
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") | |
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... | |
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") | |
@deprecated("Removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") | |
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... | |
@deprecated("Removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Source: python/cpython#117371
Warning was added to runtime in 3.13. And I added a check for 3.10 since the root_dir argument appeared only in this version.