Skip to content
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

multiprocessing manager classes DictProxy and ListProxy don't support typing in 3.11.4 #107431

Closed
TheMythologist opened this issue Jul 29, 2023 · 1 comment · Fixed by #107433
Closed
Labels

Comments

@TheMythologist
Copy link

TheMythologist commented Jul 29, 2023

Bug report

DictProxy and ListProxy classes from multiprocessing.managers do not support generic annotations.

Minimal reproducible example for DictProxy:

from multiprocessing.managers import DictProxy
from multiprocessing import Manager

d: DictProxy[str, float] = Manager().dict()

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: type 'DictProxy' is not subscriptable

Similar for ListProxy

Side note: #99509 appears to still be an issue as well

Your environment

Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32

Linked PRs

@TheMythologist TheMythologist added the type-bug An unexpected behavior, bug, or error label Jul 29, 2023
sobolevn added a commit to sobolevn/cpython that referenced this issue Jul 29, 2023
@sobolevn sobolevn added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Jul 29, 2023
@sobolevn
Copy link
Member

For older versions you can use 'DictProxy[A, B]', it will work, because these classes are generic in typeshed :)

gpshead added a commit that referenced this issue Nov 10, 2023
…ric (#107433)

Make `multiprocessing.managers.{DictProxy,ListProxy}` generic for type annotation use.  `ListProxy[str]` for example.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…` generic (python#107433)

Make `multiprocessing.managers.{DictProxy,ListProxy}` generic for type annotation use.  `ListProxy[str]` for example.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…` generic (python#107433)

Make `multiprocessing.managers.{DictProxy,ListProxy}` generic for type annotation use.  `ListProxy[str]` for example.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants