summaryrefslogtreecommitdiff
path: root/Programs
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-04-19 23:23:16 +0000
committerMartin Panter <vadmium+py@gmail.com>2016-04-19 23:23:16 +0000
commit79ff0c29b64125e2cdbdae3de8e15adbd5e534ae (patch)
tree65d11eec4b46d815f9b822be2e6b7d37840e52ff /Programs
parentc0bab1805f6caae133e7796e61376d423c521853 (diff)
parent61f1518bf3adc8256cbf294b3dd221a296be395e (diff)
downloadcpython-79ff0c29b64125e2cdbdae3de8e15adbd5e534ae.tar.gz
Merge doc and comment fixes from 3.5
Diffstat (limited to 'Programs')
-rw-r--r--Programs/python.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Programs/python.c b/Programs/python.c
index 37b10b837e..a7afbc774b 100644
--- a/Programs/python.c
+++ b/Programs/python.c
@@ -24,6 +24,9 @@ main(int argc, char **argv)
int i, res;
char *oldloc;
+ /* Force malloc() allocator to bootstrap Python */
+ (void)_PyMem_SetupAllocators("malloc");
+
argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
if (!argv_copy || !argv_copy2) {
@@ -62,7 +65,13 @@ main(int argc, char **argv)
setlocale(LC_ALL, oldloc);
PyMem_RawFree(oldloc);
+
res = Py_Main(argc, argv_copy);
+
+ /* Force again malloc() allocator to release memory blocks allocated
+ before Py_Main() */
+ (void)_PyMem_SetupAllocators("malloc");
+
for (i = 0; i < argc; i++) {
PyMem_RawFree(argv_copy2[i]);
}