-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
PyType_GetModuleByDef family for binary functions performance #117578
Comments
Make it private at first, then perhaps expose it in another issue. |
It seems that extension modules such as |
Isn't this a recent side effect caused by a desire to use only the Limited API? @vstinner should know more. I think the slowdown you've observed is rather significant, so maybe we need to make an exception that restriction (if that's what's causing your observation). In modules not restricted to the Limited API, private APIs can be used as long as they use the |
Tested
|
Yep, I agree. Also, there is maybe no need to expose it in public right now :-)
Python has multiple stdlib extensions built as shared extensions: you should export internal functions using Example in // Export for 'math' shared extension
PyAPI_FUNC(PyObject*) _PyObject_LookupSpecial(PyObject *, PyObject *);
|
Thanks. I've been very confused around the |
) Co-authored-by: Erlend E. Aasland <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
Re-opening until #123100 is merged (just for tracking purposes). |
Superseded by |
Feature or enhancement
Proposal:
When implementing an extension module with a module state enabled,
binary tp slot functions (e.g.
nb_add
) need twoPyType_GetModuleByDef()
to be used like the following to compare the given types with a heap-type object in the module state, which can be slow:_decimal
(module state ver.)The difference mainly comes from a
TypeError
emission fromPyType_GetModuleByDef()
, so it would be nice if we could have a new function which receives two types and emits an error after checking them.cc @encukou
Related issue:
Linked PRs
The text was updated successfully, but these errors were encountered: