@@ -138,9 +138,11 @@ _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op)
138138{
139139 char buf [300 ];
140140
141+ /* XXX(twouters) cast refcount to long until %zd is universally
142+ available */
141143 PyOS_snprintf (buf , sizeof (buf ),
142- "%s:%i object at %p has negative ref count %i " ,
143- fname , lineno , op , op -> ob_refcnt );
144+ "%s:%i object at %p has negative ref count %ld " ,
145+ fname , lineno , op , ( long ) op -> ob_refcnt );
144146 Py_FatalError (buf );
145147}
146148
@@ -233,8 +235,10 @@ internal_print(PyObject *op, FILE *fp, int flags, int nesting)
233235 }
234236 else {
235237 if (op -> ob_refcnt <= 0 )
236- fprintf (fp , "<refcnt %u at %p>" ,
237- op -> ob_refcnt , op );
238+ /* XXX(twouters) cast refcount to long until %zd is
239+ universally available */
240+ fprintf (fp , "<refcnt %ld at %p>" ,
241+ (long )op -> ob_refcnt , op );
238242 else if (op -> ob_type -> tp_print == NULL ) {
239243 PyObject * s ;
240244 if (flags & Py_PRINT_RAW )
@@ -277,12 +281,14 @@ void _PyObject_Dump(PyObject* op)
277281 else {
278282 fprintf (stderr , "object : " );
279283 (void )PyObject_Print (op , stderr , 0 );
284+ /* XXX(twouters) cast refcount to long until %zd is
285+ universally available */
280286 fprintf (stderr , "\n"
281287 "type : %s\n"
282- "refcount: %d \n"
288+ "refcount: %ld \n"
283289 "address : %p\n" ,
284290 op -> ob_type == NULL ? "NULL" : op -> ob_type -> tp_name ,
285- op -> ob_refcnt ,
291+ ( long ) op -> ob_refcnt ,
286292 op );
287293 }
288294}
@@ -1893,7 +1899,9 @@ _Py_PrintReferences(FILE *fp)
18931899 PyObject * op ;
18941900 fprintf (fp , "Remaining objects:\n" );
18951901 for (op = refchain ._ob_next ; op != & refchain ; op = op -> _ob_next ) {
1896- fprintf (fp , "%p [%d] " , op , op -> ob_refcnt );
1902+ /* XXX(twouters) cast refcount to long until %zd is
1903+ universally available */
1904+ fprintf (fp , "%p [%ld] " , op , (long )op -> ob_refcnt );
18971905 if (PyObject_Print (op , fp , 0 ) != 0 )
18981906 PyErr_Clear ();
18991907 putc ('\n' , fp );
@@ -1909,7 +1917,9 @@ _Py_PrintReferenceAddresses(FILE *fp)
19091917 PyObject * op ;
19101918 fprintf (fp , "Remaining object addresses:\n" );
19111919 for (op = refchain ._ob_next ; op != & refchain ; op = op -> _ob_next )
1912- fprintf (fp , "%p [%d] %s\n" , op , op -> ob_refcnt ,
1920+ /* XXX(twouters) cast refcount to long until %zd is
1921+ universally available */
1922+ fprintf (fp , "%p [%ld] %s\n" , op , (long )op -> ob_refcnt ,
19131923 op -> ob_type -> tp_name );
19141924}
19151925
0 commit comments