This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: add __weakref__ to types.GenericAlias
Type: enhancement Stage: resolved
Components: Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, kj, miss-islington, tinchester
Priority: normal Keywords: patch

Created on 2020-11-12 12:04 by tinchester, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23250 merged kj, 2020-11-12 15:25
PR 23309 merged kj, 2020-11-16 03:39
Messages (5)
msg380816 - (view) Author: Tin Tvrtković (tinchester) * Date: 2020-11-12 12:04
For example, dict[int, int] cannot be used with singledispatch because types.GenericAlias doesn't support weak references.

I'm an author of a third party library (https://github.com/Tinche/cattrs) for which this functionality would be useful.

Here's a similar issue in typing (note that this issue is for *types*.GenericAlias) that was fixed: https://github.com/python/typing/issues/345
msg380834 - (view) Author: Tin Tvrtković (tinchester) * Date: 2020-11-12 16:48
It would be great if we could get this into 3.9.
msg380836 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-11-12 17:09
I think it's reasonable to consider this a bug to be fixed.
msg381060 - (view) Author: miss-islington (miss-islington) Date: 2020-11-16 03:27
New changeset 384b7a4bd988986bca227c7e85c32d766da74708 by kj in branch 'master':
bpo-42332: Add weakref slot to types.GenericAlias (GH-23250)
https://github.com/python/cpython/commit/384b7a4bd988986bca227c7e85c32d766da74708
msg381301 - (view) Author: miss-islington (miss-islington) Date: 2020-11-17 22:45
New changeset 71ba5f52d2a80e7beffc923c54c0b6345cd0637a by kj in branch '3.9':
[3.9] bpo-42332: Add weakref slot to types.GenericAlias (GH-23250) (GH-23309)
https://github.com/python/cpython/commit/71ba5f52d2a80e7beffc923c54c0b6345cd0637a
History
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86498
2020-11-17 22:53:26gvanrossumsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-11-17 22:45:17miss-islingtonsetmessages: + msg381301
2020-11-16 03:39:08kjsetpull_requests: + pull_request22200
2020-11-16 03:27:36miss-islingtonsetnosy: + miss-islington
messages: + msg381060
2020-11-12 17:09:41gvanrossumsetmessages: + msg380836
2020-11-12 16:48:53tinchestersetmessages: + msg380834
2020-11-12 15:25:33kjsetkeywords: + patch
nosy: + kj

pull_requests: + pull_request22147
stage: patch review
2020-11-12 12:04:09tinchestercreate