Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.14 regression] Cannot copy Union containing objects that do not implement__or__ #132882

Closed
Assignees
JelleZijlstra
Labels
3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error
@JelleZijlstra

Description

@JelleZijlstra

Bug report

Bug description:

In 3.13 it was possible to copy a Union containing any object:

>>> copy.copy(typing.Union[b"x", b"y"])typing.Union[b'x', b'y']

But in main this fails:

>>> copy.copy(typing.Union[b"x", b"y"])Traceback (most recent call last):  File "<python-input-2>", line 1, in <module>    copy.copy(typing.Union[b"x", b"y"])    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/Users/jelle/py/cpython/Lib/copy.py", line 100, in copy    return _reconstruct(x, None, *rv)  File "/Users/jelle/py/cpython/Lib/copy.py", line 234, in _reconstruct    y = func(*args)TypeError: unsupported operand type(s) for |: 'bytes' and 'bytes'>>>

This doesn't affect any types supported by the type system (all of which support|), but may affect users who put non-standard objects inside a Union.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

Labels

3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp