-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[stdlib] Add default values part 2 #14769
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
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
stdlib/os/__init__.pyi
Outdated
| setsid: bool = False, | ||
| setsigmask: Iterable[int] = (), | ||
| setsigdef: Iterable[int] = (), | ||
| scheduler: tuple[Any, sched_param] | None = ..., |
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 think the | None part here is wrong: it must be a tuple if supplied.
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.
Attempting to pass None to scheduler (raises on 3.15 and 3.9):
SystemError: new style getargs format but argument is not a tuple
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.
Attempting to pass
Nonetoscheduler(raises on 3.15 and 3.9):SystemError: new style getargs format but argument is not a tuple
Oh, uh, I think you found a CPython bug there?
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.
Yes, a SystemError indicates a CPython bug.
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 opened an issue 👍
JelleZijlstra
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.
Looks good, noticed some further suggestions
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. 🤖🎉 |
faulthandler- https://github.com/python/cpython/blob/main/Modules/faulthandler.chashlib- generic constructor, but all other functions haveusedforsecurity=Trueitertools.count- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/itertoolsmodule.c#L3388itertools.accumulate- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/itertoolsmodule.c#L2981itertools.islice- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/itertoolsmodule.c#L1510itertools.zip_longest- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/itertoolsmodule.c#L3908itertools.permutations- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/itertoolsmodule.c#L2738multiprocessing- taken from parent classpickle.Pickler.__init__(self, file: SupportsWrite[bytes], protocol: int | None = None, ...)os.fdopen- arguments are passed toio.open, whose signature, judging by typeshed, is the same asbuiltins.openos.posix_spawn- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/posixmodule.c#L7597os.posix_spawnp- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/posixmodule.c#L7643os.copy_file_range- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/posixmodule.c#L12501os.pidfd_open- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/posixmodule.c#L10285os.splice- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/posixmodule.c#L12565pstats.Stats- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Lib/pstats.py#L110sched.scheduler- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Lib/sched.py#L53ssl- even though default values use constants "aliases", I used enum values to work around flake8 errors. I also moved the functions below so that these objects are defined.syslog.openlog- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Modules/syslogmodule.c#L141timeit.Timer- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Lib/timeit.py#L101C57-L101C70timeit.timeit- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Lib/timeit.py#L231timeit.repeat- https://github.com/python/cpython/blob/8cfd7b4ecf9c01ca2bea57fe640250f716cb6ee3/Lib/timeit.py#L237zipfile- default values are taken fromio.TextIOWrapperinto which all arguments are passed