[pypy-svn] r34243 - in pypy/dist/pypy: module/_file objspace/std

arigo at codespeak.net arigo at codespeak.net
Sun Nov 5 16:34:42 CET 2006


Author: arigo
Date: Sun Nov  5 16:34:41 2006
New Revision: 34243

Modified:
   pypy/dist/pypy/module/_file/app_file.py
   pypy/dist/pypy/objspace/std/objspace.py
Log:
(cfbolz, pedronis, arigo)

Move the 'import os' out of the top-level module.  This was causing
old-style classes to stop working.  Ha ha ha!

Better 'assert' to catch this problem.


Modified: pypy/dist/pypy/module/_file/app_file.py
==============================================================================
--- pypy/dist/pypy/module/_file/app_file.py	(original)
+++ pypy/dist/pypy/module/_file/app_file.py	Sun Nov  5 16:34:41 2006
@@ -1,7 +1,5 @@
 """NOT_RPYTHON"""
 
-import os
-
 class file(object):
     """file(name[, mode[, buffering]]) -> file object
 
@@ -242,6 +240,7 @@
         """isatty() -> true or false.  True if the file is connected to a tty device."""
         if self._closed:
             raise ValueError('I/O operation on closed file')
+        import os
         return os.isatty(self.fd)
 
     def __repr__(self):

Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Sun Nov  5 16:34:41 2006
@@ -147,13 +147,13 @@
     def setup_old_style_classes(self):
         """NOT_RPYTHON"""
         # sanity check that this approach is working and is not too late
-        assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_classobj'))),"app-level code has seen dummy old style classes"
-        assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_instance'))),"app-level code has seen dummy old style classes"
         w_mod, w_dic = self.create_builtin_module('_classobj.py', 'classobj')
         w_purify = self.getitem(w_dic, self.wrap('purify'))
         w_classobj = self.getitem(w_dic, self.wrap('classobj'))
         w_instance = self.getitem(w_dic, self.wrap('instance'))
         self.call_function(w_purify)
+        assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_classobj'))),"app-level code has seen dummy old style classes"
+        assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_instance'))),"app-level code has seen dummy old style classes"
         self.w_classobj = w_classobj
         self.w_instance = w_instance
 



More information about the Pypy-commit mailing list