summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-06 21:41:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-06 21:41:44 (GMT)
commit090543736fa86c676252de7a44e6a7c6f347164e (patch)
treeca82d3bf4857aa474ba91d81c64cc946a22d31a0 /Include
parentbb52020d44b6f3f1ebd16ec6ce38f1f8a6330728 (diff)
downloadcpython-090543736fa86c676252de7a44e6a7c6f347164e.zip
cpython-090543736fa86c676252de7a44e6a7c6f347164e.tar.gz
cpython-090543736fa86c676252de7a44e6a7c6f347164e.tar.bz2
Issue #19512: add some common identifiers to only create common strings once,
instead of creating temporary Unicode string objects Add also more identifiers in pythonrun.c to avoid temporary Unicode string objets for the interactive interpreter.
Diffstat (limited to 'Include')
-rw-r--r--Include/object.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/Include/object.h b/Include/object.h
index ef45838..a36c5be 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -143,9 +143,17 @@ typedef struct _Py_Identifier {
PyObject *object;
} _Py_Identifier;
-#define _Py_static_string(varname, value) static _Py_Identifier varname = { 0, value, 0 }
+#define _Py_static_string_init(value) { 0, value, 0 }
+#define _Py_static_string(varname, value) static _Py_Identifier varname = _Py_static_string_init(value)
#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
+/* Common identifiers */
+PyAPI_DATA(_Py_Identifier) _PyId_path;
+PyAPI_DATA(_Py_Identifier) _PyId_argv;
+PyAPI_DATA(_Py_Identifier) _PyId_stdin;
+PyAPI_DATA(_Py_Identifier) _PyId_stdout;
+PyAPI_DATA(_Py_Identifier) _PyId_stderr;
+
/*
Type objects contain a string containing the type name (to help somewhat
in debugging), the allocation parameters (see PyObject_New() and
@@ -829,7 +837,7 @@ PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
PyObject *_py_xincref_tmp = (PyObject *)(op); \
if (_py_xincref_tmp != NULL) \
Py_INCREF(_py_xincref_tmp); \
- } while (0)
+ } while (0)
#define Py_XDECREF(op) \
do { \