@@ -315,7 +315,7 @@ function pyinitialize(libpy::Ptr{Void})
315315 py_void_p:: Function = p:: Ptr -> PyObject (ccall (pycobject_new, PyPtr, (Ptr{Void}, Ptr{Void}), p, C_NULL ))
316316 end
317317 pyversion:: VersionNumber =
318- VersionNumber (convert ((Int,Int,Int,String ,Int),
318+ VersionNumber (convert ((Int,Int,Int,AbstractString ,Int),
319319 pyimport (" sys" )[" version_info" ])[1 : 3 ]. .. )
320320 pyhashlong:: Bool = pyversion:: VersionNumber < v " 3.2"
321321 pyunicode_literals:: Bool = pyversion:: VersionNumber >= v " 3.0"
@@ -348,16 +348,16 @@ function pyinitialize(libpy::Ptr{Void})
348348 return
349349end
350350
351- pyconfigvar (python:: String , var:: String ) = chomp (readall (` $python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('$var '))"` ))
352- pysys (python:: String , var:: String ) = chomp (readall (` $python -c "import sys; print(sys.$var )"` ))
351+ pyconfigvar (python:: AbstractString , var:: AbstractString ) = chomp (readall (` $python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('$var '))"` ))
352+ pysys (python:: AbstractString , var:: AbstractString ) = chomp (readall (` $python -c "import sys; print(sys.$var )"` ))
353353pyconfigvar (python, var, default) = let v = pyconfigvar (python, var)
354354 v == " None" ? default : v
355355end
356356
357357const dlext = isdefined (Sys, :dlext ) ? Sys. dlext : Sys. shlib_ext
358358const dlprefix = @windows ? " " : " lib"
359359
360- function dlopen_libpython (python:: String )
360+ function dlopen_libpython (python:: AbstractString )
361361 # it is ridiculous that it is this hard to find the name of libpython
362362 v = pyconfigvar (python," VERSION" ," " )
363363 libs = [ dlprefix* " python" * v* " ." * dlext, dlprefix* " python." * dlext ]
@@ -417,7 +417,7 @@ function dlopen_libpython(python::String)
417417end
418418
419419# Python 3.x uses wchar_t arrays for some string arguments
420- function wbytestring (s:: String )
420+ function wbytestring (s:: AbstractString )
421421 if pyversion. major < 3 || sizeof (Cwchar_t) == 1 # ASCII (or UTF8)
422422 bytestring (s)
423423 else # UTF16 or UTF32, presumably
@@ -451,7 +451,7 @@ function wbytestring(s::String)
451451end
452452
453453# initialize the Python interpreter (no-op on subsequent calls)
454- function pyinitialize (python:: String )
454+ function pyinitialize (python:: AbstractString )
455455 global initialized
456456 if ! initialized:: Bool
457457 libpy = try
@@ -559,7 +559,7 @@ function pystring(o::PyObject)
559559 return string (o. o)
560560 end
561561 end
562- return convert (String , PyObject (s))
562+ return convert (AbstractString , PyObject (s))
563563 end
564564end
565565
@@ -631,7 +631,7 @@ isequal(o1::PyObject, o2::PyObject) = o1 == o2 # Julia 0.2 compatibility
631631# with the former returning an raw PyObject and the latter giving the PyAny
632632# conversion.
633633
634- function getindex (o:: PyObject , s:: String )
634+ function getindex (o:: PyObject , s:: AbstractString )
635635 if (o. o == C_NULL )
636636 throw (ArgumentError (" ref of NULL PyObject" ))
637637 end
646646
647647getindex (o:: PyObject , s:: Symbol ) = convert (PyAny, getindex (o, string (s)))
648648
649- function setindex! (o:: PyObject , v, s:: String )
649+ function setindex! (o:: PyObject , v, s:: AbstractString )
650650 if (o. o == C_NULL )
651651 throw (ArgumentError (" assign of NULL PyObject" ))
652652 end
660660
661661setindex! (o:: PyObject , v, s:: Symbol ) = setindex! (o, v, string (s))
662662
663- function haskey (o:: PyObject , s:: String )
663+ function haskey (o:: PyObject , s:: AbstractString )
664664 if (o. o == C_NULL )
665665 throw (ArgumentError (" haskey of NULL PyObject" ))
666666 end
706706
707707function pywrap (o:: PyObject , mname:: Symbol = :__anon__ )
708708 @pyinitialize
709- members = convert (Vector{(String ,PyObject)},
709+ members = convert (Vector{(AbstractString ,PyObject)},
710710 pycall (inspect[" getmembers" ], PyObject, o))
711711 filter! (m -> ! (m[1 ] in reserved), members)
712712 m = Module (mname)
723723
724724# ########################################################################
725725
726- pyimport (name:: String ) =
726+ pyimport (name:: AbstractString ) =
727727 PyObject (@pycheckn ccall ((@pysym :PyImport_ImportModule ), PyPtr,
728728 (Ptr{Uint8},), bytestring (name)))
729729
@@ -805,7 +805,7 @@ function pycall(o::PyObject, returntype::TypeTuple, args...; kwargs...)
805805 ret = PyObject (@pycheckni ccall ((@pysym :PyObject_Call ), PyPtr,
806806 (PyPtr,PyPtr,PyPtr), o, arg, C_NULL ))
807807 else
808- kw = PyObject ((String => Any)[string (k) => v for (k, v) in kwargs])
808+ kw = PyObject ((AbstractString => Any)[string (k) => v for (k, v) in kwargs])
809809 ret = PyObject (@pycheckni ccall ((@pysym :PyObject_Call ), PyPtr,
810810 (PyPtr,PyPtr,PyPtr), o, arg, kw))
811811 end
@@ -859,7 +859,7 @@ for (mime, method) in ((MIME"text/html", "_repr_html_"),
859859 (MIME " image/png" , " _repr_png_" ),
860860 (MIME " image/svg+xml" , " _repr_svg_" ),
861861 (MIME " text/latex" , " _repr_latex_" ))
862- T = istext (mime ()) ? String : Vector{Uint8}
862+ T = istext (mime ()) ? AbstractString : Vector{Uint8}
863863 @eval begin
864864 function writemime (io:: IO , mime:: $mime , o:: PyObject )
865865 if o. o != C_NULL && haskey (o, $ method)
@@ -881,7 +881,7 @@ const pyeval_fname = bytestring("PyCall.jl") # filename for pyeval
881881
882882# evaluate a python string, returning PyObject, given a dictionary
883883# (string/symbol => value) of local variables to use in the expression
884- function pyeval_ (s:: String , locals:: PyDict )
884+ function pyeval_ (s:: AbstractString , locals:: PyDict )
885885 sb = bytestring (s) # use temp var to prevent gc before we are done with o
886886 sigatomic_begin ()
887887 try
@@ -901,8 +901,8 @@ function pyeval_(s::String, locals::PyDict)
901901 end
902902end
903903
904- function pyeval (s:: String , returntype:: TypeTuple = PyAny; kwargs... )
905- locals = PyDict {String ,PyObject} ()
904+ function pyeval (s:: AbstractString , returntype:: TypeTuple = PyAny; kwargs... )
905+ locals = PyDict {AbstractString ,PyObject} ()
906906 for (k, v) in kwargs
907907 locals[string (k)] = v
908908 end
0 commit comments