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.

classification
Title: copy module doc wrongly says it doesn't copy arrays
Type: Stage: resolved
Components: Documentation Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: AlexWaygood, Stefan Pochmann, asvetlov, docs@python, lukasz.langa, m2_farzan, miss-islington, terry.reedy
Priority: normal Keywords: easy, newcomer friendly, patch

Created on 2021-11-08 16:53 by Stefan Pochmann, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29548 merged m2_farzan, 2021-11-13 19:31
PR 29554 merged miss-islington, 2021-11-14 09:34
PR 29555 merged AlexWaygood, 2021-11-14 11:16
PR 29556 merged m2_farzan, 2021-11-14 11:33
PR 29557 merged miss-islington, 2021-11-14 12:56
PR 29558 merged miss-islington, 2021-11-14 12:56
Messages (9)
msg405962 - (view) Author: Stefan Pochmann (Stefan Pochmann) * Date: 2021-11-08 16:53
The doc https://docs.python.org/3/library/copy.html says:

"This module does not copy types like module, method, stack trace, stack frame, file, socket, window, array, or any similar types."

But it does copy arrays just fine:

import copy, array
a = array.array('i', [1, 2])
b = copy.copy(a)
a[0] = 3
print(a)
print(b)

Output:

array('i', [3, 2])
array('i', [1, 2])
msg406240 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-11-12 21:42
Should we just remove ' array,' from things that cannot be copied, or does this need more discussion?
msg406307 - (view) Author: Stefan Pochmann (Stefan Pochmann) * Date: 2021-11-14 04:01
Just saw that it's in copy.py's docstring as well:

"This version does not copy types like module, class, function, method,
nor stack trace, stack frame, nor file, socket, window, nor array, nor
any similar types."

https://github.com/python/cpython/blob/3.10/Lib/copy.py#L41-L43
msg406313 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2021-11-14 09:34
New changeset b7360ae395e9e633d384d16064c5dc04a9841e19 by M. Mostafa Farzan in branch 'main':
bpo-45752: Fix no-support examples in 'copy' docs (GH-29548)
https://github.com/python/cpython/commit/b7360ae395e9e633d384d16064c5dc04a9841e19
msg406314 - (view) Author: miss-islington (miss-islington) Date: 2021-11-14 09:58
New changeset 6073920fcdb5a36d20a6a7c6ee204f74f00e1cb4 by Miss Islington (bot) in branch '3.9':
bpo-45752: Fix no-support examples in 'copy' docs (GH-29548)
https://github.com/python/cpython/commit/6073920fcdb5a36d20a6a7c6ee204f74f00e1cb4
msg406317 - (view) Author: miss-islington (miss-islington) Date: 2021-11-14 12:54
New changeset 2081f9fe75a3a990394fbccd0c1c91c229c6289e by M. Mostafa Farzan in branch '3.10':
[3.10] bpo-45752: Fix no-support examples in 'copy' docs (GH-29548) (GH-29556)
https://github.com/python/cpython/commit/2081f9fe75a3a990394fbccd0c1c91c229c6289e
msg406318 - (view) Author: miss-islington (miss-islington) Date: 2021-11-14 12:56
New changeset c2c4fdf5ea6e9cba4ef469d08a52abb9cfa756a5 by Alex Waygood in branch 'main':
bpo-45752: Remove "array" from list of things that cannot be copied in `copy` module docstring (GH-29555)
https://github.com/python/cpython/commit/c2c4fdf5ea6e9cba4ef469d08a52abb9cfa756a5
msg406319 - (view) Author: miss-islington (miss-islington) Date: 2021-11-14 13:18
New changeset 55d24edaadba4ee90f464d88b44075649788f128 by Miss Islington (bot) in branch '3.10':
bpo-45752: Remove "array" from list of things that cannot be copied in `copy` module docstring (GH-29555)
https://github.com/python/cpython/commit/55d24edaadba4ee90f464d88b44075649788f128
msg406320 - (view) Author: miss-islington (miss-islington) Date: 2021-11-14 13:21
New changeset 9f9a3028e3bb923e726789ab3ea5ce298b596bc6 by Miss Islington (bot) in branch '3.9':
bpo-45752: Remove "array" from list of things that cannot be copied in `copy` module docstring (GH-29555)
https://github.com/python/cpython/commit/9f9a3028e3bb923e726789ab3ea5ce298b596bc6
History
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89913
2021-11-14 20:42:43asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-11-14 13:21:36miss-islingtonsetmessages: + msg406320
2021-11-14 13:18:35miss-islingtonsetmessages: + msg406319
2021-11-14 12:56:14miss-islingtonsetpull_requests: + pull_request27806
2021-11-14 12:56:09miss-islingtonsetpull_requests: + pull_request27805
2021-11-14 12:56:04miss-islingtonsetmessages: + msg406318
2021-11-14 12:54:45miss-islingtonsetmessages: + msg406317
2021-11-14 11:33:36m2_farzansetpull_requests: + pull_request27804
2021-11-14 11:16:44AlexWaygoodsetnosy: + AlexWaygood
pull_requests: + pull_request27803
2021-11-14 09:58:05miss-islingtonsetmessages: + msg406314
2021-11-14 09:34:48miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request27802
2021-11-14 09:34:41asvetlovsetnosy: + asvetlov
messages: + msg406313
2021-11-14 04:02:00Stefan Pochmannsetmessages: + msg406307
2021-11-13 19:31:51m2_farzansetkeywords: + patch
nosy: + m2_farzan

pull_requests: + pull_request27797
stage: patch review
2021-11-12 21:42:27terry.reedysetversions: - Python 3.6, Python 3.7, Python 3.8
nosy: + terry.reedy, lukasz.langa

messages: + msg406240

keywords: + easy, newcomer friendly
2021-11-08 16:53:12Stefan Pochmanncreate