mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Fix bug #1517, a segfault in lookdict().
This commit is contained in:
parent
430e3620b6
commit
31645ba4a0
1 changed files with 4 additions and 0 deletions
|
@ -270,7 +270,9 @@ lookdict(PyDictObject *mp, PyObject *key, register long hash)
|
||||||
else {
|
else {
|
||||||
if (ep->me_hash == hash) {
|
if (ep->me_hash == hash) {
|
||||||
startkey = ep->me_key;
|
startkey = ep->me_key;
|
||||||
|
Py_INCREF(startkey);
|
||||||
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
|
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
|
||||||
|
Py_DECREF(startkey);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (ep0 == mp->ma_table && ep->me_key == startkey) {
|
if (ep0 == mp->ma_table && ep->me_key == startkey) {
|
||||||
|
@ -300,7 +302,9 @@ lookdict(PyDictObject *mp, PyObject *key, register long hash)
|
||||||
return ep;
|
return ep;
|
||||||
if (ep->me_hash == hash && ep->me_key != dummy) {
|
if (ep->me_hash == hash && ep->me_key != dummy) {
|
||||||
startkey = ep->me_key;
|
startkey = ep->me_key;
|
||||||
|
Py_INCREF(startkey);
|
||||||
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
|
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
|
||||||
|
Py_DECREF(startkey);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (ep0 == mp->ma_table && ep->me_key == startkey) {
|
if (ep0 == mp->ma_table && ep->me_key == startkey) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue