Commit d43ea30f authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by Kevin Modzelewski

Dict ctor should not propagate certain exceptions

parent 616dd7bf
......@@ -800,7 +800,7 @@ Box* dictUpdate(BoxedDict* self, BoxedTuple* args, BoxedDict* kwargs) {
if (args->size()) {
Box* arg = args->elts[0];
static BoxedString* keys_str = getStaticString("keys");
if (autoXDecref(getattrInternal<ExceptionStyle::CXX>(arg, keys_str))) {
if (PyObject_HasAttr(arg, keys_str)) {
dictMerge(self, arg);
} else {
dictMergeFromSeq2(self, arg);
......
......@@ -240,3 +240,16 @@ print d
# Remove an item using a different key:
d = {1:1}
d.pop(1L)
# dict() will try to access the "keys" attribute, but it should swallow all exceptions
class MyObj(object):
def __iter__(self):
print "iter!"
return [(1, 2)].__iter__()
def __getattr__(self, attr):
print "getattr", attr
1/0
print dict(MyObj())
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