mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
In format strings slinging Py_ssize_t, unconditionally
interpolate PY_FORMAT_SIZE_T instead of #if'ing on MS_WIN64.
This commit is contained in:
parent
efb6e752cf
commit
62e97f023b
2 changed files with 15 additions and 31 deletions
|
@ -413,7 +413,7 @@ has_finalizer(PyObject *op)
|
||||||
assert(delstr != NULL);
|
assert(delstr != NULL);
|
||||||
return _PyInstance_Lookup(op, delstr) != NULL;
|
return _PyInstance_Lookup(op, delstr) != NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return op->ob_type->tp_del != NULL;
|
return op->ob_type->tp_del != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,15 +741,9 @@ collect(int generation)
|
||||||
PySys_WriteStderr("gc: collecting generation %d...\n",
|
PySys_WriteStderr("gc: collecting generation %d...\n",
|
||||||
generation);
|
generation);
|
||||||
PySys_WriteStderr("gc: objects in each generation:");
|
PySys_WriteStderr("gc: objects in each generation:");
|
||||||
for (i = 0; i < NUM_GENERATIONS; i++) {
|
for (i = 0; i < NUM_GENERATIONS; i++)
|
||||||
#ifdef MS_WIN64
|
PySys_WriteStderr(" %" PY_FORMAT_SIZE_T "d",
|
||||||
PySys_WriteStderr(" %Id", gc_list_size(GEN_HEAD(i)));
|
gc_list_size(GEN_HEAD(i)));
|
||||||
#else
|
|
||||||
PySys_WriteStderr(" %ld",
|
|
||||||
Py_SAFE_DOWNCAST(gc_list_size(GEN_HEAD(i)),
|
|
||||||
Py_ssize_t, long));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
PySys_WriteStderr("\n");
|
PySys_WriteStderr("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -837,21 +831,14 @@ collect(int generation)
|
||||||
debug_cycle("uncollectable", FROM_GC(gc));
|
debug_cycle("uncollectable", FROM_GC(gc));
|
||||||
}
|
}
|
||||||
if (debug & DEBUG_STATS) {
|
if (debug & DEBUG_STATS) {
|
||||||
if (m == 0 && n == 0) {
|
if (m == 0 && n == 0)
|
||||||
PySys_WriteStderr("gc: done.\n");
|
PySys_WriteStderr("gc: done.\n");
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
#ifdef MS_WIN64
|
|
||||||
PySys_WriteStderr(
|
PySys_WriteStderr(
|
||||||
"gc: done, %Id unreachable, %Id uncollectable.\n",
|
"gc: done, "
|
||||||
|
"%" PY_FORMAT_SIZE_T "d unreachable, "
|
||||||
|
"%" PY_FORMAT_SIZE_T "d uncollectable.\n",
|
||||||
n+m, n);
|
n+m, n);
|
||||||
#else
|
|
||||||
PySys_WriteStderr(
|
|
||||||
"gc: done, %ld unreachable, %ld uncollectable.\n",
|
|
||||||
Py_SAFE_DOWNCAST(n+m, Py_ssize_t, long),
|
|
||||||
Py_SAFE_DOWNCAST(n, Py_ssize_t, long));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append instances in the uncollectable set to a Python
|
/* Append instances in the uncollectable set to a Python
|
||||||
|
|
|
@ -30,14 +30,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Py_REF_DEBUG
|
#ifndef Py_REF_DEBUG
|
||||||
# define PRINT_TOTAL_REFS()
|
#define PRINT_TOTAL_REFS()
|
||||||
#else /* Py_REF_DEBUG */
|
#else /* Py_REF_DEBUG */
|
||||||
# if defined(MS_WIN64)
|
#define PRINT_TOTAL_REFS() fprintf(stderr, \
|
||||||
# define PRINT_TOTAL_REFS() fprintf(stderr, "[%Id refs]\n", _Py_RefTotal);
|
"[%" PY_FORMAT_SIZE_T "d refs]\n", \
|
||||||
# else /* ! MS_WIN64 */
|
_Py_RefTotal)
|
||||||
# define PRINT_TOTAL_REFS() fprintf(stderr, "[%ld refs]\n", \
|
|
||||||
Py_SAFE_DOWNCAST(_Py_RefTotal, Py_ssize_t, long));
|
|
||||||
# endif /* MS_WIN64 */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char *Py_GetPath(void);
|
extern char *Py_GetPath(void);
|
||||||
|
@ -393,7 +390,7 @@ Py_Finalize(void)
|
||||||
dump_counts();
|
dump_counts();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRINT_TOTAL_REFS()
|
PRINT_TOTAL_REFS();
|
||||||
|
|
||||||
#ifdef Py_TRACE_REFS
|
#ifdef Py_TRACE_REFS
|
||||||
/* Display all objects still alive -- this can invoke arbitrary
|
/* Display all objects still alive -- this can invoke arbitrary
|
||||||
|
@ -683,7 +680,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ret = PyRun_InteractiveOneFlags(fp, filename, flags);
|
ret = PyRun_InteractiveOneFlags(fp, filename, flags);
|
||||||
PRINT_TOTAL_REFS()
|
PRINT_TOTAL_REFS();
|
||||||
if (ret == E_EOF)
|
if (ret == E_EOF)
|
||||||
return 0;
|
return 0;
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue