diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-06-28 17:08:35 +0300 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-06-28 17:08:35 +0300 |
| commit | f4590a801412d203b0597424cc6bd6c5f439f6d1 (patch) | |
| tree | aa68955d2c13a5186b5e9061c194978aacc8a045 /Python/thread_pthread.h | |
| parent | 6ea82ec7a7990220fd423ee7a777484dd24089b3 (diff) | |
| parent | fbff4549e00af01c17c03daa566002e560113fce (diff) | |
| download | cpython-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.h | 10 |
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 |
