]> granicus.if.org Git - python/commitdiff
Merged revisions 61038,61042-61045,61047,61049-61053,61055-61057 via svnmerge from
authorChristian Heimes <christian@cheimes.de>
Mon, 25 Feb 2008 12:39:23 +0000 (12:39 +0000)
committerChristian Heimes <christian@cheimes.de>
Mon, 25 Feb 2008 12:39:23 +0000 (12:39 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r61049 | christian.heimes | 2008-02-24 13:26:16 +0100 (Sun, 24 Feb 2008) | 1 line

  Use PY_FORMAT_SIZE_T instead of z for string formatting. Thanks Neal.
........
  r61051 | mark.dickinson | 2008-02-24 19:12:36 +0100 (Sun, 24 Feb 2008) | 2 lines

  Remove duplicate 'import re' in decimal.py
........
  r61052 | neal.norwitz | 2008-02-24 19:47:03 +0100 (Sun, 24 Feb 2008) | 11 lines

  Create a db_home directory with a unique name so multiple users can
  run the test simultaneously.  The simplest thing I found that worked
  on both Windows and Unix was to use the PID.  It's unique so should be
  sufficient.  This should prevent many of the spurious failures of
  the automated tests since they run as different users.

  Also cleanup the directory consistenly in the tearDown methods.

  It would be nice if someone ensured that the directories are always
  created with a consistent name.
........
  r61057 | christian.heimes | 2008-02-24 23:48:05 +0100 (Sun, 24 Feb 2008) | 2 lines

  Added dependency rules for Objects/stringlib/*.h
  stringobject, unicodeobject and the two formatters are rebuild whenever a header files changes
........

22 files changed:
Lib/bsddb/test/test_associate.py
Lib/bsddb/test/test_basics.py
Lib/bsddb/test/test_compare.py
Lib/bsddb/test/test_cursor_pget_bug.py
Lib/bsddb/test/test_dbobj.py
Lib/bsddb/test/test_dbshelve.py
Lib/bsddb/test/test_dbtables.py
Lib/bsddb/test/test_env_close.py
Lib/bsddb/test/test_join.py
Lib/bsddb/test/test_lock.py
Lib/bsddb/test/test_misc.py
Lib/bsddb/test/test_pickle.py
Lib/bsddb/test/test_recno.py
Lib/bsddb/test/test_sequence.py
Lib/bsddb/test/test_thread.py
Lib/decimal.py
Lib/test/test_bsddb3.py
Lib/test/test_format.py
Lib/test/test_support.py
Makefile.pre.in
Objects/dictobject.c
Objects/listobject.c

index ab7b600780648295e31403f877b25dc4a928649d..1a32460bdd378008f710d14e60dbb4f37c84d0bc 100644 (file)
@@ -92,15 +92,23 @@ musicdata = {
 class AssociateErrorTestCase(unittest.TestCase):
     def setUp(self):
         self.filename = self.__class__.__name__ + '.db'
-        self.homeDir = tempfile.mkdtemp()
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
+        self.homeDir = homeDir
+        try:
+            os.mkdir(homeDir)
+        except os.error:
+            import glob
+            files = glob.glob(os.path.join(self.homeDir, '*'))
+            for file in files:
+                os.remove(file)
         self.env = db.DBEnv()
         self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
 
     def tearDown(self):
         self.env.close()
         self.env = None
-        shutil.rmtree(self.homeDir)
-
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def test00_associateDBError(self):
         if verbose:
@@ -141,7 +149,7 @@ class AssociateTestCase(unittest.TestCase):
 
     def setUp(self):
         self.filename = self.__class__.__name__ + '.db'
-        homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
         self.homeDir = homeDir
         try:
             os.mkdir(homeDir)
index 8d7f15d5798f878872afe0c880e6a952526f90ad..77ef361c2097c5c307e8c8658f91dfd217392bb6 100644 (file)
@@ -6,10 +6,10 @@ various DB flags, etc.
 import os
 import sys
 import errno
-import shutil
 import string
 import tempfile
 from pprint import pprint
+from test import test_support
 import unittest
 import time
 
@@ -54,7 +54,10 @@ class BasicTestCase(unittest.TestCase):
 
     def setUp(self):
         if self.useEnv:
-            self.homeDir = tempfile.mkdtemp()
+            homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
+            self.homeDir = homeDir
+            test_support.rmtree(homeDir)
+            os.mkdir(homeDir)
             try:
                 self.env = db.DBEnv()
                 self.env.set_lg_max(1024*1024)
@@ -68,7 +71,7 @@ class BasicTestCase(unittest.TestCase):
                 tempfile.tempdir = old_tempfile_tempdir
             # Yes, a bare except is intended, since we're re-raising the exc.
             except:
-                shutil.rmtree(self.homeDir)
+                test_support.rmtree(homeDir)
                 raise
         else:
             self.env = None
@@ -92,8 +95,8 @@ class BasicTestCase(unittest.TestCase):
     def tearDown(self):
         self.d.close()
         if self.env is not None:
+            test_support.rmtree(self.homeDir)
             self.env.close()
-            shutil.rmtree(self.homeDir)
             ## Make a new DBEnv to remove the env files from the home dir.
             ## (It can't be done while the env is open, nor after it has been
             ## closed, so we make a new one to do it.)
index 49aa7caba0341dc7f156149cacb0e9a1df03af35..3e9ecce798472fc96d0963e4ee2dd6ac94191ed9 100644 (file)
@@ -66,7 +66,7 @@ class AbstractBtreeKeyCompareTestCase (unittest.TestCase):
 
     def setUp (self):
         self.filename = self.__class__.__name__ + '.db'
-        homeDir = os.path.join (tempfile.gettempdir(), 'db_home')
+        homeDir = os.path.join (tempfile.gettempdir(), 'db_home%d'%os.getpid())
         self.homeDir = homeDir
         try:
             os.mkdir (homeDir)
@@ -84,7 +84,8 @@ class AbstractBtreeKeyCompareTestCase (unittest.TestCase):
         if self.env is not None:
             self.env.close ()
             self.env = None
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def addDataToDB (self, data):
         i = 0
index 32dd8a5b8b20725f33186067db3a85e6ff6e2678..66821805911df507988ac9d4fb6b9aaf1eb021e5 100644 (file)
@@ -14,7 +14,7 @@ class pget_bugTestCase(unittest.TestCase):
     db_name = 'test-cursor_pget.db'
 
     def setUp(self):
-        self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
+        self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
         try:
             os.mkdir(self.homeDir)
         except os.error:
@@ -39,7 +39,8 @@ class pget_bugTestCase(unittest.TestCase):
         del self.secondary_db
         del self.primary_db
         del self.env
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def test_pget(self):
         cursor = self.secondary_db.cursor()
index 22d46bc02804304916c94c098f01d878a8bf8178..2d0f916a879737fefecf6d11f2c469bfdb706076 100644 (file)
@@ -2,7 +2,6 @@
 import shutil
 import sys, os
 import unittest
-import glob
 import tempfile
 
 try:
@@ -20,14 +19,18 @@ class dbobjTestCase(unittest.TestCase):
     db_name = 'test-dbobj.db'
 
     def setUp(self):
-        self.homeDir = tempfile.mkdtemp()
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
+        self.homeDir = homeDir
+        try: os.mkdir(homeDir)
+        except os.error: pass
 
     def tearDown(self):
         if hasattr(self, 'db'):
             del self.db
         if hasattr(self, 'env'):
             del self.env
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def test01_both(self):
         class TestDBEnv(dbobj.DBEnv): pass
index 64cf59afd3b9fffa60e00fddee6e7acd1b156764..c66c7c17b2ec2f24e1afac230299efd9bbea868c 100644 (file)
@@ -262,6 +262,10 @@ class BasicEnvShelveTestCase(DBShelveTestCase):
         self.do_open()
 
     def do_open(self):
+        self.homeDir = homeDir = os.path.join(
+            tempfile.gettempdir(), 'db_home%d'%os.getpid())
+        try: os.mkdir(homeDir)
+        except os.error: pass
         self.env = db.DBEnv()
         self.env.open(self.homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE)
 
@@ -275,9 +279,9 @@ class BasicEnvShelveTestCase(DBShelveTestCase):
 
 
     def tearDown(self):
+        from test import test_support
+        test_support.rmtree(self.homeDir)
         self.do_close()
-        shutil.rmtree(self.homeDir)
-
 
 
 class EnvBTreeShelveTestCase(BasicEnvShelveTestCase):
index 149f3bd62b3f4ebf7ab22ce3f01cb218e2f8fca0..6c168bcfb98104119a2c82f70de01d54ac9651a2 100644 (file)
@@ -20,7 +20,6 @@
 #
 # $Id$
 
-import shutil
 import sys, os, re
 import pickle
 import tempfile
@@ -43,13 +42,18 @@ class TableDBTestCase(unittest.TestCase):
     db_name = 'test-table.db'
 
     def setUp(self):
-        self.homeDir = tempfile.mkdtemp()
+        homeDir = tempfile.mkdtemp()
+        self.testHomeDir = homeDir
+        try: os.mkdir(homeDir)
+        except os.error: pass
+
         self.tdb = dbtables.bsdTableDB(
-            filename='tabletest.db', dbhome=self.homeDir, create=1)
+            filename='tabletest.db', dbhome=homeDir, create=1)
 
     def tearDown(self):
         self.tdb.close()
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.testHomeDir)
 
     def test01(self):
         tabname = "test01"
index 2ef5867bc72c34dd08c71ec5bac5b0f91b5edd02..fa3adad9fef7ec91dea5ac84b2d8c9277928d081 100644 (file)
@@ -6,7 +6,6 @@ import os
 import shutil
 import sys
 import tempfile
-import glob
 import unittest
 
 try:
@@ -34,15 +33,16 @@ else:
 
 class DBEnvClosedEarlyCrash(unittest.TestCase):
     def setUp(self):
-        self.homeDir = tempfile.mkdtemp()
-        old_tempfile_tempdir = tempfile.tempdir
+        self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
+        try: os.mkdir(self.homeDir)
+        except os.error: pass
         tempfile.tempdir = self.homeDir
         self.filename = os.path.split(tempfile.mktemp())[1]
-        tempfile.tempdir = old_tempfile_tempdir
+        tempfile.tempdir = None
 
     def tearDown(self):
-        shutil.rmtree(self.homeDir)
-
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def test01_close_dbenv_before_db(self):
         dbenv = db.DBEnv()
index 5657bd79fc0ac2f28a47c245ab43c67b4f0a7c3d..07e7e0173b94788bce483d86d40d83d3cfd6545a 100644 (file)
@@ -48,13 +48,17 @@ class JoinTestCase(unittest.TestCase):
 
     def setUp(self):
         self.filename = self.__class__.__name__ + '.db'
-        self.homeDir = tempfile.mkdtemp()
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
+        self.homeDir = homeDir
+        try: os.mkdir(homeDir)
+        except os.error: pass
         self.env = db.DBEnv()
         self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK )
 
     def tearDown(self):
         self.env.close()
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def test01_join(self):
         if verbose:
index bbd88bdbea51991bc162377442357f6143e737de..ca521de38f0b06b4e1b85a63339f4cbdfcb6db80 100644 (file)
@@ -2,9 +2,6 @@
 TestCases for testing the locking sub-system.
 """
 
-import os
-from pprint import pprint
-import shutil
 import sys
 import tempfile
 import time
@@ -40,7 +37,8 @@ class LockingTestCase(unittest.TestCase):
 
     def tearDown(self):
         self.env.close()
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
 
     def test01_simple(self):
index b7a6710c2b9eb523d7152316523a68bf2030887f..5b9ab0a61b16b81c62e323561d252a623e5f29e8 100644 (file)
@@ -19,14 +19,17 @@ except ImportError:
 class MiscTestCase(unittest.TestCase):
     def setUp(self):
         self.filename = self.__class__.__name__ + '.db'
-        self.homeDir = tempfile.mkdtemp()
-
-    def tearDown(self):
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
+        self.homeDir = homeDir
         try:
-            os.remove(self.filename)
+            os.mkdir(homeDir)
         except OSError:
             pass
-        shutil.rmtree(self.homeDir)
+
+    def tearDown(self):
+        from test import test_support
+        test_support.unlink(self.filename)
+        test_support.rmtree(self.homeDir)
 
     def test01_badpointer(self):
         dbs = dbshelve.open(self.filename)
index 9b413c4dfe5ca5feedec7710e4873e93cff4827c..01a5c4565634df503d2683819c12666347f69326 100644 (file)
@@ -5,7 +5,6 @@ import pickle
 import tempfile
 import unittest
 import tempfile
-import glob
 
 try:
     # For Pythons w/distutils pybsddb
@@ -22,7 +21,7 @@ class pickleTestCase(unittest.TestCase):
     db_name = 'test-dbobj.db'
 
     def setUp(self):
-        homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
         self.homeDir = homeDir
         try: os.mkdir(homeDir)
         except os.error: pass
@@ -32,7 +31,8 @@ class pickleTestCase(unittest.TestCase):
             del self.db
         if hasattr(self, 'env'):
             del self.env
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def _base_test_pickle_DBError(self, pickle):
         self.env = db.DBEnv()
index e001b6371b1e8af79d547ab74024e46e02df462b..dc15ad1d99c21f2bca71de94ab71578caf1f6240 100644 (file)
@@ -26,14 +26,13 @@ letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 class SimpleRecnoTestCase(unittest.TestCase):
     def setUp(self):
         self.filename = tempfile.mktemp()
-        self.homeDir = tempfile.mkdtemp()
+        self.homeDir = None
 
     def tearDown(self):
-        try:
-            os.remove(self.filename)
-        except OSError as e:
-            if e.errno != errno.EEXIST: raise
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.unlink(self.filename)
+        if self.homeDir:
+            test_support.rmtree(self.homeDir)
 
     def test01_basic(self):
         d = db.DB()
@@ -206,7 +205,11 @@ class SimpleRecnoTestCase(unittest.TestCase):
         just a line in the file, but you can set a different record delimiter
         if needed.
         """
-        source = os.path.join(self.homeDir, 'test_recno.txt')
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
+        self.homeDir = homeDir
+        source = os.path.join(homeDir, 'test_recno.txt')
+        if not os.path.isdir(homeDir):
+            os.mkdir(homeDir)
         f = open(source, 'w') # create the file
         f.close()
 
index e630f1a58d116aeee0d66a97ca91c7572297675e..fa80e7c9150025b304f7b6bc5e2cdbc6e6ba5e14 100644 (file)
@@ -3,7 +3,6 @@ import os
 import shutil
 import sys
 import tempfile
-import glob
 
 try:
     # For Pythons w/distutils pybsddb
@@ -17,7 +16,7 @@ from bsddb.test.test_all import verbose
 class DBSequenceTest(unittest.TestCase):
     def setUp(self):
         self.int_32_max = 0x100000000
-        self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
+        self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
         try:
             os.mkdir(self.homeDir)
         except os.error:
@@ -42,7 +41,8 @@ class DBSequenceTest(unittest.TestCase):
             self.dbenv.close()
             del self.dbenv
 
-        shutil.rmtree(self.homeDir)
+        from test import test_support
+        test_support.rmtree(self.homeDir)
 
     def test_get(self):
         self.seq = db.DBSequence(self.d, flags=0)
index 20a643bed46da670bb1b641c65b18f2c1323670c..7397a505594203e468d8b589d58fe2f24728e392 100644 (file)
@@ -5,7 +5,6 @@ import os
 import sys
 import time
 import errno
-import shutil
 import tempfile
 from pprint import pprint
 from random import random
@@ -47,7 +46,7 @@ class BaseThreadedTestCase(unittest.TestCase):
         if verbose:
             dbutils._deadlock_VerboseFile = sys.stdout
 
-        homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
+        homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
         self.homeDir = homeDir
         try:
             os.mkdir(homeDir)
@@ -64,12 +63,10 @@ class BaseThreadedTestCase(unittest.TestCase):
         self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
 
     def tearDown(self):
+        from test import test_support
+        test_support.rmtree(self.homeDir)
         self.d.close()
         self.env.close()
-        try:
-            shutil.rmtree(self.homeDir)
-        except OSError as e:
-            if e.errno != errno.EEXIST: raise
 
     def setEnvOpts(self):
         pass
index 94a45684e8862c6c8fb3b3f6914e7892b7afa97f..2e89d29082892869f2b77534361fafbec51cb8e3 100644 (file)
@@ -5202,8 +5202,7 @@ ExtendedContext = Context(
 
 
 ##### crud for parsing strings #############################################
-import re
-
+#
 # Regular expression used for parsing numeric strings.  Additional
 # comments:
 #
index a88b1136f1b249b2e1987bc0343938db2d73a0c0..1f58c121c7d8a93f6a59a8cae994e6fa41d3123f 100644 (file)
@@ -2,11 +2,12 @@
 """
 Run all test cases.
 """
+import os
 import sys
+import tempfile
 import time
 import unittest
-import test.test_support
-from test.test_support import requires, run_unittest, unlink
+from test.test_support import requires, verbose, run_unittest, unlink, rmtree
 
 # When running as a script instead of within the regrtest framework, skip the
 # requires test, since it's obvious we want to run them.
@@ -88,6 +89,15 @@ def suite():
 # For invocation through regrtest
 def test_main():
     run_unittest(suite())
+    db_home = os.path.join(tempfile.gettempdir(), 'db_home')
+    # The only reason to remove db_home is in case if there is an old
+    # one lying around.  This might be by a different user, so just
+    # ignore errors.  We should always make a unique name now.
+    try:
+        rmtree(db_home)
+    except:
+        pass
+    rmtree('db_home%d' % os.getpid())
 
 # For invocation as a script
 if __name__ == '__main__':
index 7070286b38aad2401dfb2a8ec728ff9796ae2d69..53e7d04df4c4bcf8ff36264aa1ca45feb73d4e2b 100644 (file)
@@ -234,7 +234,8 @@ test_exc('abc %a', 1, ValueError,
 test_exc(str(b'abc %\u3000', 'raw-unicode-escape'), 1, ValueError,
          "unsupported format character '?' (0x3000) at index 5")
 
-test_exc('%d', '1', TypeError, "an integer is required")
+#test_exc('%d', '1', TypeError, "an integer is required")
+test_exc('%d', '1', TypeError, '%d format: a number is required, not str')
 test_exc('%g', '1', TypeError, "a float is required")
 test_exc('no format', '1', TypeError,
          "not all arguments converted during string formatting")
index ba36448ec8ad14713c49a1cf6eba6138ed93ecf1..4bc661945aa8bbf630a2c3a4c3e68a27e55a7bb3 100644 (file)
@@ -9,6 +9,7 @@ import socket
 import sys
 import os
 import os.path
+import shutil
 import warnings
 import unittest
 
@@ -64,6 +65,14 @@ def unlink(filename):
     except OSError:
         pass
 
+def rmtree(path):
+    try:
+        shutil.rmtree(path)
+    except OSError as e:
+        # Unix returns ENOENT, Windows returns ESRCH.
+        if e.errno not in (errno.ENOENT, errno.ESRCH):
+            raise
+
 def forget(modname):
     '''"Forget" a module was ever imported by removing it from sys.modules and
     deleting any .pyc and .pyo files.'''
index 91f791ded991007d58e2427ce80257227d01aa32..9e285bf0291df7e94633dbb8bab7d1e9ae9276f4 100644 (file)
@@ -518,28 +518,26 @@ Objects/unicodectype.o:   $(srcdir)/Objects/unicodectype.c \
                                $(srcdir)/Objects/unicodetype_db.h
 
 BYTESTR_DEPS = Include/bytes_methods.h \
-               $(srcdir)/Objects/stringlib/fastsearch.h \
                $(srcdir)/Objects/stringlib/count.h \
+               $(srcdir)/Objects/stringlib/ctype.h \
+               $(srcdir)/Objects/stringlib/eq.h \
+               $(srcdir)/Objects/stringlib/fastsearch.h \
                $(srcdir)/Objects/stringlib/find.h \
                $(srcdir)/Objects/stringlib/partition.h \
-               $(srcdir)/Objects/stringlib/ctype.h \
-               $(srcdir)/Objects/stringlib/transmogrify.h
+               $(srcdir)/Objects/stringlib/stringdefs.h \
+               $(srcdir)/Objects/stringlib/string_format.h \
+               $(srcdir)/Objects/stringlib/transmogrify.h \
+               $(srcdir)/Objects/stringlib/unicodedefs.h \
 
 Objects/stringobject.o: $(srcdir)/Objects/stringobject.c $(BYTESTR_DEPS)
 
 Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS) 
 
 Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
-                               $(srcdir)/Objects/stringlib/string_format.h \
-                               $(srcdir)/Objects/stringlib/unicodedefs.h \
-                               $(srcdir)/Objects/stringlib/fastsearch.h \
-                               $(srcdir)/Objects/stringlib/count.h \
-                               $(srcdir)/Objects/stringlib/find.h \
-                               $(srcdir)/Objects/stringlib/partition.h
+                                             $(BYTESTR_DEPS)
 
 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
-                               $(srcdir)/Objects/stringlib/formatter.h
-
+                                             $(BYTESTR_DEPS)
 
 
 ############################################################################
index 3365c4757c15394ba647d0d7171ab6896c03f74a..fc2c8f0fe374396b867b3ccc62dd2b07b9cb86d1 100644 (file)
@@ -172,8 +172,10 @@ static size_t count_reuse = 0;
 static void
 show_alloc(void)
 {
-       fprintf(stderr, "Dict allocations: %zd\n", count_alloc);
-       fprintf(stderr, "Dict reuse through freelist: %zd\n", count_reuse);
+       fprintf(stderr, "Dict allocations: %" PY_FORMAT_SIZE_T "d\n",
+               count_alloc);
+       fprintf(stderr, "Dict reuse through freelist: %" PY_FORMAT_SIZE_T
+               "d\n", count_reuse);
        fprintf(stderr, "%.2f%% reuse rate\n\n",
                (100.0*count_reuse/(count_alloc+count_reuse)));
 }
index d2917d2caa96921308e88665f1fc5aa36a0182c7..eec1c2248ceb611348de4997a5fbc15796b1cce2 100644 (file)
@@ -72,8 +72,10 @@ static size_t count_reuse = 0;
 static void
 show_alloc(void)
 {
-       fprintf(stderr, "List allocations: %zd\n", count_alloc);
-       fprintf(stderr, "List reuse through freelist: %zd\n", count_reuse);
+       fprintf(stderr, "List allocations: %" PY_FORMAT_SIZE_T "d\n",
+               count_alloc);
+       fprintf(stderr, "List reuse through freelist: %" PY_FORMAT_SIZE_T
+               "d\n", count_reuse);
        fprintf(stderr, "%.2f%% reuse rate\n\n",
                (100.0*count_reuse/(count_alloc+count_reuse)));
 }