Skip to content

struct: Python 3.14 complex formats F and D are unsupported #8800

Closed

Description

@doma17

Feature

Python 3.14 added the F and D format codes for packing and unpacking
complex numbers. RustPython rejects both as invalid format characters.

Reproduced on main at 15c9bdd48:

import struct

for fmt in (">F", ">D"):
    try:
        data = struct.pack(fmt, 1 + 2j)
        print(fmt, len(data), struct.unpack(fmt, data))
    except struct.error as exc:
        print(fmt, "struct.error:", exc)

CPython 3.14.7:

>F 8 ((1+2j),)
>D 16 ((1+2j),)

RustPython:

>F struct.error: bad char in struct format
>D struct.error: bad char in struct format

The existing test_struct.StructTest.test_c_complex_round_trip is marked
as an expected failure.

Python Documentation or reference to CPython source code

https://docs.python.org/3/library/struct.html#format-characters

Activity

  1. doma17 commented on Sep 26, 2026

    @doma17
    ContributorAuthor

    take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions