pyo3: ffi::cpython::unicodeobject::tests::{ascii,ucs4} unit tests segfault on s390x

Building pyo3 0.14.3 on s390x on Fedora Rawhide, the following two unit tests crash:

  • ffi::cpython::unicodeobject::tests::ascii
  • ffi::cpython::unicodeobject::tests::ucs4

Because they crash the test runner process, there’s no output from those tests, except that they fail.

There are similar issues in the cpython crate: https://github.com/dgrunwald/rust-cpython/issues/265

Looks like PyUnicode_KIND is a bitfield that is different depending on system endianness (s390x is the only big-endian architecture I have access to).

🌍 Environment

  • Your operating system and version: Fedora Rawhide / 36
  • Your python version: 3.10.0-rc1
  • How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?: default system /usr/bin/python3
  • Your Rust version (rustc --version): 1.54.0 stable on s390x-unknown-linux-gnu
  • Your PyO3 version: 0.14.3
  • Have you tried using latest PyO3 main (replace version = "0.x.y" with git = "https://github.com/PyO3/pyo3")?: no

💥 Reproducing

Running cargo test --release on a s390x machine causes this issue.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I filed https://bugs.python.org/issue45025 so the problems with bit fields in CPython’s API are tracked with CPython.

FWIW, you could also write your own C-FFI shims, compiled in build.rs via cc, so you don’t have to wait for CPython.

Everything went well, update is submitted: https://bodhi.fedoraproject.org/updates/FEDORA-2021-290f13120c

Thanks for your help!

Looks like in pyo3 0.14.4 there’s some missing pieces

🤦 yikes, I’ll fix and release 0.14.5 soon - #1850

I’m strongly against yanking

Me too; my opinion is similarly it’s just for security / major soundness holes. As it’s a new niche API which had issues, and they probably would lead to loud crashes in most cases, it’s likely ok not to yank here.