gh-156762: Fix tp_clear slot signature for operator.methodcaller - #156769
Conversation
|
@sergey-miryanov, could you please take a look at this PR? |
sergey-miryanov
left a comment
There was a problem hiding this comment.
Code looks good to me
|
@vstinner one-line tp_clear signature fix, approved by Sergey, CI green. Needs a core review. |
vstinner
left a comment
There was a problem hiding this comment.
Sadly, the modified code is not tested by python -m test test_operator, so if the code is modified in the future, we can fail to catch regressions.
Please add a test to test_operator which does something like:
import gc, operator
class C: pass
c = C()
c.m = operator.methodcaller('foo', c)
del c
gc.collect()|
@vstinner Thanks for the review. The test has been added. |
Co-authored-by: Victor Stinner <vstinner@python.org>
|
The Docs CI failed with an error that I don't understand: |
|
GH-157448 is a backport of this pull request to the 3.15 branch. |
|
Sorry, @ashm-dev and @vstinner, I could not cleanly backport this to |
|
GH-157449 is a backport of this pull request to the 3.14 branch. |
_operator:methodcaller_clearhas the wrong signature for thetp_clearslot (returnsvoid, notint) #156762