From: Benjamin Peterson Date: Wed, 31 Oct 2012 18:09:11 +0000 (-0400) Subject: merge 3.2 (#16345) X-Git-Tag: v3.3.1rc1~712 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d97eb0d338f3d5746ba4bbd3cfe6e7c28948d41e;p=python merge 3.2 (#16345) --- d97eb0d338f3d5746ba4bbd3cfe6e7c28948d41e diff --cc Misc/NEWS index 20184fe52a,44f5864d82..c760a34ae4 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -12,17 -10,14 +12,20 @@@ What's New in Python 3.3.1 Core and Builtins ----------------- +- Fix segfaults on setting __qualname__ on builtin types and attempting to + delete it on any type. + + - Issue #16345: Fix an infinite loop when ``fromkeys`` on a dict subclass + recieved a nonempty dict from the constructor. + -- Issue #16197: Update winreg docstrings and documentation to match code. +- Issue #16271: Fix strange bugs that resulted from __qualname__ appearing in a + class's __dict__ and on type. + +- Issue #16197: Update winreg docstrings and documentation to match code. Patch by Zachary Ware. -- Issue #14700: Fix buggy overflow checks when handling large precisions and - widths in old-style and new-style formatting. +- Issue #16241: Document -X faulthandler command line option. + Patch by Marek Å uppa. - Issue #6074: Ensure cached bytecode files can always be updated by the user that created them, even when the source file is read-only. diff --cc Objects/dictobject.c index aef8d10152,d3c5eac370..02dcf7b221 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@@ -1724,28 -1347,38 +1719,34 @@@ dict_fromkeys(PyObject *cls, PyObject * Py_DECREF(d); return NULL; } - } - return d; - } - - if (PyDict_CheckExact(d) && PyAnySet_CheckExact(seq)) { - PyDictObject *mp = (PyDictObject *)d; - Py_ssize_t pos = 0; - PyObject *key; - Py_hash_t hash; - if (dictresize(mp, PySet_GET_SIZE(seq))) { - Py_DECREF(d); - return NULL; + while (_PyDict_Next(seq, &pos, &key, &oldvalue, &hash)) { - Py_INCREF(key); - Py_INCREF(value); + if (insertdict(mp, key, hash, value)) { + Py_DECREF(d); + return NULL; + } + } + return d; } + if (PyAnySet_CheckExact(seq)) { + PyDictObject *mp = (PyDictObject *)d; + Py_ssize_t pos = 0; + PyObject *key; + Py_hash_t hash; - while (_PySet_NextEntry(seq, &pos, &key, &hash)) { - if (insertdict(mp, key, hash, value)) { + if (dictresize(mp, PySet_GET_SIZE(seq))) { Py_DECREF(d); return NULL; } + + while (_PySet_NextEntry(seq, &pos, &key, &hash)) { - Py_INCREF(key); - Py_INCREF(value); + if (insertdict(mp, key, hash, value)) { + Py_DECREF(d); + return NULL; + } + } + return d; } - return d; } it = PyObject_GetIter(seq);