[issue11627] segfault raising an arbitrary object as an exception
Santoso Wijaya
report at bugs.python.org
Mon Mar 21 23:26:40 CET 2011
Santoso Wijaya <santoso.wijaya at gmail.com> added the comment:
Oddly, this works:
C:\Users\santa>C:\python32\python.exe
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(Exception):
... def __new__(*args):
... obj = object()
... print('Returning {}'.format(repr(obj)))
... return obj
...
>>> try:
... raise Foo
... except Exception as e:
... print('Got it: {}'.format(repr(e)))
...
Returning <object object at 0x00000000022D26D0>
Returning <object object at 0x000000000254B8E0>
Got it: <object object at 0x000000000254B8E0>
>>> ^Z
But this does not:
C:\Users\santa>C:\python32\python.exe
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(Exception):
... def __new__(*args):
... obj = object()
... print('Returning', repr(obj))
... return obj
...
>>> try:
... raise Foo
... except Exception as e:
... print('Got it:', repr(e))
...
Returning <object object at 0x00000000022F36D0>
Returning <object object at 0x00000000022F38B0>
crash!
----------
nosy: +santa4nt
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11627>
_______________________________________
More information about the Python-bugs-list
mailing list