Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy and deepcopy fail to copy ipaddress scope_id #110196

Closed
becarpenter opened this issue Oct 2, 2023 · 2 comments
Closed

copy and deepcopy fail to copy ipaddress scope_id #110196

becarpenter opened this issue Oct 2, 2023 · 2 comments
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@becarpenter
Copy link

becarpenter commented Oct 2, 2023

Bug report

Bug description:

copy and deepcopy fail to copy ipaddress scope_id

import ipaddress, copy
a = ipaddress.IPv6Address('fe80::abc%def')
a.scope_id  #shows 'def'
c = copy.copy(a)
c.scope_id  #shows null, should show 'def'
d = copy.deepcopy(a)
d.scope_id  #shows null, should show 'def'

CPython versions tested on:

3.9, 3.11

Operating systems tested on:

Linux, Windows

Linked PRs

@becarpenter becarpenter added the type-bug An unexpected behavior, bug, or error label Oct 2, 2023
@gaogaotiantian
Copy link
Member

IPv6Address now inherits __reduce__ from _BaseAddress which will only keep the ip info (so scope_id is discarded). I just added a new __reduce__ method for it to solve this.

@becarpenter
Copy link
Author

Thanks for quick response.

@furkanonder furkanonder added the stdlib Python modules in the Lib dir label Oct 4, 2023
@furkanonder furkanonder moved this to In Progress in Pickle and copy issues 🥒 Oct 4, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 22, 2023
(cherry picked from commit 767f416)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 22, 2023
(cherry picked from commit 767f416)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
serhiy-storchaka pushed a commit that referenced this issue Oct 22, 2023
…H-111190)

(cherry picked from commit 767f416)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
serhiy-storchaka pushed a commit that referenced this issue Oct 22, 2023
…H-111191)

(cherry picked from commit 767f416)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
@furkanonder furkanonder moved this from In Progress to Done in Pickle and copy issues 🥒 Oct 26, 2023
@furkanonder furkanonder added 3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes labels Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

3 participants