Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

> You can make the dictionary values as lists for the 'blocked'
> argument for import_fresh_module(). That would work [for io].

I don't understand how having multiple modules in the blocked list will help in 
io case.  io.py will simply not work if _io is blocked.  It does not use 
"define in Python, override with native if available" strategy.  Instead, io.py 
and _pyio.py are independent complete implementations.

I don't like that approach because it makes pure python code hard to discover.  
In the recent discussions, some people were in fact surprised to learn that 
pure python io implementation is still available.  The io/_pyio approach also 
prevents io.py from bring used by alternative python implementations unmodified.


What I can do, is to add an optional "blocked" argument 
import_module_implementations() along the lines of

def import_module_implementations(name, blocked=None):
    if blocked is None:
        blocked = ('_' + name,)
    ...

This will not solve the io issue, but will add some flexibility.

Note that import_module_implementations() as designed is not very useful for 
tests of the named module itself.  In that case you need the implementations 
individually rather than as a list.  This is mostly useful in situations like 
pickle where other modules are tested for interoperability with alternative 
pickle implementations.

Of course, I should document the mechanism once we agree on what it should be. 
:-)  (I did not know that test.support had a reST document, but will update it 
for this patch.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9104>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to