Rev 141: Possibly fixes bug #428165. in http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

John Arbash Meinel john at arbash-meinel.com
Thu May 20 15:09:03 BST 2010


At http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

------------------------------------------------------------
revno: 141
revision-id: john at arbash-meinel.com-20100520140853-ob49gh91dx1g2bhg
parent: john at arbash-meinel.com-20100129221938-y76dtsor0zwtbrxu
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Thu 2010-05-20 09:08:53 -0500
message:
  Possibly fixes bug #428165.
  
  I suppose it is possible that calling obj.flush()/obj.close() on the python
  object doesn't actually flush the underlying FILE* object as gotten by
  PyFile_AsFile. Anyway, we'll just call fflush() directly on the FILE handle
  we got.
-------------- next part --------------
=== modified file 'meliae/_scanner.pyx'
--- a/meliae/_scanner.pyx	2009-12-30 16:25:15 +0000
+++ b/meliae/_scanner.pyx	2010-05-20 14:08:53 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Canonical Ltd
+# Copyright (C) 2009, 2010 Canonical Ltd
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 3 as
@@ -21,6 +21,7 @@
     FILE *stderr
     size_t fwrite(void *, size_t, size_t, FILE *)
     size_t fprintf(FILE *, char *, ...)
+    void fflush(FILE *)
 
 cdef extern from "Python.h":
     FILE *PyFile_AsFile(object)
@@ -60,7 +61,7 @@
 
 cdef void _file_io_callback(void *callee_data, char *bytes, size_t len):
     cdef FILE *file_cb
-    
+
     file_cb = <FILE *>callee_data
     fwrite(bytes, 1, len, file_cb)
 
@@ -93,9 +94,9 @@
 
     fp_out = PyFile_AsFile(out)
     if fp_out != NULL:
-        # This must be a callable
         _dump_object_info(<write_callback>_file_io_callback, fp_out, obj,
                           nodump, recurse_depth)
+        fflush(fp_out)
     else:
         _dump_object_info(<write_callback>_callable_callback, <void *>out, obj,
                           nodump, recurse_depth)



More information about the bazaar-commits mailing list