This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: warn crashes if warning's __str__ returns Unicode
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, bromine, r.david.murray
Priority: normal Keywords:

Created on 2010-03-20 17:07 by bromine, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg101379 - (view) Author: Ben Artin (bromine) Date: 2010-03-20 17:07
Running the following script crashes my 2.6.1 interpreter on two different platforms:

from warnings import warn

class TestWarning(Warning):
	def __str__(self):
		return u'\u00ae'

warn(TestWarning())

Platforms I tried this on:

Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin

Python 2.6.1 (r261:67515, Dec 17 2008, 20:25:07) 
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6

Crash backtrace on Mac OS X:

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   org.python.python             	0x0000000100059e4c PyTuple_Pack + 154
1   org.python.python             	0x00000001000794c1 PyErr_Warn + 468
2   org.python.python             	0x000000010007922b _PyUnicodeUCS2_IsNumeric + 5504
3   org.python.python             	0x0000000100079fc8 PyErr_WarnExplicit + 1113
4   org.python.python             	0x00000001000951df PyEval_EvalFrameEx + 15001
5   org.python.python             	0x0000000100096ccf PyEval_EvalCodeEx + 1803
6   org.python.python             	0x0000000100096d62 PyEval_EvalCode + 54
7   org.python.python             	0x00000001000ae65a Py_CompileString + 78
8   org.python.python             	0x00000001000b04dd PyRun_InteractiveOneFlags + 503
9   org.python.python             	0x00000001000b0615 PyRun_InteractiveLoopFlags + 206
10  org.python.python             	0x00000001000b0685 PyRun_AnyFileExFlags + 76
11  org.python.python             	0x00000001000bc286 Py_Main + 2718
12  python                        	0x0000000100000e6c start + 52
msg101384 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-03-20 17:36
I cannot reproduce this with python 2.6.4 or trunk on linux.
msg101393 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-03-20 20:15
Can't reproduce under OS X with Python 2.6.5. Closing as out of date.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52430
2010-03-20 20:15:52brett.cannonsetstatus: open -> closed

nosy: + brett.cannon
messages: + msg101393

resolution: out of date
2010-03-20 17:36:53r.david.murraysetnosy: + r.david.murray
messages: + msg101384
2010-03-20 17:07:01brominecreate