diff options
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index b519912..8d7e05a 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -20,7 +20,6 @@ Data members: #include "pythread.h" #include "osdefs.h" -#include <locale.h> #ifdef MS_WINDOWS #define WIN32_LEAN_AND_MEAN @@ -34,6 +33,7 @@ extern const char *PyWin_DLLVersionString; #endif #ifdef HAVE_LANGINFO_H +#include <locale.h> #include <langinfo.h> #endif @@ -346,10 +346,8 @@ static PyObject *whatstrings[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static int trace_init(void) { - static const char * const whatnames[7] = { - "call", "exception", "line", "return", - "c_call", "c_exception", "c_return" - }; + static char *whatnames[7] = {"call", "exception", "line", "return", + "c_call", "c_exception", "c_return"}; PyObject *name; int i; for (i = 0; i < 7; ++i) { @@ -436,7 +434,10 @@ trace_trampoline(PyObject *self, PyFrameObject *frame, return -1; } if (result != Py_None) { - Py_XSETREF(frame->f_trace, result); + PyObject *temp = frame->f_trace; + frame->f_trace = NULL; + Py_XDECREF(temp); + frame->f_trace = result; } else { Py_DECREF(result); @@ -1151,10 +1152,8 @@ static PyObject * sys_debugmallocstats(PyObject *self, PyObject *args) { #ifdef WITH_PYMALLOC - if (_PyMem_PymallocEnabled()) { - _PyObject_DebugMallocStats(stderr); - fputc('\n', stderr); - } + _PyObject_DebugMallocStats(stderr); + fputc('\n', stderr); #endif _PyObject_DebugTypeStats(stderr); @@ -1644,11 +1643,15 @@ make_version_info(void) /* sys.implementation values */ #define NAME "cpython" const char *_PySys_ImplName = NAME; -#define MAJOR Py_STRINGIFY(PY_MAJOR_VERSION) -#define MINOR Py_STRINGIFY(PY_MINOR_VERSION) +#define QUOTE(arg) #arg +#define STRIFY(name) QUOTE(name) +#define MAJOR STRIFY(PY_MAJOR_VERSION) +#define MINOR STRIFY(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 |