Skip to content

add support for abi3t#556

Draft
Icxolu wants to merge 2 commits into
PyO3:mainfrom
Icxolu:abi3t
Draft

add support for abi3t#556
Icxolu wants to merge 2 commits into
PyO3:mainfrom
Icxolu:abi3t

Conversation

@Icxolu

@Icxolu Icxolu commented Jun 15, 2026

Copy link
Copy Markdown
Member

This adds abi3t support by

  • switching to opaque structs
  • exposing data access helpers from slots 369-378
  • redirect all field accesses through the access helpers

Todo:

  • changelog entry
  • CI testing for 3.15/3.15t

See numpy/numpy#31091
Closes #555

@ngoldbaum

Copy link
Copy Markdown
Contributor

Ping @kumaraditya303 - we were just talking about this today.

@neutrinoceros

neutrinoceros commented Jun 17, 2026

Copy link
Copy Markdown

I confirmed that this resolved the runtime error I reported in #555
example logs (remaining failures are unrelated, they're just due to numpy not having cp315 nightlies for windows yet)

Comment thread src/npyffi/array.rs Outdated
Comment thread src/npyffi/array.rs Outdated
Comment thread src/npyffi/array.rs Outdated
Comment thread src/npyffi/objects.rs
@kumaraditya303

Copy link
Copy Markdown

I think we should also add a check that when abi3t is used, the minimum numpy version should be 2.5.

@Icxolu Icxolu force-pushed the abi3t branch 2 times, most recently from c2b4c58 to 6c722b0 Compare June 18, 2026 18:16
@Icxolu

Icxolu commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

Looks like 32bit windows still has some issues... not sure why though
There was also https://github.com/PyO3/rust-numpy/actions/runs/27866655836/job/82471861978 earlier

@neutrinoceros

Copy link
Copy Markdown

My guess is that'd be because there are no wheels for cp315*-*win32
xref numpy/numpy-release#53

@Icxolu

Icxolu commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

To me it looks like there are cp315-win32 wheels here and they installed fine. The version specific run had no issues as well. It's just the abi3t run that failed, so I think this is a genuine failure, but I'm not sure which fault it could be: ours, pyo3, numpy or python

@kumaraditya303

Copy link
Copy Markdown

I think it could alignment issue on 32 bit MSVC, I am not very familiar with rust but it seems flags is defined as npy_uint64 which rust gives 8 bytes alignment whereas in C I think it is 4 bytes which could be an issue.

@kumaraditya303

Copy link
Copy Markdown

@Icxolu Can you try forcing a 4 byte alignment layout using #[cfg_attr(all(Py_LIMITED_API, Py_GIL_DISABLED), repr(C, packed(4)))]?

@ngoldbaum

Copy link
Copy Markdown
Contributor

If you all don't sort this out in the meantime I'll try to look on Monday. While win32 isn't so important per se, I do find it useful to detect and sort out CPU architecture-sensitive issues. It's possible this issue is in any one of CPython, NumPy, or rust-numpy.

Glad to see everything mostly works otherwise!

@Icxolu

Icxolu commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

I did a bit of digging with compiler explorer: https://godbolt.org/z/qYe3Ghz7a
Both rustc and msvc agree on both architectures on the structure size and that flags is at offset 16 (and thus 8 byte aligned as it should), so I think there is no issue with our definitions here. I did however also find this: rust-lang/rust#112480, which does not really paint a great picture about win32... perhaps we ran into that...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: function built with -F pyo3/abi3t raises TypeError at runtime (CPython 3.15.0b2-free-threaded))

4 participants