[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-17 Thread Łukasz Langa
Łukasz Langa added the comment: Thanks! ✨  ✨ -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-17 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset df7c62980d15acd3125dfbd81546dad359f7add7 by Miss Islington (bot) in branch '3.9': bpo-40897:Give priority to using the current class constructor in `inspect.signature` (GH-27177) (GH-27209)

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-17 Thread miss-islington
Change by miss-islington : -- pull_requests: +25747 pull_request: https://github.com/python/cpython/pull/27209 ___ Python tracker ___

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-17 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset ed2db9b5940ccbc0bc72d01bf62d8b3095ccef21 by Łukasz Langa in branch '3.9': bpo-40897: Partially backport GH-22583's refactor of inspect.py to allow bugfix backports (#27193)

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread Łukasz Langa
Change by Łukasz Langa : -- pull_requests: +25728 pull_request: https://github.com/python/cpython/pull/27193 ___ Python tracker ___

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread Łukasz Langa
Łukasz Langa added the comment: On second thought it's a bummer not to fix this in 3.9.x that will still be the only stable version until October. I'll refactor the relevant part of inspect.py in 3.9 to make the backport applicable. -- ___ Python

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 948e39a866ccf33b4e30668c3f88a95a65966159 by Miss Islington (bot) in branch '3.10': bpo-40897:Give priority to using the current class constructor in `inspect.signature` (GH-27177) (#27189)

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread Łukasz Langa
Łukasz Langa added the comment: We won't be backporting this fix to 3.9 due to larger changes between versions. -- versions: +Python 3.10, Python 3.11 ___ Python tracker ___

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 10.0 -> 11.0 pull_requests: +25725 pull_request: https://github.com/python/cpython/pull/27189 ___ Python tracker

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 6aab5f9bf303a8e4cd8377fabcdcb499e0541f9a by Weipeng Hong in branch 'main': bpo-40897:Give priority to using the current class constructor in `inspect.signature` (#27177)

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread hongweipeng
hongweipeng added the comment: >>> from datetime import timedelta as a >>> from _datetime import timedelta as b >>> a is b True >>> `timedelta` is a C-level class, so inspect.signature(timedelta) is the same with inspect.signature(int). But `signature` allow C-level function such as

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread hongweipeng
Change by hongweipeng : -- pull_requests: +25714 pull_request: https://github.com/python/cpython/pull/27177 ___ Python tracker ___

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-14 Thread Mauricio Villegas
Mauricio Villegas added the comment: I created another issue since the problem appears to be a bit different: https://bugs.python.org/issue44618 -- ___ Python tracker ___

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-10 Thread Mauricio Villegas
Mauricio Villegas added the comment: I think this is affecting me or it is a new similar issue. And it is not only for python 3.9, but also from 3.6 up. I am working on making code configurable based on signatures (see

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-02-17 Thread Guido van Rossum
Guido van Rossum added the comment: I doubt that solution is correct, given that we already established that the problem is *not* specific to Generic. -- ___ Python tracker

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-02-17 Thread Jonathan Slenders
Jonathan Slenders added the comment: The following patch to inspect.py solves the issue that inspect.signature() returns the wrong signature on classes that inherit from Generic. Not 100% sure though if this implementation is the cleanest way possible. I've been looking into attaching a

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2020-11-17 Thread hongweipeng
Change by hongweipeng : -- keywords: +patch nosy: +hongweipeng nosy_count: 6.0 -> 7.0 pull_requests: +5 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23336 ___ Python tracker

[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2020-06-08 Thread Guido van Rossum
Guido van Rossum added the comment: Changing the topic to not point fingers at Generic. -- nosy: -levkivskyi title: Inheriting from Generic causes inspect.signature to always return (*args, **kwargs) for constructor (and all subclasses) -> Inheriting from class that defines __new__