PyO3 / PyO3/pyo3

Python 3.14 with marshal::dumps on slices: unmarshallable object

Open
#5,568 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reproducing the shown PyCode::compile and pyo3::marshal::dumps example with Python 3.14, then inspect how marshal VERSION is selected; done means slices marshal successfully on Python 3.14 while the supported older versions remain working.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.