Message410403
| Author |
vstinner |
| Recipients |
Mark.Shannon, vstinner |
| Date |
2022年01月12日.15:33:01 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1642001581.89.0.653777729997.issue46356@roundup.psfhosted.org> |
| In-reply-to |
| Content |
C extensions written for Python 3.10 and older which access directly to the PyFrameObject.f_back member build successfully on Python 3.11, but they can fail because f_back must not be read directly. f_back can be NULL even if the frame has an outer frame.
PyFrameObject*
PyFrame_GetBack(PyFrameObject *frame)
{
assert(frame != NULL);
PyFrameObject *back = frame->f_back;
if (back == NULL && frame->f_frame->previous != NULL) {
back = _PyFrame_GetFrameObject(frame->f_frame->previous);
}
Py_XINCREF(back);
return back;
}
I suggest to remove or "hide" this member from the structure. For example, rename "f_back" to "_f_back" to advice developers to not access it directly.
See also bpo-46355: Document PyFrameObject and PyThreadState changes. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2022年01月12日 15:33:01 | vstinner | set | recipients:
+ vstinner, Mark.Shannon |
| 2022年01月12日 15:33:01 | vstinner | set | messageid: <1642001581.89.0.653777729997.issue46356@roundup.psfhosted.org> |
| 2022年01月12日 15:33:01 | vstinner | link | issue46356 messages |
| 2022年01月12日 15:33:01 | vstinner | create |
|