[pypy-svn] pypy fast-forward: Try harder to recognize builtin functions: With pypy, func_code is a builtin-code object...

amauryfa commits-noreply at bitbucket.org
Tue Jan 4 17:03:44 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40387:4624333d03d2
Date: 2011-01-04 16:48 +0100
http://bitbucket.org/pypy/pypy/changeset/4624333d03d2/

Log:	Try harder to recognize builtin functions: With pypy, func_code is a
	builtin-code object...

diff --git a/lib-python/modified-2.7.0/test/test_warnings.py b/lib-python/modified-2.7.0/test/test_warnings.py
--- a/lib-python/modified-2.7.0/test/test_warnings.py
+++ b/lib-python/modified-2.7.0/test/test_warnings.py
@@ -354,7 +354,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, 'func_code'))
+        self.assertFalse(hasattr(self.module.warn, 'func_code') and
+                         hasattr(self.module.warn.func_code, 'co_filename'))
 
 class PyWarnTests(BaseTest, WarnTests):
     module = py_warnings
@@ -363,7 +364,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, 'func_code'))
+        self.assertTrue(hasattr(self.module.warn, 'func_code') and
+                        hasattr(self.module.warn.func_code, 'co_filename'))
 
 
 class WCmdLineTests(unittest.TestCase):


More information about the Pypy-commit mailing list