Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r59143:ef3cb0c76516
Date: 2012-11-30 00:50 +0100
http://bitbucket.org/pypy/pypy/changeset/ef3cb0c76516/

Log:    With PyPy, builtin functions also have a __code__; check
        __code__.co_filename. 2.7 had the same tweak.

diff --git a/lib-python/3.2/test/test_warnings.py 
b/lib-python/3.2/test/test_warnings.py
--- a/lib-python/3.2/test/test_warnings.py
+++ b/lib-python/3.2/test/test_warnings.py
@@ -367,7 +367,8 @@
     # test.support.import_fresh_module utility function
     def test_accelerated(self):
         self.assertFalse(original_warnings is self.module)
-        self.assertFalse(hasattr(self.module.warn, '__code__'))
+        self.assertFalse(hasattr(self.module.warn, '__code__') and
+                         hasattr(self.module.warn.__code__, 'co_filename'))
 
 class PyWarnTests(BaseTest, WarnTests):
     module = py_warnings
@@ -376,7 +377,8 @@
     # test.support.import_fresh_module utility function
     def test_pure_python(self):
         self.assertFalse(original_warnings is self.module)
-        self.assertTrue(hasattr(self.module.warn, '__code__'))
+        self.assertTrue(hasattr(self.module.warn, '__code__') and
+                        hasattr(self.module.warn.__code__, 'co_filename'))
 
 
 class WCmdLineTests(unittest.TestCase):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to