diff options
| author | Benjamin Peterson <benjamin@python.org> | 2016-05-26 22:56:51 -0700 |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2016-05-26 22:56:51 -0700 |
| commit | f701975a05ebda1c87ee2d078d2917676dc0de8b (patch) | |
| tree | 862aecee76f5699e7d5b47b02389c3d9824b1f91 /Python/sysmodule.c | |
| parent | 4d34b84dfcd51bf1d018cd301943433e6a1dff33 (diff) | |
| parent | b71ef42e94fb122b4321d4c8fae7b7c41cbd65b3 (diff) | |
| download | cpython-f701975a05ebda1c87ee2d078d2917676dc0de8b.tar.gz | |
merge 3.5
Diffstat (limited to 'Python/sysmodule.c')
| -rw-r--r-- | Python/sysmodule.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 8d7e05a465..b5199125a5 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 |
