You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7c150ae
Browse filesBrowse the repository at this point in the historyBrowse files
fix(pymacros): resolve undefined PyStructSequence_UnnamedField symbol on Python 3.9/3.10
`PyStructSequence_UnnamedField` is `extern const char * const` with hidden
visibility on Python 3.9 and 3.10, so it is not an exported dynamic symbol for
extension modules; it only became `PyAPI_DATA` (exported) in 3.11.0a2.
Referencing it directly compiled but left an unresolved dynamic symbol, so
`import optree._C` failed on 3.9/3.10 with `undefined symbol:
PyStructSequence_UnnamedField`. It built and imported cleanly on 3.11+, so the
failure was invisible in local 3.13/3.14 builds.
Add a `PyStructSequenceUnnamedField()` helper in pymacros.h returning the symbol
on 3.11.0a2+ and its stable value "unnamed field" below. Every use is by value
(the serialization.cpp check compares a `std::string`), so the literal fallback
is equivalent. Updated pytypes.h, optree.cpp, and serialization.cpp; the explicit
`<structseq.h>` include is dropped since Python.h provides it.
Also render unnamed struct-seq slots as an index-tagged `<unnamed@N>` placeholder
(e.g. `<unnamed@7>`) instead of wrapping the bare marker, matching the format
proposed in python/cpython#154387; the repr test is updated.
Add "picklable" (in PyTreeSpec.__reduce__'s docstring) to the spelling wordlist.
0 commit comments