Skip to content

Add missing multiprocessing.popen_fork type stubs #8420

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

Merged
merged 14 commits into from
Jul 28, 2022
Merged

Add missing multiprocessing.popen_fork type stubs #8420

merged 14 commits into from
Jul 28, 2022

Conversation

kkirsche
Copy link
Contributor

X-Ref: #6799

This adds best-effort types to multiprocessing.popen_fork to continue to address issue #6799

The source file can be viewed here:
https://github.com/python/cpython/blob/main/Lib/multiprocessing/popen_fork.py

Popen attributes in some cases may not exist, such as sentinel which is set here but not initialized during the __init__. As such, it may desirable for those attributes to be removed from the stub.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jul 28, 2022

Since the module fails to import on Windows, you'll need to add an entry to the stubtest allowlist here:

# Modules that do not exist on Windows systems
_curses
_posixsubprocess
asyncio.unix_events
crypt
dbm.gnu
dbm.ndbm
fcntl
grp
nis
ossaudiodev
posix
pwd
readline
resource
spwd
syslog
termios
xxlimited

(Add a comment explaining that it does "exist" on Windows, but it fails to import.)

@AlexWaygood
Copy link
Member

AlexWaygood commented Jul 28, 2022

Since the module fails to import on Windows

You should also put the entire module contents behind an if sys.platform != "win32" guard, like we do in e.g. stdlib/_curses.pyi.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood merged commit 087fb6b into python:master Jul 28, 2022
@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@kkirsche kkirsche deleted the multiprocessing/popen-fork branch July 28, 2022 15:24
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.

2 participants