diff options
author | Brett Cannon <brett@python.org> | 2016-07-16 10:45:16 -0700 |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2016-07-16 10:45:16 -0700 |
commit | 29d07dd448091a961e0a944b0520931e8b18bf14 (patch) | |
tree | bac43f12935f066df05397790c67db5487daa63a /Python/sysmodule.c | |
parent | 3c5fbee8247bbc9a198192f46f1efd3043a48d67 (diff) | |
parent | f26a4b6b040bfa39f372ee0ca5a8529ea9ba7ba0 (diff) | |
download | cpython-29d07dd448091a961e0a944b0520931e8b18bf14.tar.gz |
Merge for #27083
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 8d7e05a465..56175d9544 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -20,6 +20,7 @@ Data members: #include "pythread.h" #include "osdefs.h" +#include <locale.h> #ifdef MS_WINDOWS #define WIN32_LEAN_AND_MEAN @@ -33,7 +34,6 @@ extern const char *PyWin_DLLVersionString; #endif #ifdef HAVE_LANGINFO_H -#include <locale.h> #include <langinfo.h> #endif @@ -346,8 +346,10 @@ static PyObject *whatstrings[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static int trace_init(void) { - static char *whatnames[7] = {"call", "exception", "line", "return", - "c_call", "c_exception", "c_return"}; + static const char * const whatnames[7] = { + "call", "exception", "line", "return", + "c_call", "c_exception", "c_return" + }; PyObject *name; int i; for (i = 0; i < 7; ++i) { @@ -434,10 +436,7 @@ trace_trampoline(PyObject *self, PyFrameObject *frame, return -1; } if (result != Py_None) { - PyObject *temp = frame->f_trace; - frame->f_trace = NULL; - Py_XDECREF(temp); - frame->f_trace = result; + Py_XSETREF(frame->f_trace, result); } else { Py_DECREF(result); @@ -1152,8 +1151,10 @@ static PyObject * sys_debugmallocstats(PyObject *self, PyObject *args) { #ifdef WITH_PYMALLOC - _PyObject_DebugMallocStats(stderr); - fputc('\n', stderr); + if (_PyMem_PymallocEnabled()) { + _PyObject_DebugMallocStats(stderr); + fputc('\n', stderr); + } #endif _PyObject_DebugTypeStats(stderr); @@ -1643,15 +1644,11 @@ make_version_info(void) /* sys.implementation values */ #define NAME "cpython" const char *_PySys_ImplName = NAME; -#define QUOTE(arg) #arg -#define STRIFY(name) QUOTE(name) -#define MAJOR STRIFY(PY_MAJOR_VERSION) -#define MINOR STRIFY(PY_MINOR_VERSION) +#define MAJOR Py_STRINGIFY(PY_MAJOR_VERSION) +#define MINOR Py_STRINGIFY(PY_MINOR_VERSION) #define TAG NAME "-" MAJOR MINOR const char *_PySys_ImplCacheTag = TAG; #undef NAME -#undef QUOTE -#undef STRIFY #undef MAJOR #undef MINOR #undef TAG @@ -1696,6 +1693,16 @@ make_impl_info(PyObject *version_info) if (res < 0) goto error; +#ifdef MULTIARCH + value = PyUnicode_FromString(MULTIARCH); + if (value == NULL) + goto error; + res = PyDict_SetItemString(impl_info, "_multiarch", value); + Py_DECREF(value); + if (res < 0) + goto error; +#endif + /* dict ready */ ns = _PyNamespace_New(impl_info); |