CXX, Objects.hxx: Python 3.9 Unicode compilation warning fixes suggested by wmayer on the FC forum.

This commit is contained in:
Aapo
2020-12-23 01:03:16 +02:00
committed by wwmayer
parent 69cd283663
commit 9050afbe28

View File

@@ -2135,13 +2135,20 @@ namespace Py
// Queries
virtual size_type size() const
{
return PyUnicode_GET_SIZE( ptr() );
return PyUnicode_GetLength( ptr() );
}
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 9
const Py_UNICODE *unicode_data() const
{
return PyUnicode_AS_UNICODE( ptr() );
}
unicodestring as_unicodestring() const
{
return unicodestring( PyUnicode_AS_UNICODE( ptr() ), PyUnicode_GET_SIZE( ptr() ) );
return unicodestring( unicode_data(), PyUnicode_GetLength( ptr() ) );
}
#endif
operator std::string() const
{
@@ -2154,11 +2161,6 @@ namespace Py
Bytes b( encode( encoding, error ) );
return b.as_std_string();
}
const Py_UNICODE *unicode_data() const
{
return PyUnicode_AS_UNICODE( ptr() );
}
};
// ==================================================