-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
functools.update_wrapper
does not work with type
#119011
Comments
3.11:
3.12+:
|
This was reported to me at dwt/fluent#14 I'm seeing this when wrapping Is there something I need to do differently for python 3.12, or is this a bug in the python stdlib? |
This is a CPython bug |
hi @AlexWaygood, I'm trying to figure out what is happening here; what CPython should do with @encukou is also helping me to understand it :) |
Some notes from in-person conversation: The problem is this:
We would instead want this to be an empty tuple, because that's the normal behavior for classes that are not PEP 695 generics. The way to achieve this would be to use a special case for |
…cial case for PyType_Type
…cial case for PyType_Type
…cial case for PyType_Type
…thonGH-119296) (cherry picked from commit 6b240c2) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
…ple (pythonGH-119296) (cherry picked from commit 6b240c2) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Is there more to do here? |
Sorry if this is daft, but could someone help me understand how I can find out what python release this fix will be part of? |
The fix will be included in 3.13.0b2 and 3.12.4. I think both should be coming pretty soon. |
Bug report
Bug description:
This works on Python ≤ 3.11, and I think this is expected because the docs for
update_wrapper
claim that it may be used with callables other than functions.However, with 3.12, I get
(Similarly for
functools.wraps
.)The problem is that update_wrapper includes
__type_params__
by default (which is undocumented, see related issue) andtype.__type_params__
is a descriptor.CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
type.__type_params__
now return an empty tuple #119296type.__type_params__
now return an empty tuple (GH-119296) #119678type.__type_params__
now return an empty tuple (GH-119296) #119681The text was updated successfully, but these errors were encountered: