Message416183
The same problem exists at the function level: see bpo-39805: "Copying functions doesn't actually copy them".
For example, copy.deepcopy(func) returns func unchanged if it's a function.
Example:
---
import copy
def make_closure():
closure = []
def append(value):
closure.append(value)
return append, closure
func, closure = make_closure()
func(1)
func2 = copy.deepcopy(func)
func2(2)
print(func2 is func)
print(closure)
---
Output:
---
True
[1, 2]
--- |
|
Date |
User |
Action |
Args |
2022-03-28 16:23:29 | vstinner | set | recipients:
+ vstinner, rhettinger, eric.smith, petr.viktorin, serhiy.storchaka, corona10 |
2022-03-28 16:23:29 | vstinner | set | messageid: <1648484609.42.0.455889590352.issue47143@roundup.psfhosted.org> |
2022-03-28 16:23:29 | vstinner | link | issue47143 messages |
2022-03-28 16:23:29 | vstinner | create | |
|