GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Struct.__init__() can leave the Struct object in inconsistent state · Issue #145743 · python/cpython

Struct.__init__() can leave the Struct object in inconsistent state #145743

New issue
Copy link
New issue
Copy link
Closed
Closed
Struct.__init__() can leave the Struct object in inconsistent state#145743
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@serhiy-storchaka
serhiy-storchaka
opened on Mar 10, 2026
Issue body actions

Since Struct.__init__() first saves the format in s_format, then sets s_code used to pack/unpack, after calling it with invalid format argument it leaves the Struct object in inconsistent state -- format returns the new (invalid) format, while packing/unpacking use old format (if it was set). This happens only when call it explicitly, which will be deprecated (see #143715). If simply call Struct() with invalid argument, you will not get a broken object, you will get an error.

Linked PRs

  • gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format #145744
  • [3.14] gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744) #145763
  • [3.13] gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744) #145764

Activity

  1. serhiy-storchaka
    added a commit that references this issue on Mar 10, 2026

    pythongh-145743: Fix inconsistancy after calling Struct.__init__() wi…

    7336aaa
  2. StanFromIreland
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Mar 10, 2026
  3. serhiy-storchaka
    added a commit that references this issue on Mar 10, 2026

    gh-145743: Fix inconsistency after calling Struct.__init__() with inv…

    3f33bf8
  4. miss-islington
    added 2 commits that reference this issue on Mar 10, 2026

    pythongh-145743: Fix inconsistency after calling Struct.__init__() wi…

    6ab0473

    pythongh-145743: Fix inconsistency after calling Struct.__init__() wi…

    c9ade5e
  5. serhiy-storchaka
    closed this as completedon Mar 10, 2026
  6. serhiy-storchaka
    added 2 commits that reference this issue on Mar 10, 2026

    [3.13] gh-145743: Fix inconsistency after calling Struct.__init__() w…

    b5082d8

    [3.14] gh-145743: Fix inconsistency after calling Struct.__init__() w…

    7e38926
  7. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-145743: Fix inconsistency after calling Struct.__init__() wi…

    1c1c04c
  8. serhiy-storchaka
    added this to Struct, memoryview and array issues 🏗️on Jul 13, 2026
  9. github-project-automation
    moved this to Todo in Struct, memoryview and array issues 🏗️on Jul 13, 2026
  10. github-project-automation
    moved this from Todo to Done in Struct, memoryview and array issues 🏗️on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Struct, memoryview and array issues 🏗️
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.