Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > MemoryError with parser.suite and wrong encoding declaration

Reply
Thread Tools

MemoryError with parser.suite and wrong encoding declaration

 
 
Sylvain Thenault
Guest
Posts: n/a
 
      01-18-2005
Hi there !
I've noticed the following problem with python >= 2.3 (actually 2.3.4 and
2.4):

syt@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


 
Reply With Quote
 
 
 
 
Thomas Heller
Guest
Posts: n/a
 
      01-18-2005
Sylvain Thenault <> writes:

> Hi there !
> I've noticed the following problem with python >= 2.3 (actually 2.3.4 and
> 2.4):
>
> syt@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.


Ignore the wrong declaration? All Python's that I have (on windows,
at least) raise a SyntaxError:

File "x.py", line 1
SyntaxError: 'unknown encoding: IBO-8859-1'

See also:

http://www.python.org/sf/979739

Thomas
 
Reply With Quote
 
 
 
 
Sylvain Thenault
Guest
Posts: n/a
 
      01-18-2005
On Tue, 18 Jan 2005 16:16:32 +0100, Thomas Heller wrote:

> Sylvain Thenault <> writes:
>
>> Hi there !
>> I've noticed the following problem with python >= 2.3 (actually 2.3.4
>> and 2.4):
>>
>> syt@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.

>
> Ignore the wrong declaration? All Python's that I have (on windows, at
> least) raise a SyntaxError:
>
> File "x.py", line 1
> SyntaxError: 'unknown encoding: IBO-8859-1'


hum, right (with python >= 2.3 which is the first release using those
declaration...). I was sure to have checked this but I've obviously
missed something. Maybe the fact that being able to parse it anyway is
the solution I wish has driven me to write this I would like this
behaviour so that pylint can check a module with a wrong encoding
declaration anyway. But at least, SyntaxError would be better than
MemoryError.

> See also:
>
> http://www.python.org/sf/979739


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

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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MemoryError - IMAP retrieve self._sock.recv(recv_size) Stephen G Python 0 10-18-2006 12:25 PM
Weird MemoryError issue jedi200581@yahoo.co.uk Python 4 07-20-2006 06:48 AM
MemoryError Numarray Bernhard Reimar Hoefle Python 0 09-26-2005 07:03 AM
MemoryError in socket.py on Windows XP Jamie Python 0 11-27-2003 03:37 AM
MemoryError: out of memory Python 2.1.3 on Windows 2000 Andy Rechenberg Python 0 08-27-2003 03:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57