diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-04-16 14:54:27 -0700 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-04-16 14:54:27 -0700 |
commit | e10c2d6ab9e3ee5ebeca76a34dd93d624b579da1 (patch) | |
tree | 2a0216a274628659694e875dd03ffe65ab5344ad /Python/sysmodule.c | |
parent | 52fdbac919f35a276a2924a1dfe8b71c2b497db2 (diff) | |
parent | 88a7179f982d5982844e7e57c303c2df1f5e7854 (diff) | |
download | cpython-e10c2d6ab9e3ee5ebeca76a34dd93d624b579da1.tar.gz |
merge 3.5 (#26659)
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 8d7e05a465..0c68c544b0 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -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 |