Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2024-09-19 15:51:25 +02:00
commit b32459ffa1
8 changed files with 39 additions and 4 deletions

View File

@ -711,6 +711,7 @@ handle_update_field() {
nassertr(neverDisable != nullptr, false);
unsigned int cNeverDisable = PyLong_AsLong(neverDisable);
Py_DECREF(neverDisable);
if (!cNeverDisable) {
// in quiet zone and distobj is disable-able drop update on the
// floor

View File

@ -33,7 +33,11 @@ size_t PyLongOrInt_AsSize_t(PyObject *vv) {
size_t bytes;
int one = 1;
int res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes,
SIZEOF_SIZE_T, (int)*(unsigned char*)&one, 0);
SIZEOF_SIZE_T, (int)*(unsigned char*)&one, 0,
#if PY_VERSION_HEX >= 0x030d0000
, 1 // with_exceptions
#endif
);
if (res < 0) {
return (size_t)res;

View File

@ -279,6 +279,12 @@ INLINE bool PyLong_IsNonNegative(PyObject *value) {
}
#endif
/* Python 3.13 */
#if PY_VERSION_HEX < 0x030D00A1
# define PyLong_AsInt(x) (_PyLong_AsInt(x))
#endif
/* Other Python implementations */
#endif // HAVE_PYTHON

View File

@ -886,7 +886,9 @@ bool Dtool_ExtractOptionalArg(PyObject **result, PyObject *args, PyObject *kwds,
}
// We got the item, we just need to make sure that it had the right key.
#if PY_VERSION_HEX >= 0x03060000
#if PY_VERSION_HEX >= 0x030d0000
return PyUnicode_CheckExact(key) && PyUnicode_EqualToUTF8(key, keyword);
#elif PY_VERSION_HEX >= 0x03060000
return PyUnicode_CheckExact(key) && _PyUnicode_EqualToASCIIString(key, keyword);
#elif PY_MAJOR_VERSION >= 3
return PyUnicode_CheckExact(key) && PyUnicode_CompareWithASCIIString(key, keyword) == 0;

View File

@ -46,6 +46,12 @@ TypeHandle CocoaGraphicsWindow::_type_handle;
#define NSAppKitVersionNumber10_14 1671
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1070
enum {
NSFullScreenWindowMask = 1 << 14
};
#endif
/**
*
*/

View File

@ -32,7 +32,11 @@ __init__(PyObject *init_value) {
_PyLong_AsByteArray((PyLongObject *)init_value,
(unsigned char *)&_this->_array[0],
num_words * sizeof(BitArray::WordType),
1, 0);
1, 0
#if PY_VERSION_HEX >= 0x030d0000
, 1 // with_exceptions
#endif
);
}
}

View File

@ -31,7 +31,11 @@ __init__(PyObject *init_value) {
if (n > 0) {
size_t num_bytes = (n + 7) / 8;
unsigned char *bytes = (unsigned char *)alloca(num_bytes);
_PyLong_AsByteArray((PyLongObject *)init_value, bytes, num_bytes, 1, 0);
_PyLong_AsByteArray((PyLongObject *)init_value, bytes, num_bytes, 1, 0
#if PY_VERSION_HEX >= 0x030d0000
, 1 // with_exceptions
#endif
);
for (size_t i = 0; i < num_bytes; ++i) {
this->_this->store(bytes[i], i * 8, 8);
@ -58,7 +62,13 @@ __int__() const {
if (!this->_this->_hi.is_zero()) {
PyObject *lo = result;
PyObject *hi = invoke_extension(&this->_this->_hi).__int__();
#if PY_VERSION_HEX >= 0x030d0000
PyObject *half_bits = PyLong_FromUnsignedLong(DoubleBitMask<BMType>::half_bits);
PyObject *shifted = PyNumber_Lshift(hi, half_bits);
Py_DECREF(half_bits);
#else
PyObject *shifted = _PyLong_Lshift(hi, DoubleBitMask<BMType>::half_bits);
#endif
Py_DECREF(hi);
result = PyNumber_Or(shifted, lo);
Py_DECREF(shifted);

View File

@ -712,7 +712,9 @@ int main(int argc, char *argv[]) {
new_moddef->code = moddef->code;
new_moddef->size = moddef->size < 0 ? -(moddef->size) : moddef->size;
new_moddef->is_package = moddef->size < 0;
#if PY_VERSION_HEX < 0x030d0000 // 3.13
new_moddef->get_code = NULL;
#endif
new_moddef++;
}
#endif