summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-06 22:41:44 +0100
committerVictor Stinner <victor.stinner@gmail.com>2013-11-06 22:41:44 +0100
commit090543736fa86c676252de7a44e6a7c6f347164e (patch)
treeca82d3bf4857aa474ba91d81c64cc946a22d31a0 /Include
parentbb52020d44b6f3f1ebd16ec6ce38f1f8a6330728 (diff)
downloadcpython-git-090543736fa86c676252de7a44e6a7c6f347164e.tar.gz
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 ef4583834e..a36c5be52f 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 { \