Mercurial > cpython-lru_cache-weakref
comparison Python/thread.c @ 39131:7c09b66f04bd legacy-trunk
Handle more memory allocation failures without crashing.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Fri, 21 Jul 2006 07:59:47 +0000 |
| parents | f7d23bca599f |
| children | eefe4450f773 132d908471c8 |
comparison
equal
deleted
inserted
replaced
| 39130:baa54337c3d9 | 39131:7c09b66f04bd |
|---|---|
| 265 find_key(int key, void *value) | 265 find_key(int key, void *value) |
| 266 { | 266 { |
| 267 struct key *p; | 267 struct key *p; |
| 268 long id = PyThread_get_thread_ident(); | 268 long id = PyThread_get_thread_ident(); |
| 269 | 269 |
| 270 if (!keymutex) | |
| 271 return NULL; | |
| 270 PyThread_acquire_lock(keymutex, 1); | 272 PyThread_acquire_lock(keymutex, 1); |
| 271 for (p = keyhead; p != NULL; p = p->next) { | 273 for (p = keyhead; p != NULL; p = p->next) { |
| 272 if (p->id == id && p->key == key) | 274 if (p->id == id && p->key == key) |
| 273 goto Done; | 275 goto Done; |
| 274 } | 276 } |
