Robert wrote:

I've set up my Linux too now. That latest pyxi3.patch and it does.

With reload_support=False its exactly like the old 0.11.1 behavior :

 >>> import my 
 >>> reload(my)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
ImportError: No module named my

which is in my opinion bogus, because
 >>> reload(time)
<module 'time' from '/usr/lib/python2.4/lib-dynload/time.so'>



and with reload_support=True its now ok



I've done a few more tests on Linux and Win, and it does so far on my side in all modes - for practical edit-run/reload debugging purposes. The reload_support=False is anyway default.

the little 3+.patch in attachment in addition to pyxi3.patch
http://trac.cython.org/cython_trac/ticket/312
(or manually against 0.11.1)
finally would solve the mentioned "reload(my) -> ImportError: No module named my" problem of 0.11.1 or of reload_support=False default mode

I leave it open so far from my side.


Robert











diff -u _3/pyximport.py ./pyximport.py
--- _3/pyximport.py     Sun May 17 13:27:29 2009
+++ ./pyximport.py      Sun May 17 13:30:13 2009
@@ -199,8 +199,8 @@
         self.pyxbuild_dir = pyxbuild_dir
 
     def find_module(self, fullname, package_path=None):
-        if fullname in sys.modules  and  not pyxargs.reload_support:
-            return None  # only here when reload() 
+        ##if fullname in sys.modules  and  not pyxargs.reload_support:
+        ##    return None  # only here when reload() 
         try:
             fp, pathname, (ext,mode,ty) = 
imp.find_module(fullname,package_path)
             if fp: fp.close()  # Python should offer a Default-Loader to avoid 
this double find/open!
@@ -320,6 +320,8 @@
         assert self.fullname == fullname, (
             "invalid module, expected %s, got %s" % (
             self.fullname, fullname))
+        if fullname in sys.modules  and  not pyxargs.reload_support:
+            return sys.modules[fullname]  # only here when reload()
         if self.init_path:
             # package
             #print "PACKAGE", fullname
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to