Santoso Wijaya <santoso.wij...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue11627> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com