how to debug when "Segmentation fault"

Maksim Kasimov maksim.kasimov at gmail.com
Wed Oct 5 09:31:26 EDT 2005


jepler at unpythonic.net wrote:
> I've rewritten your middle example to be clearer.
> $ python2.4
> Python 2.4.1 (#1, May 16 2005, 15:15:14) 
> [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>>type("Y", (type,), {"mro": lambda x: [float]})("X", (), {})

on my machines:
 >>> type("Y", (type,), {"mro": lambda x: [float]})("X", (), {})
<class '__main__.X'>


> 
> 
> and here's another one for you to enjoy:
> 
>>>>import marshal
>>>>f = lambda: None
>>>>code = marshal.loads(marshal.dumps(f.func_code).replace('d\0\0S','d\xff\xffS'))
>>>>f.func_code = code
>>>>f()

just no any output

 >>> dir(code)
['__class__', '__cmp__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__repr__', '__setattr__', '__str__', 'co_argcount', 'co_cellvars', 'co_code', 'co_consts', 'co_filename', 'co_firstlineno', 'co_flags', 'co_freevars', 'co_lnotab', 'co_name', 'co_names', 'co_nlocals', 'co_stacksize', 'co_varnames']


Python 2.2.3 (#1, Oct 22 2004, 03:10:44)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4


-- 
Best regards,
Maksim Kasimov
mailto: maksim.kasimov at gmail.com



More information about the Python-list mailing list