summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-01-07 18:40:40 +0000
committerMartin v. Löwis <martin@v.loewis.de>2009-01-07 18:40:40 +0000
commitb90304acb9a766a3f2de76789e9b523cd032440b (patch)
tree00cfaf84129cae9627afe86d23c62e67dd12efd9
parente6dc53120d52f58057fd1a6d666d21cb9d71c08d (diff)
downloadcpython-git-b90304acb9a766a3f2de76789e9b523cd032440b.tar.gz
Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t.
-rw-r--r--Misc/NEWS2
-rw-r--r--Objects/intobject.c3
-rw-r--r--Objects/object.c21
-rw-r--r--Objects/stringobject.c2
-rw-r--r--Objects/tupleobject.c4
5 files changed, 20 insertions, 12 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index cd6bec67c5..7a903d2cba 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.7 alpha 1
Core and Builtins
-----------------
+- Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t.
+
- Issue #1180193: When importing a module from a .pyc (or .pyo) file with
an existing .py counterpart, override the co_filename attributes of all
code objects if the original filename is obsolete (which can happen if the
diff --git a/Objects/intobject.c b/Objects/intobject.c
index 9baee8e0f7..d4532f49a6 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -78,7 +78,8 @@ fill_free_list(void)
static PyIntObject *small_ints[NSMALLNEGINTS + NSMALLPOSINTS];
#endif
#ifdef COUNT_ALLOCS
-int quick_int_allocs, quick_neg_int_allocs;
+Py_ssize_t quick_int_allocs;
+Py_ssize_t quick_neg_int_allocs;
#endif
PyObject *
diff --git a/Objects/object.c b/Objects/object.c
index 7b82db9d43..1e0db4ac69 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -81,24 +81,29 @@ static PyTypeObject *type_list;
garbage itself. If unlist_types_without_objects
is set, they will be removed from the type_list
once the last object is deallocated. */
-int unlist_types_without_objects;
-extern int tuple_zero_allocs, fast_tuple_allocs;
-extern int quick_int_allocs, quick_neg_int_allocs;
-extern int null_strings, one_strings;
+static int unlist_types_without_objects;
+extern Py_ssize_t tuple_zero_allocs, fast_tuple_allocs;
+extern Py_ssize_t quick_int_allocs, quick_neg_int_allocs;
+extern Py_ssize_t null_strings, one_strings;
void
dump_counts(FILE* f)
{
PyTypeObject *tp;
for (tp = type_list; tp; tp = tp->tp_next)
- fprintf(f, "%s alloc'd: %d, freed: %d, max in use: %d\n",
+ fprintf(f, "%s alloc'd: %" PY_FORMAT_SIZE_T "d, "
+ "freed: %" PY_FORMAT_SIZE_T "d, "
+ "max in use: %" PY_FORMAT_SIZE_T "d\n",
tp->tp_name, tp->tp_allocs, tp->tp_frees,
tp->tp_maxalloc);
- fprintf(f, "fast tuple allocs: %d, empty: %d\n",
+ fprintf(f, "fast tuple allocs: %" PY_FORMAT_SIZE_T "d, "
+ "empty: %" PY_FORMAT_SIZE_T "d\n",
fast_tuple_allocs, tuple_zero_allocs);
- fprintf(f, "fast int allocs: pos: %d, neg: %d\n",
+ fprintf(f, "fast int allocs: pos: %" PY_FORMAT_SIZE_T "d, "
+ "neg: %" PY_FORMAT_SIZE_T "d\n",
quick_int_allocs, quick_neg_int_allocs);
- fprintf(f, "null strings: %d, 1-strings: %d\n",
+ fprintf(f, "null strings: %" PY_FORMAT_SIZE_T "d, "
+ "1-strings: %" PY_FORMAT_SIZE_T "d\n",
null_strings, one_strings);
}
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 2c365fb879..8f82f4f48e 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -7,7 +7,7 @@
#include <stddef.h>
#ifdef COUNT_ALLOCS
-int null_strings, one_strings;
+Py_ssize_t null_strings, one_strings;
#endif
static PyStringObject *characters[UCHAR_MAX + 1];
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index b1a7003cec..d7cb25aaf6 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -19,8 +19,8 @@ static PyTupleObject *free_list[PyTuple_MAXSAVESIZE];
static int numfree[PyTuple_MAXSAVESIZE];
#endif
#ifdef COUNT_ALLOCS
-int fast_tuple_allocs;
-int tuple_zero_allocs;
+Py_ssize_t fast_tuple_allocs;
+Py_ssize_t tuple_zero_allocs;
#endif
PyObject *