From 63755a6bb1e812c6a3b40b158dded0aed326bf77 Mon Sep 17 00:00:00 2001 From: Jesus Cea Date: Fri, 5 Oct 2012 01:04:27 +0200 Subject: #16135: Removal of OS/2 support (I) --- Python/thread.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'Python/thread.c') diff --git a/Python/thread.c b/Python/thread.c index e55d34244e..25ab16e647 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -91,10 +91,6 @@ static size_t _pythread_stacksize = 0; #include "thread_nt.h" #endif -#ifdef OS2_THREADS -#define PYTHREAD_NAME "os2" -#include "thread_os2.h" -#endif /* #ifdef FOOBAR_THREADS -- cgit v1.2.1 From 0e6215070ac12c5aecdce573f75624eaa7ed056e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 7 Jul 2013 16:25:15 +0200 Subject: Issue #18203: Replace malloc() with PyMem_RawMalloc() at Python initialization * Replace malloc() with PyMem_RawMalloc() * Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held. * _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead of PyMem_Malloc() --- Python/thread.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Python/thread.c') diff --git a/Python/thread.c b/Python/thread.c index 25ab16e647..54ce875eb2 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -231,7 +231,7 @@ find_key(int key, void *value) assert(p == NULL); goto Done; } - p = (struct key *)malloc(sizeof(struct key)); + p = (struct key *)PyMem_RawMalloc(sizeof(struct key)); if (p != NULL) { p->id = id; p->key = key; @@ -270,7 +270,7 @@ PyThread_delete_key(int key) while ((p = *q) != NULL) { if (p->key == key) { *q = p->next; - free((void *)p); + PyMem_RawFree((void *)p); /* NB This does *not* free p->value! */ } else @@ -324,7 +324,7 @@ PyThread_delete_key_value(int key) while ((p = *q) != NULL) { if (p->key == key && p->id == id) { *q = p->next; - free((void *)p); + PyMem_RawFree((void *)p); /* NB This does *not* free p->value! */ break; } @@ -357,7 +357,7 @@ PyThread_ReInitTLS(void) while ((p = *q) != NULL) { if (p->id != id) { *q = p->next; - free((void *)p); + PyMem_RawFree((void *)p); /* NB This does *not* free p->value! */ } else -- cgit v1.2.1 From 92d3e3cf6bfe7320aea27780a6525e6075624935 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 22 Jul 2013 22:24:54 +0200 Subject: Issue #18520: Add a new PyStructSequence_InitType2() function, same than PyStructSequence_InitType() except that it has a return value (0 on success, -1 on error). * PyStructSequence_InitType2() now raises MemoryError on memory allocation failure * Fix also some calls to PyDict_SetItemString(): handle error --- Python/thread.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Python/thread.c') diff --git a/Python/thread.c b/Python/thread.c index 54ce875eb2..8540942e28 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -399,8 +399,10 @@ PyThread_GetInfo(void) int len; #endif - if (ThreadInfoType.tp_name == 0) - PyStructSequence_InitType(&ThreadInfoType, &threadinfo_desc); + if (ThreadInfoType.tp_name == 0) { + if (PyStructSequence_InitType2(&ThreadInfoType, &threadinfo_desc) < 0) + return NULL; + } threadinfo = PyStructSequence_New(&ThreadInfoType); if (threadinfo == NULL) -- cgit v1.2.1