[py-dev] Re: [py-svn] r7025 - in py/dist/py: path path/extpy path/local path/svn test
holger krekel
hpk at trillke.net
Tue Oct 19 17:43:30 CEST 2004
Hi Armin,
[arigo at codespeak.net Tue, Oct 19, 2004 at 03:40:21PM +0200]
> New Revision: 7025
> ...
> Log:
> Get rid of the imp module to import local modules. Instead:
>
> FSPathBase.getmodule(): uses a new internal method 'self.getcodeobj()' to get
> the module's top-level code object, and then (as before) build a module
> object, put it in sys.modules, and run the code in the module.
>
> FSPathBase.getcodeobj(): uses self.read() and dyncode as before.
>
> LocalPath.getcodeobj(): uses the regular compile() to make the code object, so
> that a local module shows up normally in tracebacks and in the co_filename
> attributes. This is also where we look for and create .pyc files. In this
> scheme, .pyc files are completely ignored for non-local paths. This is
> probably not too bad: with svn paths, say, creating the .pyc files would add
> them to the repository.
>
> Plus a few details, including setting up the new module's __path__ so that
> relative imports work (at least on local paths).
all nice! But i think we should signal more clearly that these
methods refer to *python* files. Or do it slightly differently
by, for example, providing a py.magic.View and defining the
"getpymodule()" and "getpycode()" on a separated out layer
to reduce namespace complexity.
I am not completly sure though that this is feasible. At least
we should rename the methods to getpycode/getpymodule.
cheers,
holger
More information about the Pytest-dev
mailing list