Mercurial > cpython-lru_cache-weakref
comparison Python/import.c @ 78900:85070f284fd2
Issue #15781: Fix two small race conditions in import's module locking.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Tue, 28 Aug 2012 00:24:52 +0200 |
| parents | b878df1d23b1 |
| children | 3f6db10b7a69 |
comparison
equal
deleted
inserted
replaced
| 78899:4e941113e4fa | 78900:85070f284fd2 |
|---|---|
| 1406 else if (mod != NULL) { | 1406 else if (mod != NULL) { |
| 1407 PyObject *value; | 1407 PyObject *value; |
| 1408 int initializing = 0; | 1408 int initializing = 0; |
| 1409 | 1409 |
| 1410 Py_INCREF(mod); | 1410 Py_INCREF(mod); |
| 1411 /* Only call _bootstrap._lock_unlock_module() if __initializing__ is true. */ | 1411 /* Optimization: only call _bootstrap._lock_unlock_module() if |
| 1412 __initializing__ is true. | |
| 1413 NOTE: because of this, __initializing__ must be set *before* | |
| 1414 stuffing the new module in sys.modules. | |
| 1415 */ | |
| 1412 value = _PyObject_GetAttrId(mod, &PyId___initializing__); | 1416 value = _PyObject_GetAttrId(mod, &PyId___initializing__); |
| 1413 if (value == NULL) | 1417 if (value == NULL) |
| 1414 PyErr_Clear(); | 1418 PyErr_Clear(); |
| 1415 else { | 1419 else { |
| 1416 initializing = PyObject_IsTrue(value); | 1420 initializing = PyObject_IsTrue(value); |
