1. Florian Hahn
  2. pypy

Commits

Philip Jenvey  committed 489d7cd

support --withoutmod-cpyext

  • Participants
  • Parent commits ffcba4b
  • Branches stdlib-2.7.4

Comments (0)

Files changed (1)

File lib-python/2.7/test/test_support.py

View file
 import re
 import time
 import struct
-import _testcapi
 import sysconfig
 try:
+    import _testcapi
+except ImportError:
+    _testcapi = None
+try:
     import thread
 except ImportError:
     thread = None
     # add GC header size
     if ((type(o) == type) and (o.__flags__ & _TPFLAGS_HEAPTYPE) or\
         ((type(o) != type) and (type(o).__flags__ & _TPFLAGS_HAVE_GC))):
-        size += _testcapi.SIZEOF_PYGC_HEAD
+        size += 1 if _testcapi is None else _testcapi.SIZEOF_PYGC_HEAD
     msg = 'wrong size for %s: got %d, expected %d' \
             % (type(o), result, size)
     test.assertEqual(result, size, msg)