]> granicus.if.org Git - python/commitdiff
merge 3.2 (#16345)
authorBenjamin Peterson <benjamin@python.org>
Wed, 31 Oct 2012 18:09:11 +0000 (14:09 -0400)
committerBenjamin Peterson <benjamin@python.org>
Wed, 31 Oct 2012 18:09:11 +0000 (14:09 -0400)
1  2 
Lib/test/test_dict.py
Misc/NEWS
Objects/dictobject.c

Simple merge
diff --cc Misc/NEWS
index 20184fe52a6a55573c944492efe5d2d0824141a2,44f5864d828ed39665d88cf4fbac7fdd3e95eb42..c760a34ae456c249264402372686f220b223070d
+++ b/Misc/NEWS
@@@ -12,17 -10,14 +12,20 @@@ What's New in Python 3.3.1
  Core and Builtins
  -----------------
  
 -- Issue #16197: Update winreg docstrings and documentation to match code.
 +- 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 #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.
index aef8d101528b42be367a0a08e035e2e6340a422f,d3c5eac37071bab39e1075577bba7209ea790f8b..02dcf7b221f0a4d77bf94f12d8b33c31e1853140
@@@ -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;
              }
 -                Py_INCREF(key);
 -                Py_INCREF(value);
+             while (_PySet_NextEntry(seq, &pos, &key, &hash)) {
+                 if (insertdict(mp, key, hash, value)) {
+                     Py_DECREF(d);
+                     return NULL;
+                 }
+             }
+             return d;
          }
-         return d;
      }
  
      it = PyObject_GetIter(seq);