We develop modules (either pure Python or SWIG'ed ones) that are used by
people importing them into their applications. Then can put those modules
where they want.
Some modules need additional data files, so to easily find them and avoid
name clashing, they are located in a sub-directory where the module resides,
with the same name (without the extension).
So to access those data files from an instance:
path = os.path.splitext(sys.modules[self.__module__].__file__)[0]
We are evaluating the possibility to move to Cython instead of SWIG. But
this statement above may fail, because the name returned by self.__module__
may not exist in sys.modules (when prefixed by package name(s)).
Trying to find the issue, I saw that the module name, at class creation, was
hardcoded, whereas the module's __name__ attribute was correctly reporting
the package hierarchy. So the patch I'm proposing.
Could you provide me with a simple example of "extension types (I mean, cdef
ones)" demonstrating the issue of my patch (sorry I'm new in Cython)?
Thanks,
Stephane
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev