-
Notifications
You must be signed in to change notification settings - Fork 901
Description
Bug Description
Python 3.14 adds marshal version 5 with support for slices. PyO3 continues to use version 4 with the consequence that simple code with slices like a[:] can no longer be marshalled in Python 3.14.
For example, this
let compiled = PyCode::compile(
py,
CString::new("a[:]").unwrap().as_c_str(),
CString::new("foo.py").unwrap().as_c_str(),
PyCodeInput::File,
)?;
pyo3::marshal::dumps(&compiled, pyo3::marshal::VERSION)?;
will fail with
E ValueError: unmarshallable object
It works in Python 3.13 and earlier; it also works with VERSION = 5.
Steps to Reproduce
See above.
Backtrace
Your operating system and version
Linux 6.12.53-1-lts
Your Python version (python --version)
3.14
Your Rust version (rustc --version)
rustc 1.90.0 (1159e78c4 2025-09-14) (Arch Linux rust 1:1.90.0-4)
Your PyO3 version
0.27.9
How did you install python? Did you use a virtualenv?
uv venv --python 3.14
Additional Info
No response
Metadata
Metadata
Assignees
Labels
No labels