[py-dev] Patch to py/path/local/common.py

Alexander Ross alex.j.ross at gmail.com
Wed Aug 30 03:10:22 CEST 2006


Compiling the file `py/path/local/common.py` with python2.2 results in
a SyntaxError.  This keeps `py.test --exec=python2.2` from running as
advertised.  I was able to patch `py/path/local/common.py` so that it
will work with python2.2.  I don't know if this breaks anything, but
it has worked for me so far.

Index: py/path/local/common.py
===================================================================
--- py/path/local/common.py     (revision 31816)
+++ py/path/local/common.py     (working copy)
@@ -5,18 +5,17 @@
         self.path = path
         self._osstatresult = osstatresult
-    for name in ('atime blksize blocks ctime dev gid '
+    for name in ('atime blksize blocks ctime dev gid '
                  'ino mode mtime nlink rdev size uid'.split()):
-        exec """if 1:
-            def fget(self):
-                return getattr(self._osstatresult, "st_%(name)s", None)
-            %(name)s = property(fget)
-            def fget_deprecated(self):
-                py.std.warnings.warn("statresult.st_%(name)s is
deprecated, use "
-                                     "statresult.%(name)s instead.",
-                                     DeprecationWarning, stacklevel=2)
-                return getattr(self._osstatresult, "st_%(name)s", None)
-            st_%(name)s = property(fget_deprecated)""" % locals()
+        exec """def fget(self):
+    return getattr(self._osstatresult, "st_%(name)s", None)
+%(name)s = property(fget)
+def fget_deprecated(self):
+    py.std.warnings.warn("statresult.st_%(name)s is deprecated, use "
+                         "statresult.%(name)s instead.",
+                         DeprecationWarning, stacklevel=2)
+    return getattr(self._osstatresult, "st_%(name)s", None)
+st_%(name)s = property(fget_deprecated)""" % locals()
     del fget
     del fget_deprecated



More information about the Pytest-dev mailing list