Pyrex / py2exe import interaction

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Jul 31 01:21:54 EDT 2002


> The _import_one is being called on 'testmod', which is the binary
> module compiled by pyrex.

What puzzles me most about this is that there's no such
thing as a "binary module" -- Pyrex modules are perfectly
ordinary module objects, the same as the interpreter uses.

I have a feeling this may have something to do with the
"current module". When I was figuring out how to implement
the import statement, I did some poking about to find out
how the interpreter does it. I can't remember all the
details, but I think I found that I couldn't emulate it
exactly, because it made use of a notion of a "current
module" that only applies when interpreted code is being
executed.

Maybe the import hooks are using this to find out what
package the importing module belongs to? If that's the
case, then it's probably going to get whatever was the
last interpreted module that a function was executed
from. Now, if the Pyrex module is being invoked as the
main module by py2exe without going through an
interpreted module first... maybe that's what the
root cause of the problem is?

I'm just guessing wildly here, and may be completely
wrong.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Python-list mailing list