Connecting Tech Pros Worldwide Forums | Help | Site Map

Can anyone confirm this modulefinder bug?

Roger Binns
Guest
 
Posts: n/a
#1: Jul 18 '05
- Create foo.py

# -*- coding: mbcs -*-
"string"
var1="1.2.3.4"
var2=0x123345

- Do this at a python prompt
[color=blue][color=green][color=darkred]
> > > import modulefinder
> > > m=modulefinder.ModuleFinder()
> > > m.run_script("foo.py")[/color][/color][/color]

You then get a traceback with a MemoryError (sorry I can't paste
the traceback due to this being via display protocol that doesn't
support the clipboard).

I get this on Linux for sure and believe it is also being seen on Mac.
The issue does not occur on Windows.

It started happening when using cx_Freeze on Linux and BundleBuilder
on Mac, and the mbcs encoded file is generated by makepy from win32all
(ie it is Python code generated from a COM type library). Since
modulefinder parses byte codes, it ignores the fact that I only
import the file when sys.platform == "win32".

Removing the coding line doesn't result in the error any more.

Roger



Thomas Heller
Guest
 
Posts: n/a
#2: Jul 18 '05

re: Can anyone confirm this modulefinder bug?


"Roger Binns" <rogerb@rogerbinns.com> writes:
[color=blue]
> - Create foo.py
>
> # -*- coding: mbcs -*-
> "string"
> var1="1.2.3.4"
> var2=0x123345
>
> - Do this at a python prompt
>[color=green][color=darkred]
>> > > import modulefinder
>> > > m=modulefinder.ModuleFinder()
>> > > m.run_script("foo.py")[/color][/color]
>
> You then get a traceback with a MemoryError (sorry I can't paste
> the traceback due to this being via display protocol that doesn't
> support the clipboard).
>
> I get this on Linux for sure and believe it is also being seen on Mac.
> The issue does not occur on Windows.[/color]

Yes, I can confirm this (Python 2.3+, linux x86).
The problem appears to be this:
[color=blue][color=green][color=darkred]
>>> compile("# -*- coding: mbcs -*-", "<string>", "exec")[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
MemoryError[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]

Thomas
Thomas Heller
Guest
 
Posts: n/a
#3: Jul 18 '05

re: Can anyone confirm this modulefinder bug?


Thomas Heller <theller@python.net> writes:
[color=blue]
> "Roger Binns" <rogerb@rogerbinns.com> writes:
>[color=green]
>> - Create foo.py
>>
>> # -*- coding: mbcs -*-
>> "string"
>> var1="1.2.3.4"
>> var2=0x123345
>>
>> - Do this at a python prompt
>>[color=darkred]
>>> > > import modulefinder
>>> > > m=modulefinder.ModuleFinder()
>>> > > m.run_script("foo.py")[/color]
>>
>> You then get a traceback with a MemoryError (sorry I can't paste
>> the traceback due to this being via display protocol that doesn't
>> support the clipboard).
>>
>> I get this on Linux for sure and believe it is also being seen on Mac.
>> The issue does not occur on Windows.[/color]
>
> Yes, I can confirm this (Python 2.3+, linux x86).
> The problem appears to be this:
>[color=green][color=darkred]
>>>> compile("# -*- coding: mbcs -*-", "<string>", "exec")[/color][/color]
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> MemoryError[color=green][color=darkred]
>>>>[/color][/color][/color]

For Windows, it's possible to also trigger it:
[color=blue][color=green][color=darkred]
>>> compile("# -*- encoding: abc -*-", "<string>", "exec")[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
MemoryError[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]

Who files the bug?

Thomas
Roger Binns
Guest
 
Posts: n/a
#4: Jul 18 '05

re: Can anyone confirm this modulefinder bug?


Thomas Heller wrote:[color=blue][color=green]
> > Yes, I can confirm this (Python 2.3+, linux x86).
> > The problem appears to be this:
> >[color=darkred]
> > > > > compile("# -*- coding: mbcs -*-", "<string>", "exec")[/color]
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > MemoryError[color=darkred]
> > > > >[/color][/color]
>
> For Windows, it's possible to also trigger it:
>[color=green][color=darkred]
> > > > compile("# -*- encoding: abc -*-", "<string>", "exec")[/color][/color]
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> MemoryError[color=green][color=darkred]
> > > >[/color][/color]
>
> Who files the bug?[/color]

I believe Anthony Tuininga will be filing it. I originally was
using cx-Freeze on Linux and reported the issue on that mailing
list. Anthony also found it to be present in Python 2.4 CVS
and volunteered to report it.

Roger


Closed Thread