[Python-Dev] FW: weird bug in test_winreg

Mark Hammond mhammond@skippinet.com.au
Fri, 5 May 2000 09:55:15 +1000


> It's Vladimir's patch which, after each tests, unloads all modules
> that were loaded by that test.  If I change this to only unload
> modules whose name starts with "test.", the test_winreg problem goes
> away, and I bet yours go away too.

They do indeed!

> The real reason must be deeper -- there's also the import lock and the
> fact that if a submodule of package "test" tries to import "os", a
> search for "test.os" is made and if it doesn't find it it sticks None
> in sys.modules['test.os'].
>
> but I don't have time to research this further.

I started to think about this.  The issue is simply that code which
blithely wipes sys.modules[] may cause unexpected results.  While the end
result is a bug, the symptoms are caused by extreme hackiness.

Seeing as my time is also limited, I say we forget it!

> I'm tempted to apply the following change to regrtest.py.  This should
> still unload the test modules (so you can rerun an individual test)
> but it doesn't touch other modules.  I'll wait 24 hours. :-)

The 24 hour time limit is only supposed to apply to _my_ patches - you can
check yours straight in (and if anyone asks, just tell them I said it was
OK) :-)

Mark.