aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2020-01-30 17:20:25 -0600
committerGitHub <noreply@github.com>2020-01-30 15:20:25 -0800
commit46874c26ee1fc752e2e6930efa1d223b2351edb8 (patch)
treeb4c85470214ac73ec6e4fa9981bb1f0e7b46472e /Objects/fileobject.c
parentbpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282) (diff)
downloadcpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.gz
cpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.bz2
cpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.zip
bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)
Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 3ec5a00f30f..527693c8099 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -25,6 +25,8 @@
extern "C" {
#endif
+_Py_IDENTIFIER(open);
+
/* External C interface */
PyObject *
@@ -32,7 +34,6 @@ PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const c
const char *errors, const char *newline, int closefd)
{
PyObject *io, *stream;
- _Py_IDENTIFIER(open);
/* import _io in case we are being used to open io.py */
io = PyImport_ImportModule("_io");
@@ -547,7 +548,6 @@ PyObject *
PyFile_OpenCodeObject(PyObject *path)
{
PyObject *iomod, *f = NULL;
- _Py_IDENTIFIER(open);
if (!PyUnicode_Check(path)) {
PyErr_Format(PyExc_TypeError, "'path' must be 'str', not '%.200s'",