[ python-Bugs-990743 ] Crash when importing encoded file

SourceForge.net noreply at sourceforge.net
Wed Jul 14 11:05:00 CEST 2004


Bugs item #990743, was opened at 2004-07-14 09:05
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=990743&group_id=5470

Category: Unicode
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jurjen N.E. Bos (jneb)
Assigned to: M.-A. Lemburg (lemburg)
Summary: Crash when importing encoded file

Initial Comment:
Python crashes (!) when it meets a non-ascii character in a file with 
encoding in use.

For example:
<file foo.py>
# encoding: mac-roman

...

<square root character>


<in Python>
>>> import user #so we can import 
>>> import foo
Parser/tokenizer.c:366: failed assertion `strlen(str) < (size_t)size'
Abort

When debugging, I found the StreamReader.readline() routine in 
codecs.py. It self.calls decode, which does return well; then readline 
returns, and then the inevitable happens.
Readline is called straight from the toplevel (from the viewpoint of 
the debugger), which probably means calling readline is part of the 
import logic in C.
So the bug must somewhere in there...
- Jurjen

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=990743&group_id=5470


More information about the Python-bugs-list mailing list