mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
gh-128421: add critical section around traceback.tb_next (#131322)
This commit is contained in:
parent
b12af0a48f
commit
39b37b0110
2 changed files with 82 additions and 14 deletions
53
Python/clinic/traceback.c.h
generated
53
Python/clinic/traceback.c.h
generated
|
|
@ -6,6 +6,7 @@ preserve
|
|||
# include "pycore_gc.h" // PyGC_Head
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
|
||||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
PyDoc_STRVAR(tb_new__doc__,
|
||||
|
|
@ -79,4 +80,54 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=62ebc0196940f663 input=a9049054013a1b77]*/
|
||||
|
||||
#if !defined(traceback_tb_next_DOCSTR)
|
||||
# define traceback_tb_next_DOCSTR NULL
|
||||
#endif
|
||||
#if defined(TRACEBACK_TB_NEXT_GETSETDEF)
|
||||
# undef TRACEBACK_TB_NEXT_GETSETDEF
|
||||
# define TRACEBACK_TB_NEXT_GETSETDEF {"tb_next", (getter)traceback_tb_next_get, (setter)traceback_tb_next_set, traceback_tb_next_DOCSTR},
|
||||
#else
|
||||
# define TRACEBACK_TB_NEXT_GETSETDEF {"tb_next", (getter)traceback_tb_next_get, NULL, traceback_tb_next_DOCSTR},
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
traceback_tb_next_get_impl(PyTracebackObject *self);
|
||||
|
||||
static PyObject *
|
||||
traceback_tb_next_get(PyObject *self, void *Py_UNUSED(context))
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = traceback_tb_next_get_impl((PyTracebackObject *)self);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#if !defined(traceback_tb_next_DOCSTR)
|
||||
# define traceback_tb_next_DOCSTR NULL
|
||||
#endif
|
||||
#if defined(TRACEBACK_TB_NEXT_GETSETDEF)
|
||||
# undef TRACEBACK_TB_NEXT_GETSETDEF
|
||||
# define TRACEBACK_TB_NEXT_GETSETDEF {"tb_next", (getter)traceback_tb_next_get, (setter)traceback_tb_next_set, traceback_tb_next_DOCSTR},
|
||||
#else
|
||||
# define TRACEBACK_TB_NEXT_GETSETDEF {"tb_next", NULL, (setter)traceback_tb_next_set, NULL},
|
||||
#endif
|
||||
|
||||
static int
|
||||
traceback_tb_next_set_impl(PyTracebackObject *self, PyObject *value);
|
||||
|
||||
static int
|
||||
traceback_tb_next_set(PyObject *self, PyObject *value, void *Py_UNUSED(context))
|
||||
{
|
||||
int return_value;
|
||||
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = traceback_tb_next_set_impl((PyTracebackObject *)self, value);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=ca43786e235e38f4 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue