Skip to content

Subclassing a #[pyclass] in Python causes segfault during interpreter finalization #220

@joar

Description

@joar

🐛 Bug Reports

When reporting a bug, please provide the following information. If this is not a bug report you can just discard this template.

🌍 Environment

  • Your operating system and version: Ubuntu 18.04
  • Your python version: Python 3.7
  • How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?:
    • Python installed through the "deadsnakes" PPA
    • I use python's venv
  • Your rust version (rustc --version):
    rustc 1.30.0-nightly (2d4e34ca8 2018-09-09)

💥 Reproducing

Check out the branch at https://github.com/joar/pyo3/tree/bug/subclass-causes-sigsegv/examples/word-count

$ cd examples/word-count

$ python setup.py develop

$ cat ../../target/debug/build/pyo3-4833970e0e0d17d0/output
cargo:rustc-cfg=Py_3_5
cargo:rustc-cfg=Py_3_6
cargo:rustc-cfg=Py_3_7
cargo:rustc-cfg=Py_3
cargo:rustc-cfg=py_sys_config="WITH_THREAD"
cargo:python_flags=FLAG_WITH_THREAD=1,CFG_Py_3_5,CFG_Py_3_6,CFG_Py_3_7
cargo:rerun-if-env-changed=LD_LIBRARY_PATH
cargo:rerun-if-env-changed=PATH
cargo:rerun-if-env-changed=PYTHON_SYS_EXECUTABLE
cargo:rerun-if-env-changed=LIB

$ python minimal-test.py
===> creating WordCounter
===> created WordCounter
===> deleting wc
===> deleted wc
fish: “python minimal-test.py” terminated by signal SIGSEGV (Address boundary error)

I believe the issue occurs during python's final GC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions