@@ -1805,7 +1805,7 @@ TPythonEngine = class(TPythonInterface)
18051805 { String conversion }
18061806 function PyUnicodeFromString (const AString : UnicodeString) : PPyObject; overload;
18071807 function PyUnicodeFromString (const AString: AnsiString): PPyObject; overload;
1808- function PyUnicode_AsWideString ( obj : PPyObject ) : UnicodeString;
1808+ function PyUnicodeAsString ( obj : PPyObject ) : UnicodeString;
18091809
18101810 // Public Properties
18111811 property ClientCount : Integer read GetClientCount;
@@ -4583,15 +4583,15 @@ procedure TPythonEngine.RaiseError;
45834583 tmp := PyObject_GetAttrString(err_value, ' filename' );
45844584 if tmp <> nil then begin
45854585 if PyUnicode_Check(tmp) then
4586- s_filename := PyUnicode_AsWideString (tmp)
4586+ s_filename := PyUnicodeAsString (tmp)
45874587 else if tmp = Py_None then
45884588 s_filename := ' ???' ;
45894589 Py_XDECREF(tmp);
45904590 end ;
45914591 // Get the text containing the error, cut of carriage return
45924592 tmp := PyObject_GetAttrString(err_value, ' text' );
45934593 if Assigned(tmp) and PyUnicode_Check(tmp) then
4594- s_line := Trim(PyUnicode_AsWideString (tmp));
4594+ s_line := Trim(PyUnicodeAsString (tmp));
45954595 Py_XDECREF(tmp);
45964596 // Get the offset where the error should appear
45974597 tmp := PyObject_GetAttrString(err_value, ' offset' );
@@ -4606,7 +4606,7 @@ procedure TPythonEngine.RaiseError;
46064606 // Get the message of the error
46074607 tmp := PyObject_GetAttrString(err_value, ' msg' );
46084608 if Assigned(tmp) and PyUnicode_Check(tmp) then
4609- s_value := PyUnicode_AsWideString (tmp);
4609+ s_value := PyUnicodeAsString (tmp);
46104610 Py_XDECREF(tmp);
46114611 end ;
46124612 // If all is ok
@@ -4756,13 +4756,13 @@ function TPythonEngine.PyObjectAsString( obj : PPyObject ) : string;
47564756
47574757 if PyUnicode_Check(obj) then
47584758 begin
4759- W := PyUnicode_AsWideString (obj);
4759+ W := PyUnicodeAsString (obj);
47604760 Result := string(W);
47614761 Exit;
47624762 end ;
47634763 S := PyObject_Str( obj );
47644764 if Assigned(S) and PyUnicode_Check(S) then
4765- Result := PyUnicode_AsWideString (S);
4765+ Result := PyUnicodeAsString (S);
47664766 Py_XDECREF(S);
47674767end ;
47684768
@@ -5205,7 +5205,7 @@ function TPythonEngine.PyObjectAsVariant( obj : PPyObject ) : Variant;
52055205 else if PyLong_Check(obj) then
52065206 Result := PyLong_AsLongLong(obj)
52075207 else if PyUnicode_Check(obj) then
5208- Result := PyUnicode_AsWideString (obj)
5208+ Result := PyUnicodeAsString (obj)
52095209 else if PyBytes_Check(obj) then
52105210 Result := AnsiString(PyBytes_AsString(obj))
52115211 else if ExtractDate( Result ) then
@@ -5476,7 +5476,7 @@ procedure TPythonEngine.PyTupleToStrings( tuple: PPyObject; strings : TStrings )
54765476 strings.Add( PyObjectAsString( PyTuple_GetItem( tuple, i ) ) );
54775477end ;
54785478
5479- function TPythonEngine.PyUnicode_AsWideString ( obj : PPyObject ) : UnicodeString;
5479+ function TPythonEngine.PyUnicodeAsString ( obj : PPyObject ) : UnicodeString;
54805480var
54815481 _size : Integer;
54825482{ $IFDEF POSIX}
@@ -5507,7 +5507,7 @@ function TPythonEngine.PyUnicode_AsWideString( obj : PPyObject ) : UnicodeString
55075507 Result := ' ' ;
55085508 end
55095509 else
5510- raise EPythonError.Create(' PyUnicode_AsWideString expects a Unicode Python object' );
5510+ raise EPythonError.Create(' PyUnicodeAsString expects a Unicode Python object' );
55115511end ;
55125512
55135513function TPythonEngine.PyUnicodeFromString (const AString : UnicodeString) : PPyObject;
@@ -8602,7 +8602,7 @@ function pyio_write(self, args : PPyObject) : PPyObject;
86028602 if RedirectIO and (IO <> nil ) and Assigned(a1) then
86038603 begin
86048604 if PyUnicode_Check(a1) then
8605- IO.Write(PyUnicode_AsWideString (a1))
8605+ IO.Write(PyUnicodeAsString (a1))
86068606 else
86078607 IO.Write(IOString(PyObjectAsString(a1)));
86088608 end ;
0 commit comments