diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-22 22:24:54 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-22 22:24:54 +0200 |
commit | 92d3e3cf6bfe7320aea27780a6525e6075624935 (patch) | |
tree | dc99d26f5917c50df3eef98d5210f3e48f8b9749 /Python/thread.c | |
parent | 81be11b7102a19889c2a018cfac5c656301d00e1 (diff) | |
download | cpython-92d3e3cf6bfe7320aea27780a6525e6075624935.tar.gz |
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
Diffstat (limited to 'Python/thread.c')
-rw-r--r-- | Python/thread.c | 6 |
1 files changed, 4 insertions, 2 deletions
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) |