Dear Cython-Dev, currently I try to create a Cython package comprising couple of extension modules for usage in Sage. It somehow works, but apparently the extension classes in the modules don't know where they belong to.
In my setup.py, I have setup( name = "pGroupCohomology", version = "1.0", author = "Simon A. King", author_email = "[email protected]", url = "http://users.minet.uni-jena.de/~king/cohomology/", description = "Modular Cohomology Rings of Groups of Prime Power Order", packages=["pGroupCohomology"], package_dir={"pGroupCohomology":"CohoSrc"}, ext_package="pGroupCohomology", ext_modules=[ Extension("mtx", sources = ["CohoSrc/mtx.pyx", ...], ...), Extension(...)] cmdclass = {'build_ext': build_ext} ) I learned from some documentation that providing the optional argument 'ext_package' should make the Extensions modules in that package, so, it should be Extension("mtx",...), not Extension("pGroupCohomology.mtx",...). Running it, I get modules that I can import into sage: sage: from pGroupCohomology.mtx import MTX sage: M=MTX('some_data_file') This works, and I can do some computations. But apparently, the class MTX does not know where it lives: sage: M.__class__ <type 'mtx.MTX'> Shouldn't it say <type 'pGroupCohomology.mtx.MTX'>? The callable class responsible for unpickling MTX has the same identity crisis. sage: save(M,'Test') --------------------------------------------------------------------------- PicklingError Traceback (most recent call last) ... PicklingError: Can't pickle mtx.MTX_unpickle_class: it's not the same object as mtx.MTX_unpickle_class So, MTX_unpickle_class is not identical with itself! Removing the ext_package parameter and instead writing Extension("pGroupCohomology.mtx",...) did not help. What goes wrong here? Is there a way to tell a module that it belongs to a package? Best regards, Simon ---------------------------------------------------------------- This mail was sent through http://webmail.uni-jena.de _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
