Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 36837:3a3aed49b245 legacy-trunk
Use Py_ssize_t for _Py_RefTotal.
I tried to handle Win64 properly, but please review.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sat, 04 Mar 2006 19:58:13 +0000 |
| parents | 01bc8ee3d2ff |
| children | 4284b3324ce2 |
comparison
equal
deleted
inserted
replaced
| 36836:01bc8ee3d2ff | 36837:3a3aed49b245 |
|---|---|
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #ifdef MS_WINDOWS | 27 #ifdef MS_WINDOWS |
| 28 #undef BYTE | 28 #undef BYTE |
| 29 #include "windows.h" | 29 #include "windows.h" |
| 30 #endif | |
| 31 | |
| 32 #ifndef Py_REF_DEBUG | |
| 33 # define PRINT_TOTAL_REFS() | |
| 34 #else /* Py_REF_DEBUG */ | |
| 35 # if defined(MS_WIN64) | |
| 36 # define PRINT_TOTAL_REFS() fprintf(stderr, "[%zd refs]\n", _Py_RefTotal); | |
| 37 # else /* ! MS_WIN64 */ | |
| 38 # define PRINT_TOTAL_REFS() fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); | |
| 39 # endif /* MS_WIN64 */ | |
| 30 #endif | 40 #endif |
| 31 | 41 |
| 32 extern char *Py_GetPath(void); | 42 extern char *Py_GetPath(void); |
| 33 | 43 |
| 34 extern grammar _PyParser_Grammar; /* From graminit.c */ | 44 extern grammar _PyParser_Grammar; /* From graminit.c */ |
| 380 /* Debugging stuff */ | 390 /* Debugging stuff */ |
| 381 #ifdef COUNT_ALLOCS | 391 #ifdef COUNT_ALLOCS |
| 382 dump_counts(); | 392 dump_counts(); |
| 383 #endif | 393 #endif |
| 384 | 394 |
| 385 #ifdef Py_REF_DEBUG | 395 PRINT_TOTAL_REFS() |
| 386 fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); | |
| 387 #endif | |
| 388 | 396 |
| 389 #ifdef Py_TRACE_REFS | 397 #ifdef Py_TRACE_REFS |
| 390 /* Display all objects still alive -- this can invoke arbitrary | 398 /* Display all objects still alive -- this can invoke arbitrary |
| 391 * __repr__ overrides, so requires a mostly-intact interpreter. | 399 * __repr__ overrides, so requires a mostly-intact interpreter. |
| 392 * Alas, a lot of stuff may still be alive now that will be cleaned | 400 * Alas, a lot of stuff may still be alive now that will be cleaned |
| 672 PySys_SetObject("ps2", v = PyString_FromString("... ")); | 680 PySys_SetObject("ps2", v = PyString_FromString("... ")); |
| 673 Py_XDECREF(v); | 681 Py_XDECREF(v); |
| 674 } | 682 } |
| 675 for (;;) { | 683 for (;;) { |
| 676 ret = PyRun_InteractiveOneFlags(fp, filename, flags); | 684 ret = PyRun_InteractiveOneFlags(fp, filename, flags); |
| 677 #ifdef Py_REF_DEBUG | 685 PRINT_TOTAL_REFS() |
| 678 fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); | |
| 679 #endif | |
| 680 if (ret == E_EOF) | 686 if (ret == E_EOF) |
| 681 return 0; | 687 return 0; |
| 682 /* | 688 /* |
| 683 if (ret == E_NOMEM) | 689 if (ret == E_NOMEM) |
| 684 return -1; | 690 return -1; |
