aboutsummaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
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
parentc232c9110cfefa0935cbf158e35e91746a8a9361 (diff)
downloadcpython3-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.gz
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 3ec5a00f30..527693c809 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'",