Skip to content

Raising a user-defined class from itself causes interpreter crashing #2779

Closed

Description

@xiaxinmeng

In the following example, we define a class error, and instance it. When we execute raise e from e, Rust Python crashes.

test.py

class Error(Exception):
	pass

e = Error()
raise e from e

Actual output:

Segmentation fault (core dumped)

System:

Ubuntu 16.04
Rust Python 0.1.2 interpreter

Activity

  1. DimitrisJim commented on Aug 5, 2021

    @DimitrisJim
    Member

    Another good find. Loops on write_exception in exceptions.rs. Thanks! Closing in favor of #2796

  2. sobolevn commented on Aug 9, 2021

    @sobolevn
    Contributor

    @DimitrisJim I don't think that this should raise RecursionError as described in #2796

    CPython:

    >>> class Error(Exception):
    ...     pass
    ... 
    >>> e = Error()
    >>> raise e from e
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    __main__.Error

    I guess, this is a different case, where we need to fix write_exception implementation.

  3. DimitrisJim commented on Aug 9, 2021

    @DimitrisJim
    Member

    @sobolevn ah, you're right here. I rushed in triaging this.

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