pyuno/source/module/pyuno_type.cxx |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 476caeed6e14b3f1cda9435d3fbfa89df0457924
Author:     dante <[email protected]>
AuthorDate: Wed Feb 3 12:50:37 2021 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Feb 5 11:44:52 2021 +0100

    tdf#138987 Python 3.12 preparations
    
    Change-Id: I8ea476bfbaf27f8ab2daf4a370efc9917a5f9f8e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110346
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/pyuno/source/module/pyuno_type.cxx 
b/pyuno/source/module/pyuno_type.cxx
index 7a919c9bde32..63176c3a2970 100644
--- a/pyuno/source/module/pyuno_type.cxx
+++ b/pyuno/source/module/pyuno_type.cxx
@@ -138,7 +138,7 @@ sal_Unicode PyChar2Unicode( PyObject *obj )
             "uno.Char contains an empty unicode string");
     }
 
-    sal_Unicode c = static_cast<sal_Unicode>(PyUnicode_AsUnicode( value.get() 
)[0]);
+    sal_Unicode c = static_cast<sal_Unicode>(PyUnicode_ReadChar( value.get(), 
0));
     return c;
 }
 
@@ -265,11 +265,8 @@ PyObject* PyUNO_char_new ( sal_Unicode val , const Runtime 
&r )
 {
     // retrieve type object
     PyRef args( PyTuple_New( 1 ), SAL_NO_ACQUIRE, NOT_NULL );
-
-    Py_UNICODE u[2];
-    u[0] = val;
-    u[1] = 0;
-    PyTuple_SetItem( args.get() , 0 , PyUnicode_FromUnicode( u ,1) );
+    static_assert(sizeof(sal_Unicode) == sizeof(Py_UCS2), "unexpected size");
+    PyTuple_SetItem( args.get() , 0 , PyUnicode_FromKindAndData( 
PyUnicode_2BYTE_KIND, &val ,1) );
 
     return callCtor( r, "Char" , args );
 }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to