diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-10-28 20:34:11 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-10-28 20:34:11 +0000 |
commit | ef9875b11a33dbd25e92bc6b4cf692c18c9ba0ce (patch) | |
tree | 1f2fd4e4d9e585da35937b42fbda5f854af04728 /contrib/tools/python3/Modules/_operator.c | |
parent | 37ae9cc90160b53eb0e22021c47b3996a01cd656 (diff) | |
parent | e3c8507a3d1cb090278f211232ddfde3bedc54d4 (diff) | |
download | ydb-ef9875b11a33dbd25e92bc6b4cf692c18c9ba0ce.tar.gz |
Merge branch 'rightlib' into mergelibs-241028-2033
Diffstat (limited to 'contrib/tools/python3/Modules/_operator.c')
-rw-r--r-- | contrib/tools/python3/Modules/_operator.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/tools/python3/Modules/_operator.c b/contrib/tools/python3/Modules/_operator.c index 68ccc90562..720687d4ad 100644 --- a/contrib/tools/python3/Modules/_operator.c +++ b/contrib/tools/python3/Modules/_operator.c @@ -2,6 +2,9 @@ #include "pycore_moduleobject.h" // _PyModule_GetState() #include "structmember.h" // PyMemberDef #include "pycore_runtime.h" // _Py_ID() +#include "pycore_pystate.h" // _PyInterpreterState_GET() + + #include "clinic/_operator.c.h" typedef struct { @@ -1224,6 +1227,7 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; /* prepare attr while checking args */ + PyInterpreterState *interp = _PyInterpreterState_GET(); for (idx = 0; idx < nattrs; ++idx) { PyObject *item = PyTuple_GET_ITEM(args, idx); int dot_count; @@ -1251,7 +1255,7 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (dot_count == 0) { Py_INCREF(item); - PyUnicode_InternInPlace(&item); + _PyUnicode_InternMortal(interp, &item); PyTuple_SET_ITEM(attr, idx, item); } else { /* make it a tuple of non-dotted attrnames */ PyObject *attr_chain = PyTuple_New(dot_count + 1); @@ -1277,7 +1281,7 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_DECREF(attr); return NULL; } - PyUnicode_InternInPlace(&attr_chain_item); + _PyUnicode_InternMortal(interp, &attr_chain_item); PyTuple_SET_ITEM(attr_chain, attr_chain_idx, attr_chain_item); ++attr_chain_idx; unibuff_till = unibuff_from = unibuff_till + 1; @@ -1291,7 +1295,7 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_DECREF(attr); return NULL; } - PyUnicode_InternInPlace(&attr_chain_item); + _PyUnicode_InternMortal(interp, &attr_chain_item); PyTuple_SET_ITEM(attr_chain, attr_chain_idx, attr_chain_item); PyTuple_SET_ITEM(attr, idx, attr_chain); @@ -1587,7 +1591,8 @@ methodcaller_new(PyTypeObject *type, PyObject *args, PyObject *kwds) name = PyTuple_GET_ITEM(args, 0); Py_INCREF(name); - PyUnicode_InternInPlace(&name); + PyInterpreterState *interp = _PyInterpreterState_GET(); + _PyUnicode_InternMortal(interp, &name); mc->name = name; mc->kwds = Py_XNewRef(kwds); |