summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2016-07-16 18:27:11 -0400
committerTerry Jan Reedy <tjreedy@udel.edu>2016-07-16 18:27:11 -0400
commit61537aeaa3e0a9548a16ce3bfc9c4dd629ce7211 (patch)
treefabfded1dfc58221baa18a9a5a21aa2add31933f /Python/sysmodule.c
parenta9ae1d67054fc0a8ad272082c41919044d1c1e9c (diff)
parent8f310e95a73a11c4184b7cd40bfb0d04609a171c (diff)
downloadcpython-61537aeaa3e0a9548a16ce3bfc9c4dd629ce7211.tar.gz
Issue #25507: Merge from 3.5 with ttk replacing colorchooser.
IDLE no longer runs buggy code because of its tkinter imports. Users must include the same imports required to run directly in Python.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c37
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);