diff --git a/src/Core/Py.jl b/src/Core/Py.jl index 396b39d8..9e5fb425 100644 --- a/src/Core/Py.jl +++ b/src/Core/Py.jl @@ -174,6 +174,14 @@ function Base.show(io::IO, x::Py) end end +printPyPrefix = true + +function printPyPrefix!(printPrefix::Bool=true) + global printPyPrefix = printPrefix + return printPyPrefix +end +export printPyPrefix! + function Base.show(io::IO, ::MIME"text/plain", o::Py) if pyisnull(o) str = "NULL" @@ -184,7 +192,7 @@ function Base.show(io::IO, ::MIME"text/plain", o::Py) compact = get(io, :compact, false)::Bool multiline = '\n' in str prefix = hasprefix ? compact ? "Py:$(multiline ? '\n' : ' ')" : "Python:$(multiline ? '\n' : ' ')" : "" - print(io, prefix) + printPyPrefix && print(io, prefix) h, w = displaysize(io) if get(io, :limit, true) h, w = displaysize(io) diff --git a/src/PythonCall.jl b/src/PythonCall.jl index fdd1774f..65869894 100644 --- a/src/PythonCall.jl +++ b/src/PythonCall.jl @@ -27,7 +27,7 @@ end for k in [:python_executable_path, :python_library_path, :python_library_handle, :python_version] @eval using .C: $k end -for k in [:pynew, :pyisnull, :pycopy!, :getptr, :pydel!, :unsafe_pynext, :PyNULL, :CONFIG] +for k in [:pynew, :pyisnull, :pycopy!, :getptr, :pydel!, :unsafe_pynext, :PyNULL, :CONFIG, :printPyPrefix!] @eval using .Core: $k end for k in [:pyconvert_add_rule, :pyconvert_return, :pyconvert_unconverted, :PYCONVERT_PRIORITY_WRAP, :PYCONVERT_PRIORITY_ARRAY, :PYCONVERT_PRIORITY_CANONICAL, :PYCONVERT_PRIORITY_NORMAL, :PYCONVERT_PRIORITY_FALLBACK]