Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using those freed variables in a class methods crashes pyjion #496

Open
xiaxinmeng opened this issue Dec 22, 2022 · 0 comments
Open

Using those freed variables in a class methods crashes pyjion #496

xiaxinmeng opened this issue Dec 22, 2022 · 0 comments

Comments

@xiaxinmeng
Copy link

Using an undefined variable in a method of a class may cause a segmentation fault. See the following example 'test.py', we define a class 'A' . In this class we define a method 'clone'. After for loop, we return the undefined variable i, then pyjion crashes.

test.py

class A:
    js = []
    def clone(self):
        for i in self.js:
            pass
        return i
a = A()
a.clone()

Behaviors on Pyjion:
python3.10 -m pyjion test.py

Segmentation fault (core dumped)

Behaviors on CPython 3.10.8
python3.10 test.py

Traceback (most recent call last):
File "/home/xxm/Desktop/test.py", line 8, in
a.clone()
File "/home/xxm/Desktop/test.py", line 6, in clone
return I
UnboundLocalError: local variable 'i' referenced before assignment

Environment:
CPython3.10.8 on Ubuntu 18.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant