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

Pickling is losing some fields on exceptions #103333

Closed
Labels
3.12only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errortype-featureA feature request or enhancement
@csm10495

Description

@csm10495

Bug report

Say we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields should still be in-tact on the unpickled instance.

C:\Users\csm10495\Desktop>pythonPython 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import pickle>>> a = AttributeError("test text", name="test name", obj="test obj")>>> a.name'test name'>>> pickle.loads(pickle.dumps(a)).name>>> pickle.loads(pickle.dumps(a))AttributeError('test text')

Your environment

C:\Users\csm10495\Desktop>python --versionPython 3.11.0C:\Users\csm10495\Desktop>verMicrosoft Windows [Version 10.0.19045.2364]C:\Users\csm10495\Desktop>

Same thing seems to happen on 3.10.7 and 3.11.3 as well.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errortype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp