Uh oh!
There was an error while loading. Please reload this page.
gh-106320: Remove private _PyType_Lookup() function - #108600
Conversation
Move the private function to the internal C API (pycore_object.h).
vstinner
commented
Aug 29, 2023
@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? |
vstinner
commented
Aug 29, 2023
_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: |
serhiy-storchaka
commented
Aug 30, 2023
No, I did not work with Perhaps we should first add a public and better designed variants of |
vstinner
commented
Aug 30, 2023
Results of a code search on PyPI top 5,000 projects (2023-07-04). Affected projects (20):
|
vstinner
commented
Aug 30, 2023
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()? |
serhiy-storchaka
commented
Aug 31, 2023
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 |
vstinner
commented
Sep 4, 2023
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).