File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/libpython_clj2/python Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1010 [clojure.tools.logging :as log])
1111 (:import [java.io Writer]))
1212
13+ (set! *warn-on-reflection* true )
14+
1315
1416(defn self->writer
1517 ^Writer [self]
3234 (py-ffi/py-none ))
3335 {:arg-converter identity})
3436 " flush" (py-class/make-tuple-instance-fn
35- (constantly (py-ffi/py-none )))
37+ (fn [self & args] (.flush (self->writer self)) (py-ffi/py-none ))
38+ {:arg-converter identity} ; ;avoid paying anything for argument conversion
39+ )
3640 " isatty" (py-class/make-tuple-instance-fn
3741 (constantly (py-ffi/py-false )))})))
3842
5357 []
5458 (setup-std-writer #'*err* " stderr" )
5559 (setup-std-writer #'*out* " stdout" ))
60+
61+
62+ (comment
63+ ; ;Ensure flush works
64+ (require '[libpython-clj2.python :as py])
65+ (py/initialize! )
66+ (def _ )
67+ (def _ (py/run-simple-string " import sys\n import time" ))
68+ (py/run-simple-string " for i in range(10):
69+ \t time.sleep(1)
70+ \t sys.stderr.write('#')
71+ \t sys.stdout.flush()" )
72+ )
You can’t perform that action at this time.
0 commit comments