Skip to content

pytest: ValueError: invalid location in marshalled object #6597

Closed

Description

@anki-code
rustpython -V
# Python 3.13.0alpha (heads/master:9fcc471c9
rustpython -m pip install pytest
cd /tmp
git clone https://github.com/xonsh/xonsh
cd xonsh
pytest
Traceback (most recent call last):
  File "/Users/pc/.local/bin/rust-pytest", line 3, in <module>
    from pytest import console_main
  File "_frozen_importlib", line 1461, in __import__
  File "_frozen_importlib", line 1382, in _gcd_import
  File "_frozen_importlib", line 1352, in _find_and_load
  File "_frozen_importlib", line 1355, in _find_and_load
  File "_frozen_importlib", line 1329, in _find_and_load_unlocked
  File "_frozen_importlib", line 1326, in _find_and_load_unlocked
  File "_frozen_importlib", line 1326, in _find_and_load_unlocked
  File "_frozen_importlib", line 945, in _load_unlocked
  File "_frozen_importlib", line 943, in _load_unlocked
  File "_frozen_importlib", line 936, in _load_unlocked
  File "_frozen_importlib", line 930, in _load_unlocked
  File "_frozen_importlib_external", line 990, in exec_module
  File "_frozen_importlib_external", line 1125, in get_code
  File "_frozen_importlib_external", line 752, in _compile_bytecode
ValueError: invalid location in marshalled object

Activity

  1. terryluan12 commented on Dec 30, 2025

    @terryluan12
    Contributor

    I'm getting a similar error

    Commenting out write_signed_varint(&mut linetable, line_delta); in the generate_linetable function in crates/codegen/src/ir.rs seems to prevent the error.

  2. youknowone commented on Dec 31, 2025

    @youknowone
    Member

    this is probably i broke marshal compatibiltiy recently.

    I will break bytecode compatibility a few more times in this week.

    running this command will be helpful:

    rm -r target/debug/build/rustpython-* && find . | grep -E "\.pyc$" | xargs rm -r
    
  3. anki-code commented on Dec 31, 2025

    @anki-code
    Author

    Same error after

    cd ~/.cargo/git/checkouts/
    grep -E "\.pyc$" | xargs rm -r
    rm -r rustpython-*
    cargo install --features=ssl --git https://github.com/RustPython/RustPython rustpython
  4. youknowone commented on Jan 4, 2026

    @youknowone
    Member

    Sorry for inconvenience. I changed magic number in #6638 This must be solved.

  5. youknowone commented on Oct 6, 2026

    @youknowone
    Member

    The originally reported path from pytest import console_main succeeds on current main with pytest 9.1.1. Closing.

    — commented by Grok 4.6

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions