mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-46857: Fix refleak in OSError INIT_ALIAS() (GH-31594)
_Py_GetRefTotal() no longer decrements _PySet_Dummy refcount.
This commit is contained in:
parent
e182c660b6
commit
ad56919c5e
3 changed files with 7 additions and 18 deletions
|
@ -15,10 +15,10 @@
|
|||
|
||||
|
||||
/* Compatibility aliases */
|
||||
PyObject *PyExc_EnvironmentError = NULL;
|
||||
PyObject *PyExc_IOError = NULL;
|
||||
PyObject *PyExc_EnvironmentError = NULL; // borrowed ref
|
||||
PyObject *PyExc_IOError = NULL; // borrowed ref
|
||||
#ifdef MS_WINDOWS
|
||||
PyObject *PyExc_WindowsError = NULL;
|
||||
PyObject *PyExc_WindowsError = NULL; // borrowed ref
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -3647,10 +3647,8 @@ _PyBuiltins_AddExceptions(PyObject *bltinmod)
|
|||
|
||||
#define INIT_ALIAS(NAME, TYPE) \
|
||||
do { \
|
||||
Py_INCREF(PyExc_ ## TYPE); \
|
||||
Py_XDECREF(PyExc_ ## NAME); \
|
||||
PyExc_ ## NAME = PyExc_ ## TYPE; \
|
||||
if (PyDict_SetItemString(mod_dict, # NAME, PyExc_ ## NAME)) { \
|
||||
if (PyDict_SetItemString(mod_dict, # NAME, PyExc_ ## TYPE)) { \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue