144144 # Variable so that display can be done in the correct Msg context
145145 execute_msg:: Msg = Msg ([" julia" ], Dict (" username" => " jlkernel" , " session" => uuid4 ()), Dict ())
146146 # Variable tracking the number of bytes written in the current execution request
147- stdio_bytes:: RefValue{ Int} = Ref ( 0 )
147+ stdio_bytes:: Int = 0
148148 # Use an array to accumulate "payloads" for the execute_reply message
149149 execute_payloads:: Vector{Dict} = Dict[]
150150
@@ -159,11 +159,16 @@ function Base.setproperty!(kernel::Kernel, name::Symbol, x)
159159 if name ∈ (:ans , :n , :In , :Out , :inited )
160160 setproperty! (IJulia, name, x)
161161
162+ # These fields are mirrored to the module the user code executes in, see
163+ # run_kernel().
162164 if name ∈ (:ans , :In , :Out )
163165 if hasproperty (kernel. current_module, name)
164166 setproperty! (kernel. current_module, name, x)
165167 end
166168 end
169+ elseif name === :stdio_bytes
170+ # These are Refs
171+ setindex! (getproperty (@__MODULE__ , name), x)
167172 end
168173
169174 setfield! (kernel, name, x)
@@ -324,6 +329,9 @@ ans::Any = nothing
324329"""
325330n:: Int = 0
326331
332+ # Deprecated internal kept around for backwards compatibility
333+ const stdio_bytes = Ref (0 )
334+
327335# ######################################################################
328336# methods to clear history or any subset thereof
329337
@@ -467,7 +475,7 @@ function clear_output(wait=false, kernel=_default_kernel)
467475 empty! (kernel. displayqueue) # discard pending display requests
468476 send_ipython (kernel. publish[], kernel, msg_pub (kernel. execute_msg:: Msg , " clear_output" ,
469477 Dict (" wait" => wait)))
470- kernel. stdio_bytes[] = 0 # reset output throttling
478+ kernel. stdio_bytes = 0 # reset output throttling
471479 return nothing
472480end
473481
0 commit comments