mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merge 3.2
This commit is contained in:
commit
24bd5adcff
2 changed files with 15 additions and 4 deletions
|
@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
|
|||
Core and Builtins
|
||||
-----------------
|
||||
|
||||
- Issue #13018: Fix reference leaks in error paths in dictobject.c.
|
||||
Patch by Suman Saha.
|
||||
|
||||
- Issue #13201: Define '==' and '!=' to compare range objects based on
|
||||
the sequence of values they define (instead of comparing based on
|
||||
object identity).
|
||||
|
|
|
@ -1314,14 +1314,18 @@ dict_fromkeys(PyObject *cls, PyObject *args)
|
|||
PyObject *key;
|
||||
Py_hash_t hash;
|
||||
|
||||
if (dictresize(mp, Py_SIZE(seq)))
|
||||
if (dictresize(mp, Py_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))
|
||||
if (insertdict(mp, key, hash, value)) {
|
||||
Py_DECREF(d);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1332,14 +1336,18 @@ dict_fromkeys(PyObject *cls, PyObject *args)
|
|||
PyObject *key;
|
||||
Py_hash_t hash;
|
||||
|
||||
if (dictresize(mp, PySet_GET_SIZE(seq)))
|
||||
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))
|
||||
if (insertdict(mp, key, hash, value)) {
|
||||
Py_DECREF(d);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue