Author: Mark Young <[email protected]>
Branch: fix_magic_reload
Changeset: r82605:f573ee8d305a
Date: 2016-02-28 18:42 -0500
http://bitbucket.org/pypy/pypy/changeset/f573ee8d305a/
Log: Skip all that checking when we're just trying to replace the
initialdict with the current dict.
diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -65,14 +65,14 @@
# properly, when updating the dict, we must be careful to never
# overwrite the value of a key already in w_initialdict. (So as to
avoid
# overriding the builtin value with a user-provided value)
- if not self.space.is_none(self.w_initialdict):
+ if self.space.is_none(self.w_initialdict) or save_all:
+ self.w_initialdict = self.space.call_method(self.w_dict, 'copy')
+ else:
w_items = self.space.call_method(self.w_dict, 'items')
for w_item in self.space.iteriterable(w_items):
w_key, w_value = self.space.fixedview(w_item,
expected_length=2)
- if save_all or not self.space.contains_w(self.w_initialdict,
w_key):
+ if not self.space.contains_w(self.w_initialdict, w_key):
self.space.setitem(self.w_initialdict, w_key, w_value)
- else:
- self.w_initialdict = self.space.call_method(self.w_dict, 'copy')
def get_applevel_name(cls):
""" NOT_RPYTHON """
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit