]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-38364: unwrap partialmethods just like we unwrap partials (#16600)
authorMartijn Pieters <mj@zopatista.com>
Thu, 15 Feb 2024 11:08:45 +0000 (11:08 +0000)
committerGitHub <noreply@github.com>
Thu, 15 Feb 2024 11:08:45 +0000 (12:08 +0100)
commitedb59d57188e5535729c3948d673d0de1b729c05
tree8de60290f8eda9ffc8dd5e060966218c7c5aed4e
parent9e3729bbd77fb9dcaea6a06ac760160136d80b79
bpo-38364: unwrap partialmethods just like we unwrap partials (#16600)

* bpo-38364: unwrap partialmethods just like we unwrap partials

The inspect.isgeneratorfunction, inspect.iscoroutinefunction and inspect.isasyncgenfunction already unwrap functools.partial objects, this patch adds support for partialmethod objects as well.

Also: Rename _partialmethod to __partialmethod__.
Since we're checking this attribute on arbitrary function-like objects,
we should use the namespace reserved for core Python.

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/library/inspect.rst
Lib/functools.py
Lib/inspect.py
Lib/test/test_inspect/test_inspect.py
Misc/NEWS.d/next/Library/2019-10-05-22-56-50.bpo-38364.sYTCWF.rst [new file with mode: 0644]