Rev 70: Switch to using %ld for Py_ssize_t, since it is more like a 'long' than an 'int' in http://bazaar.launchpad.net/~jameinel/meliae/trunk

John Arbash Meinel john at arbash-meinel.com
Thu Sep 10 22:04:44 BST 2009


At http://bazaar.launchpad.net/~jameinel/meliae/trunk

------------------------------------------------------------
revno: 70
revision-id: john at arbash-meinel.com-20090910210429-l3sukso76pxqp1we
parent: john at arbash-meinel.com-20090910195057-j7eclwh1koue8j4b
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Thu 2009-09-10 16:04:29 -0500
message:
  Switch to using %ld for Py_ssize_t, since it is more like a 'long' than an 'int'
-------------- next part --------------
=== modified file 'meliae/_scanner_core.c'
--- a/meliae/_scanner_core.c	2009-09-10 19:50:57 +0000
+++ b/meliae/_scanner_core.c	2009-09-10 21:04:29 +0000
@@ -265,7 +265,7 @@
     size = _size_of(c_obj);
     fprintf(out, "{\"address\": %lu, \"type\": ", (unsigned long)c_obj);
     _dump_json_c_string(out, c_obj->ob_type->tp_name, -1);
-    fprintf(out, ", \"size\": %d", _size_of(c_obj));
+    fprintf(out, ", \"size\": %ld", _size_of(c_obj));
     //  HANDLE __name__
     if (PyModule_Check(c_obj)) {
         fprintf(out, ", \"name\": ");
@@ -282,23 +282,23 @@
         _dump_string(out, ((PyClassObject *)c_obj)->cl_name);
     }
     if (PyString_Check(c_obj)) {
-        fprintf(out, ", \"len\": %d", PyString_GET_SIZE(c_obj));
+        fprintf(out, ", \"len\": %ld", PyString_GET_SIZE(c_obj));
         fprintf(out, ", \"value\": ");
         _dump_string(out, c_obj);
     } else if (PyUnicode_Check(c_obj)) {
-        fprintf(out, ", \"len\": %d", PyUnicode_GET_SIZE(c_obj));
+        fprintf(out, ", \"len\": %ld", PyUnicode_GET_SIZE(c_obj));
         fprintf(out, ", \"value\": ");
         _dump_unicode(out, c_obj);
     } else if (PyInt_CheckExact(c_obj)) {
         fprintf(out, ", \"value\": %ld", PyInt_AS_LONG(c_obj));
     } else if (PyTuple_Check(c_obj)) {
-        fprintf(out, ", \"len\": %d", PyTuple_GET_SIZE(c_obj));
+        fprintf(out, ", \"len\": %ld", PyTuple_GET_SIZE(c_obj));
     } else if (PyList_Check(c_obj)) {
-        fprintf(out, ", \"len\": %d", PyList_GET_SIZE(c_obj));
+        fprintf(out, ", \"len\": %ld", PyList_GET_SIZE(c_obj));
     } else if (PyAnySet_Check(c_obj)) {
-        fprintf(out, ", \"len\": %d", PySet_GET_SIZE(c_obj));
+        fprintf(out, ", \"len\": %ld", PySet_GET_SIZE(c_obj));
     } else if (PyDict_Check(c_obj)) {
-        fprintf(out, ", \"len\": %d", PyDict_Size(c_obj));
+        fprintf(out, ", \"len\": %ld", PyDict_Size(c_obj));
     }
     fprintf(out, ", \"refs\": [");
     if (Py_TYPE(c_obj)->tp_traverse != NULL) {



More information about the bazaar-commits mailing list