Closed
Description
Crash report
In the following test program, _imp.create_builtin takes a object A as input. The object instance the name attribute as "self" at "self.name = self". This action triggers a segfault on CPython 3.10.7 and CPython 3.10.7. Similarly, if self.name = other keywords, e.g.,int, print, the program also crashes. It may need a checker for _imp.create_builtin to avoid keywords.
import _imp
class FakeSpec:
def __init__(self, name):
self.name = self
A = FakeSpec("time")
imp_time = _imp.create_builtin(A)
Error messages
Expected behavior on CPython 3.9.0
Traceback (most recent call last):
File "/home/xxm/Desktop/imp.py", line 9, in <module>
imp_time = _imp.create_builtin(A)
TypeError: bad argument type for built-in operation
Unexpected Behavior on CPython 3.10.8
Segmentation fault(core dumped)
Your environment
-
CPython versions tested on:Python 3.10.8, Python 3.10.7
-
Operating system and architecture: [GCC 7.5.0] on linux