This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年02月14日 21:22 by rharris, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| copy.patch | rharris, 2008年02月14日 21:22 | Possible patch to fix this | ||
| issue2116.patch | pitrou, 2009年03月15日 00:34 | |||
| issue2116-2.patch | pitrou, 2009年03月15日 00:45 | |||
| Messages (9) | |||
|---|---|---|---|
| msg62413 - (view) | Author: Rick Harris (rharris) | Date: 2008年02月14日 21:22 | |
The copy module will not properly copy/deepcopy weakrefs, it will bomb out with __new__ not having enough args. This is a problem b/c it makes deepcopying of objects that make use of Weak(Key|Value)Dictionaries difficult. To replicate: import copy, weakref class Test(object): pass t = Test() wr = weakref.ref(t) wr_new = copy.copy(wr) |
|||
| msg64101 - (view) | Author: Sean Reifschneider (jafo) * (Python committer) | Date: 2008年03月19日 21:12 | |
Rick: In the future, please provide a context or unified diff ("diff
-c") so that we get the file name that the diff is for and some
additional context.
|
|||
| msg64909 - (view) | Author: Rick Harris (rharris) | Date: 2008年04月04日 01:06 | |
Sorry about forgetting the -c arg! The patch is intended for python/trunk/Lib/copy.py. It looks like Raymond Hettinger has made a similar-ish change recently to make Ellipsis copyable. |
|||
| msg83606 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年03月14日 23:49 | |
Should a deepcopy of a weakref return the same weakref, or a weakref to a new copied object? Also, what about the optional callback? |
|||
| msg83607 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年03月14日 23:53 | |
Hmm, forget that question. If we deepcopy the weakref target, it will be destroyed just afterwards, making the deepcopied weakref useless. |
|||
| msg83609 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年03月15日 00:34 | |
Here is a patch providing proper copy and deepcopy support, including for weak dicts (the Proxy type is unsupported, though). |
|||
| msg83612 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年03月15日 00:45 | |
Updated patch so that copied weakdicts are decoupled (adding an item to the copy doesn't mutate the original). |
|||
| msg86917 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年05月01日 21:48 | |
Raymond, Guido, any opinion on this one? |
|||
| msg87822 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年05月15日 17:06 | |
Committed in r72662, r72670. Thanks! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:30 | admin | set | github: 46370 |
| 2009年05月15日 17:06:04 | pitrou | set | status: open -> closed resolution: fixed messages: + msg87822 |
| 2009年05月01日 21:48:34 | pitrou | set | versions:
+ Python 3.1, Python 2.7, - Python 2.5 nosy: + gvanrossum, rhettinger messages: + msg86917 assignee: tim.peters -> stage: patch review |
| 2009年03月15日 00:45:18 | pitrou | set | files:
+ issue2116-2.patch messages: + msg83612 |
| 2009年03月15日 00:34:32 | pitrou | set | files:
+ issue2116.patch messages: + msg83609 |
| 2009年03月14日 23:53:07 | pitrou | set | messages: + msg83607 |
| 2009年03月14日 23:49:09 | pitrou | set | nosy:
+ pitrou messages: + msg83606 |
| 2008年04月04日 01:06:50 | rharris | set | messages: + msg64909 |
| 2008年03月19日 21:12:13 | jafo | set | nosy:
+ jafo, tim.peters messages: + msg64101 priority: normal assignee: tim.peters keywords: + patch type: crash -> behavior |
| 2008年02月14日 21:22:34 | rharris | create | |