Skip to content

Conversation

@guoci
Copy link
Contributor

@guoci guoci commented Nov 22, 2025

  1. update multiprocessing.managers.list's signature to follow builtins.list.__init__'s signature
  2. add type stub for multiprocessing.get_context.copy
    src: https://github.com/python/cpython/blob/c41fce08a5d7aae8fd9e3fa25e0ba521600e097c/Lib/multiprocessing/managers.py#L1164-L1169
    CPython PR: https://github.com/python/cpython/pull/103133/files

@github-actions

This comment has been minimized.

@guoci
Copy link
Contributor Author

guoci commented Nov 22, 2025

Mypy stubtest is using inspect.signature to get the signature of multiprocessing.managers.BaseListProxy.copy, but the signature is incorrect, and that triggers the CI failure.

>>> import multiprocessing, inspect
>>> mp_context = multiprocessing.get_context('spawn')
>>> manager = mp_context.Manager()
>>> l = manager.list([1,2])
>>> l.copy(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    l.copy(None)
    ~~~~~~^^^^^^
  File "<string>", line 2, in copy
  File ".../python3.14/multiprocessing/managers.py", line 848, in _callmethod
    raise convert_to_error(kind, result)
TypeError: list.copy() takes no arguments (1 given)
>>> inspect.signature(l.copy) # INCORRECT signature
<Signature (*args, **kwds)>
>>> inspect.signature([].copy)
<Signature ()>

@guoci guoci marked this pull request as ready for review November 22, 2025 18:45
@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Nov 24, 2025

Mypy stubtest is using inspect.signature to get the signature of multiprocessing.managers.BaseListProxy.copy, but the signature is incorrect, and that triggers the CI failure.

You can just add the problematic signature to the appropriate allowlist in stdlib/@tests/stubtest_allowlists with a comment explaining the situation.

@guoci guoci force-pushed the update_multiprocessing_managers_BaseListProxy branch from f422c9c to 914bb31 Compare November 24, 2025 16:13
@github-actions
Copy link
Contributor

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

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks!

For future reference, please don't force push. We squash merge anyway, but force pushing makes reviewing the changes since the review harder. (Not much of an issue in this case, just a general note.)

@srittau srittau merged commit bc805f6 into python:main Nov 24, 2025
140 of 143 checks passed
@guoci guoci deleted the update_multiprocessing_managers_BaseListProxy branch November 24, 2025 16:31
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