[pypy-dev] __file__ attribute of mixed modules
Antonio Cuni
anto.cuni at gmail.com
Tue Nov 13 00:02:51 CET 2007
Hi all,
I'm having troubles running pypy-cli on windows.
One of the problem is due to the __file__ attribute of mixed modules;
currently it's something like path/to/mixed/module/*.py.
When site.py runs, it tries to compute the abspath of every module
loaded; after a bit of indirections, abspath call the posix__getfullpath
helper written in C#.
The most obvious (and probably most correct) way to implement
posix__getfullpath is to delegate to System.IO.Path.GetFullPath; here is
where problems come, since the CLR implementation of GetFullPath
complains if we pass it a name with an asterisk (Mono doesn't). This
prevents pypy-cli to start.
One possible solution would be to place a check inside the C# helper and
not call GetFullPath in case there is an asterisk in the name (or maybe
remove the asterisk, call GetFullPath and re-insert the asterisk). I
think this solution is ugly and hackish.
Another solution is to change the way we assign __file__ to mixed
modules; e.g., we could use the name of the directory itself, or
__init__.py instead of *.py. Or maybe some weird name like
'i_dont_really_exist.py', etc.
What do you think?
ciao Anto
More information about the pypy-dev
mailing list