]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId (GH-31835)
authorDong-hee Na <donghee.na@python.org>
Mon, 14 Mar 2022 12:48:00 +0000 (21:48 +0900)
committerGitHub <noreply@github.com>
Mon, 14 Mar 2022 12:48:00 +0000 (21:48 +0900)
Include/cpython/sysmodule.h
Misc/NEWS.d/next/C API/2022-03-12-18-37-06.bpo-46987.LWcwyN.rst [new file with mode: 0644]
Python/sysmodule.c

index 27dff7b2e3d930820741c8e1912f9d35591539d5..19d9dddc344a4f0ee4fb0d849b82f280e3000ca3 100644 (file)
@@ -4,8 +4,6 @@
 
 PyAPI_FUNC(PyObject *) _PySys_GetAttr(PyThreadState *tstate,
                                       PyObject *name);
-PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key);
-PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *);
 
 PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *);
 
diff --git a/Misc/NEWS.d/next/C API/2022-03-12-18-37-06.bpo-46987.LWcwyN.rst b/Misc/NEWS.d/next/C API/2022-03-12-18-37-06.bpo-46987.LWcwyN.rst
new file mode 100644 (file)
index 0000000..2c858af
--- /dev/null
@@ -0,0 +1,2 @@
+Remove private functions ``_PySys_GetObjectId()`` and ``_PySys_SetObjectId()``.
+Patch by Dong-hee Na.
index a97d0341ddcfd7390ffa32b88506f47c7043be18..99540b09c1f465e4fd1331dc85d5aa7465418378 100644 (file)
@@ -72,29 +72,6 @@ _PySys_GetAttr(PyThreadState *tstate, PyObject *name)
     return value;
 }
 
-static PyObject *
-sys_get_object_id(PyThreadState *tstate, _Py_Identifier *key)
-{
-    PyObject *sd = tstate->interp->sysdict;
-    if (sd == NULL) {
-        return NULL;
-    }
-    PyObject *exc_type, *exc_value, *exc_tb;
-    _PyErr_Fetch(tstate, &exc_type, &exc_value, &exc_tb);
-    PyObject *value = _PyDict_GetItemIdWithError(sd, key);
-    /* XXX Suppress a new exception if it was raised and restore
-     * the old one. */
-    _PyErr_Restore(tstate, exc_type, exc_value, exc_tb);
-    return value;
-}
-
-PyObject *
-_PySys_GetObjectId(_Py_Identifier *key)
-{
-    PyThreadState *tstate = _PyThreadState_GET();
-    return sys_get_object_id(tstate, key);
-}
-
 static PyObject *
 _PySys_GetObject(PyInterpreterState *interp, const char *name)
 {
@@ -139,19 +116,6 @@ sys_set_object(PyInterpreterState *interp, PyObject *key, PyObject *v)
     }
 }
 
-static int
-sys_set_object_id(PyInterpreterState *interp, _Py_Identifier *key, PyObject *v)
-{
-    return sys_set_object(interp, _PyUnicode_FromId(key), v);
-}
-
-int
-_PySys_SetObjectId(_Py_Identifier *key, PyObject *v)
-{
-    PyInterpreterState *interp = _PyInterpreterState_GET();
-    return sys_set_object_id(interp, key, v);
-}
-
 int
 _PySys_SetAttr(PyObject *key, PyObject *v)
 {