Merge pull request #23803 from 3x380V/py

Py3.13: fix warnings
This commit is contained in:
Chris Hennes
2025-09-24 22:16:30 -05:00
committed by GitHub
5 changed files with 19 additions and 10 deletions

View File

@@ -133,6 +133,10 @@
typedef long int Py_hash_t;
#endif
#if PY_VERSION_HEX >= 0x030d0000
#define Py_UNICODE_DEPRECATED
#endif
#ifndef PYCXX_PYTHON_2TO3
#define PYCXX_PYTHON_2TO3
#endif

View File

@@ -1783,7 +1783,7 @@ namespace Py
// Python strings return strings as individual elements.
// I'll try having a class Char which is a String of length 1
//
#if !defined(Py_LIMITED_API)
#if !defined(Py_LIMITED_API) && !defined(Py_UNICODE_DEPRECATED)
typedef std::basic_string<Py_UNICODE> unicodestring;
extern Py_UNICODE unicode_null_string[1];
#endif
@@ -1979,7 +1979,7 @@ namespace Py
validate();
}
#if !defined( Py_LIMITED_API )
#if !defined( Py_LIMITED_API ) && !defined(Py_UNICODE_DEPRECATED)
Char( Py_UNICODE v )
: Object( PyUnicode_FromOrdinal( v ), true )
{
@@ -1987,7 +1987,7 @@ namespace Py
}
#endif
#if !defined( Py_LIMITED_API )
#if !defined( Py_LIMITED_API ) && !defined(Py_UNICODE_DEPRECATED)
Char( const unicodestring &v )
: Object( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ),1 ), true )
{
@@ -2008,7 +2008,7 @@ namespace Py
return *this;
}
#if !defined( Py_LIMITED_API )
#if !defined( Py_LIMITED_API ) && !defined(Py_UNICODE_DEPRECATED)
Char &operator=( const unicodestring &v )
{
set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ), 1 ), true );
@@ -2016,7 +2016,7 @@ namespace Py
}
#endif
#if !defined( Py_LIMITED_API )
#if !defined( Py_LIMITED_API ) && !defined(Py_UNICODE_DEPRECATED)
Char &operator=( int v_ )
{
Py_UNICODE v( v_ );
@@ -2025,7 +2025,7 @@ namespace Py
}
#endif
#if !defined( Py_LIMITED_API )
#if !defined( Py_LIMITED_API ) && !defined(Py_UNICODE_DEPRECATED)
Char &operator=( Py_UNICODE v )
{
set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, &v, 1 ), true );
@@ -2164,7 +2164,7 @@ namespace Py
}
#endif
#if !defined( Py_LIMITED_API )
#if !defined( Py_LIMITED_API ) && !defined(Py_UNICODE_DEPRECATED)
String( const Py_UNICODE *s, int length )
: SeqBase<Char>( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, s, length ), true )
{
@@ -2185,7 +2185,7 @@ namespace Py
return *this;
}
#if !defined( Py_LIMITED_API )
#if !defined( Py_LIMITED_API ) && !defined(Py_UNICODE_DEPRECATED)
String &operator=( const unicodestring &v )
{
set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE *>( v.data() ), v.length() ), true );

View File

@@ -45,7 +45,7 @@ Py_ssize_t numeric_limits_max()
return std::numeric_limits<Py_ssize_t>::max();
}
#if !defined(Py_LIMITED_API)
#if !defined(Py_LIMITED_API) && !defined(Py_UNICODE_DEPRECATED)
Py_UNICODE unicode_null_string[1] = { 0 };
#endif
char32_t ucs4_null_string[1] = { 0 };

View File

@@ -46,7 +46,9 @@
virtual ~_class_(); \
};
#if PY_VERSION_HEX >= 0x030c0000
#if PY_VERSION_HEX >= 0x030d0000
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#elif PY_VERSION_HEX >= 0x030c0000
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#else
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

View File

@@ -83,6 +83,9 @@ PyTypeObject FeaturePythonPyT<FeaturePyT>::Type = {
#if PY_VERSION_HEX >= 0x030c0000
,0 /*tp_watched */
#endif
#if PY_VERSION_HEX >= 0x030d0000
,0 /*tp_versions_used */
#endif
};
template<class FeaturePyT>