[issue11627] segfault raising an arbitrary object as an exception

2011-07-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 45b1ae1ef318 by Benjamin Peterson in branch '2.7': port 8d05f697acd4 (#11627) http://hg.python.org/cpython/rev/45b1ae1ef318 -- ___ Python tracker

[issue11627] segfault raising an arbitrary object as an exception

2011-07-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8d05f697acd4 by Benjamin Peterson in branch '3.2': catch nasty exception classes with __new__ that doesn't return a exception (closes #11627) http://hg.python.org/cpython/rev/8d05f697acd4 New changeset bc1fbd6f667a by Benjamin Peterson in branch '

[issue11627] segfault raising an arbitrary object as an exception

2011-03-23 Thread Georg Brandl
Changes by Georg Brandl : -- nosy: +georg.brandl ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue11627] segfault raising an arbitrary object as an exception

2011-03-22 Thread Andreas Stührk
Andreas Stührk added the comment: Another thing that can happen is that `__new__()` does return an instance of BaseException, but that the return value is not an instance of the expected class. Example: class MyException(OSError): def __new__(*args): return Exception() try:

[issue11627] segfault raising an arbitrary object as an exception

2011-03-22 Thread Andreas Stührk
Changes by Andreas Stührk : Added file: http://bugs.python.org/file21347/issue11627_py27.patch ___ Python tracker ___ ___ Python-bugs-list mai

[issue11627] segfault raising an arbitrary object as an exception

2011-03-22 Thread Andreas Stührk
Andreas Stührk added the comment: Thanks Nick, that is indeed much nicer. I updated the patch. I also created a patch for 2.7, in case anyone thinks it's a good idea to fix it there, too. -- Added file: http://bugs.python.org/file21346/issue11627_3.patch _

[issue11627] segfault raising an arbitrary object as an exception

2011-03-22 Thread Nick Coghlan
Nick Coghlan added the comment: Note that this test code: def raise_(): raise MyException self.assertRaises(TypeError, raise_) can be simplified to: with self.assertRaises(TypeError): raise MyException in all currently maintained branches. ---

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk
Changes by Andreas Stührk : Added file: http://bugs.python.org/file21329/issue11627_2.patch ___ Python tracker ___ ___ Python-bugs-list mailin

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk
Andreas Stührk added the comment: > Antoine Pitrou added the comment: > You could try something more explicit, such as > "calling %s() should have returned an instance of BaseException, not %s" > % (type, Py_TYPE(value)) Thanks, updated the patch. > By the way, you have a tab character in you

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le lundi 21 mars 2011 à 22:57 +, Andreas Stührk a écrit : > Andreas Stührk added the comment: > > Attached is a patch. I'm not too happy about the error message though, > I think it's more confusing than helpful. You could try something more explicit, suc

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk
Andreas Stührk added the comment: Attached is a patch. I'm not too happy about the error message though, I think it's more confusing than helpful. -- keywords: +patch Added file: http://bugs.python.org/file21328/issue11627.patch ___ Python tracker

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk
Andreas Stührk added the comment: On Mon, Mar 21, 2011 at 10:27 PM, Santoso Wijaya wrote: > > Santoso Wijaya added the comment: > > Also, why is the print() in __new__ executed twice? Because `PyErr_NormalizeException()` is called twice: First time when the exceptions is raised, and then a se

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Santoso Wijaya
Santoso Wijaya added the comment: Also, why is the print() in __new__ executed twice? -- ___ Python tracker ___ ___ Python-bugs-list

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Santoso Wijaya
Santoso Wijaya 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__(*ar

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Michael Foord
Michael Foord added the comment: This: raise type('',(Exception,),{'__new__':lambda *a:object()}) Segfaults 3.2 but not 3.1. -- ___ Python tracker ___ ___

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Have you tried 3.1? -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk
Changes by Andreas Stührk : -- nosy: +Trundle ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Michael Foord
Michael Foord added the comment: Personally I don't think this should be valid at all (it should ideally be an error at the raise point). It is the kind of thing that causes difficulties for the other implementations trying to match CPython behaviour (this code works in Python 2.7 - you can c

[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Michael Foord
New submission from Michael Foord : Python 3.2 (r32:88452, Feb 20 2011, 10:19:59) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> class Foo(Exception): ... def __new__(*args): ... return object() ... >>> try: ... raise