>> Currently, for Cython? I don't think that can work. > > Hmm, it might work to put an empty module next to the 'real' extension > and to import it to figure out the common directory of both. As long as > it's still there after installation and the right one gets imported, > that is. A relative import should help on versions that support it. > Although that won't help in the __init__ case because a relative import > will likely depend on __path__ being available first. Chicken and egg...
If there was an actual __init__.py that just had import __cinit__ then __cinit__ could copy __path__ from the already-loaded __init__, no? >> Certainly. An approach similar to _Py_PackageContext should be possible. > > Yes, and a "_Py_ModuleImportContext" would be rather trivial to do. > Could that go into 3.3? If somebody contributes a patch: sure. > What about 2.7? Certainly not. It would be a new feature, and there can't be new features in 2.7. > Could an exception be made there regarding new "features"? > It's not likely to break anything, but it would help Cython. "Not likely to break anything" really means it practice "it probably will break somebody's code". Policies are there to be followed, and this one I personally feel strongly about. If it means that users can get certain Cython features only with Python 3.x, the better. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com