MemoryError with parser.suite and wrong encoding declaration

Sylvain Thenault sylvain.thenault at nospam.logilab.fr
Tue Jan 18 09:11:44 EST 2005


Hi there !
I've noticed the following problem with python >= 2.3 (actually 2.3.4 and
2.4):

syt at musca:test$ python
Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
[GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import parser
>>> parser.suite('# -*- coding: IBO-8859-1 -*-')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
MemoryError
>>> parser.suite('# -*- coding: ISO-8859-1 -*-')
<parser.st object at 0xb7e5e060>

Shouldn't parser.suite just ignore the wrong encoding declaration, or at
least raise a more appropriate exception. IMHO the first solution
would be better, since that's the behaviour of the (C) python interpreter.

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org





More information about the Python-list mailing list