So go ahead and tear this apart so that we can hopefully reach a consensus that makes sense so that at least testing can easily be done.


If I was developing an application and wanted to deal with two different versions of the same library, I would simply make sure that the version I wanted to use was first on sys.path. Perhaps something such as:

lib/python-3.0/libdynload/ # extension module implementations
lib/python-3.0/libpython/ # pure python implementations

Then in the test suite simply ensure that either the Python implementation or the C implementation is first on sys.path. Both directories would contain an _pickle.py module, and then pickle.py could be changed from:

try:
    from _pickle import *
except ImportError:
    Pickler, Unpickler = _Pickler, _Unpickler

To just:

from _pickle import Pickler, Unpickler

By default libdynload would be first on sys.path so that extension modules would be imported first if available, otherwise it would fallback to the pure Python versions. The test suite could then add/ remove libdynload from sys.path as needed.

Well, OK, so this is a pretty big change as to how standard lib files are structured - so maybe there are quite a few reasons why this isn't feasable ... but it does make things a lot simpler and gets rid of the need for performing any magic with the loaded modules in the test suite.


_______________________________________________
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

Reply via email to