summaryrefslogtreecommitdiff
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-06-28 17:08:35 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2015-06-28 17:08:35 +0300
commitf4590a801412d203b0597424cc6bd6c5f439f6d1 (patch)
treeaa68955d2c13a5186b5e9061c194978aacc8a045 /Python/thread_pthread.h
parent6ea82ec7a7990220fd423ee7a777484dd24089b3 (diff)
parentfbff4549e00af01c17c03daa566002e560113fce (diff)
downloadcpython-f4590a801412d203b0597424cc6bd6c5f439f6d1.tar.gz
Issue #24336: The contextmanager decorator now works with functions with
keyword arguments called "func" and "self". Patch by Martin Panter.
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