aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/intrinsics.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2025-06-13 00:05:26 +0300
committershadchin <shadchin@yandex-team.com>2025-06-13 00:35:30 +0300
commit796b9088366b10b4cd42885101fc20c0b5709b07 (patch)
treef287eacb0b95ffd7cabf95b16cafb4788645dc38 /contrib/tools/python3/Python/intrinsics.c
parentc72bca862651e507d2ff4980ef7f4ff7267a7227 (diff)
downloadydb-796b9088366b10b4cd42885101fc20c0b5709b07.tar.gz
Update Python 3 to 3.12.10
commit_hash:dd2398e159fe1d72ea6b12da52fccc933a41a785
Diffstat (limited to 'contrib/tools/python3/Python/intrinsics.c')
-rw-r--r--contrib/tools/python3/Python/intrinsics.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/tools/python3/Python/intrinsics.c b/contrib/tools/python3/Python/intrinsics.c
index c6f5ac5402d..50b279693bf 100644
--- a/contrib/tools/python3/Python/intrinsics.c
+++ b/contrib/tools/python3/Python/intrinsics.c
@@ -8,6 +8,7 @@
#include "pycore_global_objects.h"
#include "pycore_intrinsics.h"
#include "pycore_pyerrors.h"
+#include "pycore_sysmodule.h" // _PySys_GetRequiredAttr()
#include "pycore_typevarobject.h"
@@ -21,16 +22,16 @@ no_intrinsic(PyThreadState* tstate, PyObject *unused)
}
static PyObject *
-print_expr(PyThreadState* tstate, PyObject *value)
+print_expr(PyThreadState* Py_UNUSED(ignored), PyObject *value)
{
- PyObject *hook = _PySys_GetAttr(tstate, &_Py_ID(displayhook));
+ PyObject *hook = _PySys_GetRequiredAttr(&_Py_ID(displayhook));
// Can't use ERROR_IF here.
if (hook == NULL) {
- _PyErr_SetString(tstate, PyExc_RuntimeError,
- "lost sys.displayhook");
return NULL;
}
- return PyObject_CallOneArg(hook, value);
+ PyObject *res = PyObject_CallOneArg(hook, value);
+ Py_DECREF(hook);
+ return res;
}
static int