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
gh-58211: Add tests for __self__ attribute of builtins functions #113575
base: main
Are you sure you want to change the base?
gh-58211: Add tests for __self__ attribute of builtins functions #113575
Conversation
The check about the f argument type was removed in this commit: python@2c94aa5 Thanks for Pedro Arthur Duarte (pedroarthur.jedi at gmail.com) by the help with this bug.
…#106335) Remove private _PyThreadState and _PyInterpreterState C API functions: move them to the internal C API (pycore_pystate.h and pycore_interp.h). Don't export most of these functions anymore, but still export functions used by tests. Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C API, but keep it in the stable API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to me to go in the opposite direction to the consensus in #58211 -- the consensus seems to me to be that this is a misfeature that could only be confusing. That doesn't mean that we should necessarily bother changing the current behaviour unless it's actually causing a bug for somebody. But we should only add tests for things which are working in a desirable way currently -- we shouldn't cement undesirable behaviour by adding tests for it.
I'm therefore doubtful that this PR is a good idea. Instead, as I suggested in #113574 (comment), I think we should fix the documentation so that it is more vague about what the value of this attribute might be for builtin functions.
Yes, I agree. (Although I'm the PR author). The big problem is where desirable behaviour is defined. Furthermore, ignoring other necessary knowledge, I think of the
I don't know if this is a good idea. I guess not. Maybe it is better to remove this attribute from the documentation. Seeing the Terry's comment, the bug is not only the |
|
There is a code in |
Do you mean:
? |
|
I meant considering this PR. |
Although there was an inconclusive discussion in #58211, this PR adds tests to
__self__in built-in callables as it work currently.If was accepted, after PR #113574 is merged we can fix the documentation too (just avoid conflict).