From 52c2e7eff697f7e059fd99f5fbd9ed9a8687198c Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 22 Dec 2020 13:05:59 +0100 Subject: [PATCH] PyCXX: In Python 3.9 Unicode API are being deprecated Taken from https://sourceforge.net/p/cxx/code/430/ --- src/CXX/Python3/Objects.hxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CXX/Python3/Objects.hxx b/src/CXX/Python3/Objects.hxx index dd4b46c779..5d15b4b2de 100644 --- a/src/CXX/Python3/Objects.hxx +++ b/src/CXX/Python3/Objects.hxx @@ -1975,7 +1975,7 @@ namespace Py } Char( const unicodestring &v ) - : Object( PyUnicode_FromUnicode( const_cast( v.data() ),1 ), true ) + : Object( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast( v.data() ),1 ), true ) { validate(); } @@ -1995,20 +1995,20 @@ namespace Py Char &operator=( const unicodestring &v ) { - set( PyUnicode_FromUnicode( const_cast( v.data() ), 1 ), true ); + set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast( v.data() ), 1 ), true ); return *this; } Char &operator=( int v_ ) { Py_UNICODE v( v_ ); - set( PyUnicode_FromUnicode( &v, 1 ), true ); + set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, &v, 1 ), true ); return *this; } Char &operator=( Py_UNICODE v ) { - set( PyUnicode_FromUnicode( &v, 1 ), true ); + set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, &v, 1 ), true ); return *this; } @@ -2102,7 +2102,7 @@ namespace Py } String( const Py_UNICODE *s, int length ) - : SeqBase( PyUnicode_FromUnicode( s, length ), true ) + : SeqBase( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, s, length ), true ) { validate(); } @@ -2122,7 +2122,7 @@ namespace Py String &operator=( const unicodestring &v ) { - set( PyUnicode_FromUnicode( const_cast( v.data() ), v.length() ), true ); + set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast( v.data() ), v.length() ), true ); return *this; }