From: Alexandre Vassalotti Date: Sat, 30 Nov 2013 09:05:51 +0000 (-0800) Subject: Issue #19088: Merge with 3.3. X-Git-Tag: v3.4.0b2~425 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc6e87b2cf7613bc88791516bf4d6e0669d084d2;p=python Issue #19088: Merge with 3.3. --- cc6e87b2cf7613bc88791516bf4d6e0669d084d2 diff --cc Misc/NEWS index 3092821cdc,a0fcc2f38c..09d2516b1a --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -18,17 -18,9 +18,20 @@@ Core and Builtin Library ------- +- Issue #3693: Make the error message more helpful when the array.array() + constructor is given a str. Move the array module typecode documentation to + the docstring of the constructor. + + - Issue #19088: Fixed incorrect caching of the copyreg module in + object.__reduce__() and object.__reduce_ex__(). + +- Issue #19698: Removed exec_module() methods from + importlib.machinery.BuiltinImporter and ExtensionFileLoader. + +- ssl.create_default_context() sets OP_NO_COMPRESSION to prevent CRIME. + +- Issue #19802: Add socket.SO_PRIORITY. + - Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with virtual interface. Original patch by Kent Frazier. diff --cc Objects/typeobject.c index 42a0a58b76,8851faeeee..8b2ea1c1a6 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@@ -3390,24 -3341,35 +3383,34 @@@ static PyGetSetDef object_getsets[] = static PyObject * import_copyreg(void) { - static PyObject *copyreg_str; + PyObject *copyreg_str; + PyObject *copyreg_module; + PyInterpreterState *interp = PyThreadState_GET()->interp; + _Py_IDENTIFIER(copyreg); - if (!copyreg_str) { - copyreg_str = PyUnicode_InternFromString("copyreg"); - if (copyreg_str == NULL) - return NULL; + copyreg_str = _PyUnicode_FromId(&PyId_copyreg); + if (copyreg_str == NULL) { + return NULL; } - if (!cached_copyreg_module) { - cached_copyreg_module = PyImport_Import(copyreg_str); + /* Try to fetch cached copy of copyreg from sys.modules first in an + attempt to avoid the import overhead. Previously this was implemented + by storing a reference to the cached module in a static variable, but + this broke when multiple embeded interpreters were in use (see issue + #17408 and #19088). */ + copyreg_module = PyDict_GetItemWithError(interp->modules, copyreg_str); + if (copyreg_module != NULL) { + Py_INCREF(copyreg_module); + return copyreg_module; + } + if (PyErr_Occurred()) { + return NULL; } - - Py_XINCREF(cached_copyreg_module); - return cached_copyreg_module; + return PyImport_Import(copyreg_str); } -static PyObject * -slotnames(PyObject *cls) +Py_LOCAL(PyObject *) +_PyType_GetSlotNames(PyTypeObject *cls) { - PyObject *clsdict; PyObject *copyreg; PyObject *slotnames; _Py_IDENTIFIER(__slotnames__);