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
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
Behaviors on Pyjion: python3.10 -m pyjion test.py
Behaviors on CPython 3.10.8 python3.10 test.py
Environment: CPython3.10.8 on Ubuntu 18.04