diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-04 19:58:13 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-04 19:58:13 (GMT) |
commit | 4281cef2057e24384a1d59b6bcf9e9161fde26e8 (patch) | |
tree | e0fd65002e09aa925f4a4594586e2fb471775e5e /Python | |
parent | 9589ee276a7c863b137ee925e9e50745ef594b98 (diff) | |
download | cpython-4281cef2057e24384a1d59b6bcf9e9161fde26e8.zip cpython-4281cef2057e24384a1d59b6bcf9e9161fde26e8.tar.gz cpython-4281cef2057e24384a1d59b6bcf9e9161fde26e8.tar.bz2 |
Use Py_ssize_t for _Py_RefTotal.
I tried to handle Win64 properly, but please review.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonrun.c | 18 | ||||
-rw-r--r-- | Python/sysmodule.c | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 87418d8..3f934d6 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -29,6 +29,16 @@ #include "windows.h" #endif +#ifndef Py_REF_DEBUG +# define PRINT_TOTAL_REFS() +#else /* Py_REF_DEBUG */ +# if defined(MS_WIN64) +# define PRINT_TOTAL_REFS() fprintf(stderr, "[%zd refs]\n", _Py_RefTotal); +# else /* ! MS_WIN64 */ +# define PRINT_TOTAL_REFS() fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); +# endif /* MS_WIN64 */ +#endif + extern char *Py_GetPath(void); extern grammar _PyParser_Grammar; /* From graminit.c */ @@ -382,9 +392,7 @@ Py_Finalize(void) dump_counts(); #endif -#ifdef Py_REF_DEBUG - fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); -#endif + PRINT_TOTAL_REFS() #ifdef Py_TRACE_REFS /* Display all objects still alive -- this can invoke arbitrary @@ -674,9 +682,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag } for (;;) { ret = PyRun_InteractiveOneFlags(fp, filename, flags); -#ifdef Py_REF_DEBUG - fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); -#endif + PRINT_TOTAL_REFS() if (ret == E_EOF) return 0; /* diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 3219b1c..a33ac26 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -604,7 +604,7 @@ sys_getrefcount(PyObject *self, PyObject *arg) static PyObject * sys_gettotalrefcount(PyObject *self) { - return PyInt_FromLong(_Py_RefTotal); + return PyInt_FromSsize_t(_Py_RefTotal); } #endif /* Py_TRACE_REFS */ |