-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Possible fatal errors due to _PyEval_SetAsyncGen{Finalizer,Firstiter}() #82591
Comments
_PyEval_SetAsyncGenFinalizer() and _PyEval_SetAsyncGenFirstiter() don't include proper error handling for their PySys_Audit() calls. This could lead to leaked exceptions and fatal errors. |
You're right, they need either your patch or PyErr_WriteUnraisable(NULL) before returning. Łukasz - this needs a fix in 3.8, but we don't have to necessarily change the (internal, but exposed) ABI. For 3.9, we'll fix it properly, but for 3.8 I'll let you make the call whether we can also add a return value to these functions. -PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *);
+PyAPI_FUNC(int) _PyEval_SetAsyncGenFirstiter(PyObject *);
PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void);
-PyAPI_FUNC(void) _PyEval_SetAsyncGenFinalizer(PyObject *);
+PyAPI_FUNC(int) _PyEval_SetAsyncGenFinalizer(PyObject *); |
Unfortunately at this point we will have to leave the ABI as is. We are in fact promising to lock it by Beta 3 so quite a long time ago. |
In that case, the fix for 3.8 should be to call PyErr_WriteUnraisable(NULL) when an error occurs. This will report it through the new unraisable hook, and also prevent a fatal error if the exception escapes. |
But I'm okay to defer it - this is still going to be obscure functionality for the time being, and it's possible to avoid the issue. |
Why this ABI is exported at all? These functions are only used in the sys module, why they are defined in ceval.c instead of be static functions in sysmodule.c? |
Great question for (probably) Yury, but it is exported and so we're stuck with it for 3.8 at least :( |
Note: this is going to miss Python 3.8.1 as I'm releasing 3.8.1rc1 right now. Please address this before 3.8.2 (due in February). |
Sadly, this missed the train for 3.8.2. Steve, what's the status of the open PR for this? |
I thought we weren't going to take the fix for 3.8 anyway? (Or did we make a smaller one and commit it directly, apparently without linking it to the issue correctly?) The status is the PR needs conflicts resolved, and people need to stop adding to my infinite list of GitHub notifications and ping me on here instead :) |
PR 18658 is a backport to 3.8 which preserves binary compatibility. |
I had pinged Steve Dower on the PR, but I didn't realize they weren't notified. The merge conflicts have been fixed. |
Sorry for missing the pings! My GitHub notifications are a bit of a black hole. I'll merge it now. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: