comparison Python/pythonrun.c @ 37290:89142cadcfb9 legacy-trunk

In format strings slinging Py_ssize_t, unconditionally interpolate PY_FORMAT_SIZE_T instead of #if'ing on MS_WIN64.
author Tim Peters <tim.peters@gmail.com>
date Tue, 28 Mar 2006 21:44:32 +0000
parents 6e1a899cac8e
children 57b1ff138995
comparison
equal deleted inserted replaced
37289:437d276c732c 37290:89142cadcfb9
28 #undef BYTE 28 #undef BYTE
29 #include "windows.h" 29 #include "windows.h"
30 #endif 30 #endif
31 31
32 #ifndef Py_REF_DEBUG 32 #ifndef Py_REF_DEBUG
33 # define PRINT_TOTAL_REFS() 33 #define PRINT_TOTAL_REFS()
34 #else /* Py_REF_DEBUG */ 34 #else /* Py_REF_DEBUG */
35 # if defined(MS_WIN64) 35 #define PRINT_TOTAL_REFS() fprintf(stderr, \
36 # define PRINT_TOTAL_REFS() fprintf(stderr, "[%Id refs]\n", _Py_RefTotal); 36 "[%" PY_FORMAT_SIZE_T "d refs]\n", \
37 # else /* ! MS_WIN64 */ 37 _Py_RefTotal)
38 # define PRINT_TOTAL_REFS() fprintf(stderr, "[%ld refs]\n", \
39 Py_SAFE_DOWNCAST(_Py_RefTotal, Py_ssize_t, long));
40 # endif /* MS_WIN64 */
41 #endif 38 #endif
42 39
43 extern char *Py_GetPath(void); 40 extern char *Py_GetPath(void);
44 41
45 extern grammar _PyParser_Grammar; /* From graminit.c */ 42 extern grammar _PyParser_Grammar; /* From graminit.c */
391 /* Debugging stuff */ 388 /* Debugging stuff */
392 #ifdef COUNT_ALLOCS 389 #ifdef COUNT_ALLOCS
393 dump_counts(); 390 dump_counts();
394 #endif 391 #endif
395 392
396 PRINT_TOTAL_REFS() 393 PRINT_TOTAL_REFS();
397 394
398 #ifdef Py_TRACE_REFS 395 #ifdef Py_TRACE_REFS
399 /* Display all objects still alive -- this can invoke arbitrary 396 /* Display all objects still alive -- this can invoke arbitrary
400 * __repr__ overrides, so requires a mostly-intact interpreter. 397 * __repr__ overrides, so requires a mostly-intact interpreter.
401 * Alas, a lot of stuff may still be alive now that will be cleaned 398 * Alas, a lot of stuff may still be alive now that will be cleaned
681 PySys_SetObject("ps2", v = PyString_FromString("... ")); 678 PySys_SetObject("ps2", v = PyString_FromString("... "));
682 Py_XDECREF(v); 679 Py_XDECREF(v);
683 } 680 }
684 for (;;) { 681 for (;;) {
685 ret = PyRun_InteractiveOneFlags(fp, filename, flags); 682 ret = PyRun_InteractiveOneFlags(fp, filename, flags);
686 PRINT_TOTAL_REFS() 683 PRINT_TOTAL_REFS();
687 if (ret == E_EOF) 684 if (ret == E_EOF)
688 return 0; 685 return 0;
689 /* 686 /*
690 if (ret == E_NOMEM) 687 if (ret == E_NOMEM)
691 return -1; 688 return -1;