1. Konstantin Lopuhin
  2. pypy

Commits

Amaury Forgeot d'Arc  committed ef3cb0c

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

  • Participants
  • Parent commits bcf0ce5
  • Branches py3k

Comments (0)

Files changed (1)

File lib-python/3.2/test/test_warnings.py

View file
  • Ignore whitespace
     # 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
     # 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):