Commit 7ee0ff6f authored by Stefan Behnel's avatar Stefan Behnel

Minor safety/speed fix to prevent looking for a "__dict__" in an unpickled...

Minor safety/speed fix to prevent looking for a "__dict__" in an unpickled object if we don't have anything to fill it with in the first place.
parent 47ce818d
......@@ -1680,8 +1680,8 @@ if VALUE is not None:
cdef %(unpickle_func_name)s__set_state(%(class_name)s __pyx_result, tuple __pyx_state):
%(assignments)s
if hasattr(__pyx_result, '__dict__'):
__pyx_result.__dict__.update(__pyx_state[%(num_members)s])
if len(__pyx_state) > %(num_members)d and hasattr(__pyx_result, '__dict__'):
__pyx_result.__dict__.update(__pyx_state[%(num_members)d])
""" % {
'unpickle_func_name': unpickle_func_name,
'checksum': checksum,
......
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