Skip to content

Segfault on GC cleanup of subclass #407

@omerbenamram

Description

@omerbenamram

I'm not eniertly sure that it's specific to only subclasses, I've noticed this bug while working on the tests in rustapi_module.

🌍 Environment

  • Your operating system and version: osx 10.14
  • Your python version: all cpython versions
  • Your rust version (rustc --version): rustc 1.35.0-nightly (88f755f8a 2019-03-07)
  • Are you using the latest pyo3 version? master

💥 Reproducing

current code in https://github.com/PyO3/pyo3/blob/master/examples/rustapi_module/tests/test_subclassing.py

from rustapi_module.subclassing import Subclassable


class SomeSubClass(Subclassable):
    pass


a = SomeSubClass()
_b = str(a) + repr(a)

changing it to:

from rustapi_module.subclassing import Subclassable


class SomeSubClass(Subclassable):
    pass

def test_f():
    a = SomeSubClass()
    _b = str(a) + repr(a)

causes it to crash, looking at the core dump, it seems to be during garbage collection.

image

changing it to:

from rustapi_module.subclassing import Subclassable


class SomeSubClass(Subclassable):
    pass


a = SomeSubClass()
a = SomeSubClass()
a = SomeSubClass()
a = SomeSubClass()
a = SomeSubClass()
_b = str(a) + repr(a)

makes this crash with GC is already tracked message.

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