-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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-106320: Remove private _PyType_Lookup() function #108600
Conversation
Move the private function to the internal C API (pycore_object.h).
@serhiy-storchaka: I vaguely recall that you considered to expose a similar API to the public C API. Is it still the case? Or what is the PyObject_GetOptionalAttr() API that you added to Python 3.13? |
_PyType_Lookup() is mentioned in Python code "Emulate _PyType_Lookup() in Objects/typeobject.c" at: https://docs.python.org/dev/howto/descriptor.html#invocation-from-an-instance _PyType_Lookup() was mentioned in: |
No, I did not work with Perhaps we should first add a public and better designed variants of |
Results of a code search on PyPI top 5,000 projects (2023-07-04). Affected projects (20):
|
If a private function is widely used and it makes sense to expose it to the public C API, sure, go ahead.
Which aspects of the API you would like to change in _PyType_Lookup()? |
First of all, it contains If it start returning an error, there are variants of the interface: return a pointer with the following calling of Then you may want to return a new reference, although I am not sure that there is a problem with a borrowing reference here. But we should investigate. It may be turn out that |
I close my issue. I prefer to keep Well, apparently, it's still interesting to consider adding a public flavor of this API. |
Move the private function to the internal C API (pycore_object.h).