> On 18 Dec 2021, at 20:05, Marco Sulla <marco.sulla.pyt...@gmail.com> wrote: > > Emh, maybe I was not clear. I created a C extension and it segfaults. > So I created that script to see where it segfaults. But the script > does not segfault. My doubt is: is that because I'm using eval and > exec in the script?
You may struggle to duplicate the pattern of memory allocations and accesses that lead to the segv. Assuming you are on a unix, turn on coredumps and run the code until it segfaults. Then use gdb on the core file. Barry > >> On Sat, 18 Dec 2021 at 18:33, Dieter Maurer <die...@handshake.de> wrote: >> >> Marco Sulla wrote at 2021-12-18 14:10 +0100: >>> Ok, I created the script: >>> >>> https://github.com/Marco-Sulla/python-frozendict/blob/master/test/debug.py >>> >>> The problem is it does _not_ crash, while a get a segfault using >>> pytest with python 3.9 on MacOS 10.15 >>> >>> Maybe it's because I'm using eval / exec in the script? >> >> Segfaults can result from C stack overflow which in turn can >> be caused in special cases by too deeply nested function calls >> (usually, Python's "maximal recursion depth exceeded" prevents >> this before a C stack overflow). >> >> Otherwise, whatever you do in Python (this includes "eval/exec") >> should not cause a segfault. The cause for it likely comes from >> a memory management bug in some C implemented part of your >> application. >> >> Note that memory management bugs may not show deterministic >> behavior. Minor changes (such as "with/without -v") >> can significantly change the outcome. > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list