gh-108901: Add bound_arg to Signature.from_callable() and signature()#116559
gh-108901: Add bound_arg to Signature.from_callable() and signature()#116559sobolevn wants to merge 10 commits into
bound_arg to Signature.from_callable() and signature()#116559Conversation
…and `signature()`
Co-authored-by: Victor Stinner <vstinner@python.org>
|
By the way, @pitrou: Do you have an opinion on the parameter name? :-) |
Sorry, something went wrong.
|
I would prefer to have Lines 1404 to 1413 in 4e5df20 |
Sorry, something went wrong.
|
skip_bound_arg=False is a double negation, and I'm always confused by double negation :-( bound_arg=True is more straightfoward to me. Previously, the argument was private, no? |
Sorry, something went wrong.
|
Yes, it was private. It only existed on protected |
Sorry, something went wrong.
skip_bound_arg to Signature.from_callable() and signature()|
Done, now it is named |
Sorry, something went wrong.
|
What's the motivation for this change? I can't find the discussion behind it. My worry is that it only works on some callables, and it's not very clear which ones those are -- or how to make a custom callable (e.g. one implemented in the C API) work like a method. |
Sorry, something went wrong.
I want to deprecate Lines 1403 to 1423 in 2c45148
It will work exactly like this older function. |
Sorry, something went wrong.
|
Is this behaviour useful, or is it a bug that's kept in |
Sorry, something went wrong.
IMO it's useful in general, not only for backward compatibility. Keep self or not should be configurable. |
Sorry, something went wrong.
I think it was primarily a quirk of the way However, the suggested flag isn't hard to maintain, since the complexity is in the branch that corrects the underlying function signature to remove the already bound first parameter (the default behaviour). The "unwrap bound methods" branch is literally just Line 2517 in 3989894 I do think making the flag public is worth including as a step prior to full programmatic deprecation of (The one potential argument I see for a parameter name like |
Sorry, something went wrong.
My worry is that while the flag isn't hard to maintain as an internal detail of how (Unfortunately I'll probably not have time to investigate this worry before beta 1. If the feature is waiting for my review, it won't make it.) |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
inspectmodule, deprecate old incorrect APIs #108901📚 Documentation preview 📚: https://cpython-previews--116559.org.readthedocs.build/