-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Milestone
Description
With Python, executing the following code:
o = {'a': 1, 'b': 2}
o2 = {**o}
o2['a'] = 3
print(o['a'], o2['a'])
results in (1, 3) being printed.
When compiled with Cython (3,3) is printed.
If the code is changed to:
o = {'a': 1, 'b': 2}
o2 = {**o, 'c': 4} # changed
o2['a'] = 3
print(o['a'], o2['a'])
Then the Cython compiled version behaves the same as the Python-interpreted version. Cython seems to be taking a shortcut and not creating a copy of the object.