summaryrefslogtreecommitdiff
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-11-23 15:56:41 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2014-11-23 15:56:41 +0100
commit7b53f4ba313ddc97503a1b20a32c7ece98e6f14f (patch)
treed4a1ae925557271361d6681d52110a9baab414f8 /Python/thread_pthread.h
parent45d2905e417a1edcec07d77bb7a2b5e16a6d7a85 (diff)
parent86a6e9bbd9773fe387dae31f7ca24ccfcdc7ded1 (diff)
downloadcpython-7b53f4ba313ddc97503a1b20a32c7ece98e6f14f.tar.gz
Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures.
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r--Python/thread_pthread.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index d9f7c76f2a..27e0dc84bc 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -608,7 +608,15 @@ PyThread_create_key(void)
{
pthread_key_t key;
int fail = pthread_key_create(&key, NULL);
- return fail ? -1 : key;
+ if (fail)
+ return -1;
+ if (key > INT_MAX) {
+ /* Issue #22206: handle integer overflow */
+ pthread_key_delete(key);
+ errno = ENOMEM;
+ return -1;
+ }
+ return (int)key;
}
void