Commit 5deae4d4 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix another raise-before-stealing-argument bug

parent 9e7817ed
......@@ -48,6 +48,17 @@ static void _dictSetStolen(BoxedDict* self, BoxAndHash k, STOLEN(Box*) v) {
}
}
static void _dictSetStolen(BoxedDict* self, Box* k, STOLEN(Box*) v) {
BoxAndHash hashed_key;
try {
hashed_key = BoxAndHash(k);
} catch (ExcInfo e) {
Py_DECREF(v);
throw e;
}
return _dictSetStolen(self, hashed_key, v);
}
static void _dictSet(BoxedDict* self, BoxAndHash k, Box* v) {
_dictSetStolen(self, k, incref(v));
}
......
......@@ -920,6 +920,7 @@ struct BoxAndHash {
Box* value;
size_t hash;
BoxAndHash() {}
BoxAndHash(Box* value) : value(value), hash(PyHasher()(value)) {}
BoxAndHash(Box* value, size_t hash) : value(value), hash(hash) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment