This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients alexandre.vassalotti, belopolsky, benjamin.peterson, mark.dickinson, pitrou
Date 2010-07-01.14:28:53
SpamBayes Score 7.5022814e-05
Marked as misclassified No
Message-id <1277994538.26.0.802894816163.issue9104@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.)
History
Date User Action Args
2010-07-01 14:28:58belopolskysetrecipients: + belopolsky, mark.dickinson, pitrou, alexandre.vassalotti, benjamin.peterson
2010-07-01 14:28:58belopolskysetmessageid: <1277994538.26.0.802894816163.issue9104@psf.upfronthosting.co.za>
2010-07-01 14:28:55belopolskylinkissue9104 messages
2010-07-01 14:28:53belopolskycreate