Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
maple3142
· 2y ago · 0 comments
The example given by parent does not need eval to trigger though. Just create a function and replace its code object then call it, it will easily segfault.
Comments
[–]
jwilk
2y ago
Complete example without eval:
def f(): pass f.__code__ = f.__code__.replace(co_consts=()) f()
[–]
Retr0id
2y ago
yup, eval was just there for golfing purposes