[pypy-commit] pypy default: have _testcapi sans cpyext trigger an ImportError instead of becoming an empty
pjenvey
noreply at buildbot.pypy.org
Thu May 16 01:27:57 CEST 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch:
Changeset: r64208:716fff8d1c65
Date: 2013-05-15 16:27 -0700
http://bitbucket.org/pypy/pypy/changeset/716fff8d1c65/
Log: have _testcapi sans cpyext trigger an ImportError instead of
becoming an empty module
diff --git a/lib-python/2.7/test/test_codecs.py b/lib-python/2.7/test/test_codecs.py
--- a/lib-python/2.7/test/test_codecs.py
+++ b/lib-python/2.7/test/test_codecs.py
@@ -2,7 +2,11 @@
import unittest
import codecs
import locale
-import sys, StringIO, _testcapi
+import sys, StringIO
+try:
+ import _testcapi
+except ImportError:
+ _testcapi = None
class Queue(object):
"""
@@ -1387,8 +1391,7 @@
decodedresult += reader.read()
self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding))
- if (encoding not in broken_incremental_coders and
- hasattr(_testcapi, 'codec_incrementalencoder')):
+ if encoding not in broken_incremental_coders and _testcapi:
# check incremental decoder/encoder (fetched via the Python
# and C API) and iterencode()/iterdecode()
try:
diff --git a/lib-python/2.7/test/test_descr.py b/lib-python/2.7/test/test_descr.py
--- a/lib-python/2.7/test/test_descr.py
+++ b/lib-python/2.7/test/test_descr.py
@@ -2080,9 +2080,8 @@
except ImportError:
pass
else:
- if hasattr(_testcapi, 'test_with_docstring'):
- class X(object):
- p = property(_testcapi.test_with_docstring)
+ class X(object):
+ p = property(_testcapi.test_with_docstring)
def test_properties_plus(self):
class C(object):
diff --git a/lib_pypy/_testcapi.py b/lib_pypy/_testcapi.py
--- a/lib_pypy/_testcapi.py
+++ b/lib_pypy/_testcapi.py
@@ -57,6 +57,6 @@
try:
import cpyext
except ImportError:
- pass
+ raise ImportError("No module named '_testcapi'")
else:
compile_shared()
More information about the pypy-commit
mailing list