from random import choice
import sys
from test import support
+ import time
import unittest
+import unittest.mock
from weakref import proxy
import contextlib
try:
Library
-------
+ - Issue #28969: Fixed race condition in C implementation of functools.lru_cache.
+ KeyError could be raised when cached function with full cache was
+ simultaneously called from differen threads with the same uncached arguments.
+
+- Issue #20804: The unittest.mock.sentinel attributes now preserve their
+ identity when they are copied or pickled.
+
- Issue #29142: In urllib.request, suffixes in no_proxy environment variable with
leading dots could match related hostnames again (e.g. .b.c matches a.b.c).
Patch by Milan Oberkirch.
_PyErr_SetKeyError(key);
return NULL;
}
- if (!PyUnicode_CheckExact(key) ||
- (hash = ((PyASCIIObject *) key)->hash) == -1) {
- hash = PyObject_Hash(key);
- if (hash == -1)
- return NULL;
- }
- ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos);
+ ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos);
if (ix == DKIX_ERROR)
return NULL;
- if (ix == DKIX_EMPTY || *value_addr == NULL) {
+ if (ix == DKIX_EMPTY || old_value == NULL) {
if (deflt) {
Py_INCREF(deflt);
return deflt;