Skip to content

Commit 31a80a2

Browse files
committed
Fix #271
1 parent 71495c1 commit 31a80a2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/io.jl

+8-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,14 @@ function pyio_initialize()
8282
closed.get(self) = @with_ioraise(!isopen(pyio_jl(self)))
8383
encoding.get(self) = "UTF-8"
8484
fileno(self) = @with_ioraise(fd(pyio_jl(self)))
85-
flush(self) = @with_ioraise(flush(pyio_jl(self)))
85+
flush(self) = begin
86+
@with_ioraise begin
87+
io = pyio_jl(self)
88+
if method_exists(flush, Tuple{typeof(io)})
89+
flush(io)
90+
end
91+
end
92+
end
8693
isatty(self) = isa(pyio_jl(self), Base.TTY)
8794
readable(self) = isreadable(pyio_jl(self))
8895
writable(self) = iswritable(pyio_jl(self))

0 commit comments

Comments
 (0)