diff --git a/direct/src/distributed/cConnectionRepository.cxx b/direct/src/distributed/cConnectionRepository.cxx index 0eb40547ef..86b5869e14 100644 --- a/direct/src/distributed/cConnectionRepository.cxx +++ b/direct/src/distributed/cConnectionRepository.cxx @@ -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 diff --git a/dtool/src/interrogatedb/py_compat.cxx b/dtool/src/interrogatedb/py_compat.cxx index 722bc8300b..91fe93d456 100644 --- a/dtool/src/interrogatedb/py_compat.cxx +++ b/dtool/src/interrogatedb/py_compat.cxx @@ -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; diff --git a/dtool/src/interrogatedb/py_compat.h b/dtool/src/interrogatedb/py_compat.h index 4b67fba763..7ef6532c33 100644 --- a/dtool/src/interrogatedb/py_compat.h +++ b/dtool/src/interrogatedb/py_compat.h @@ -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 diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index b691fbef48..7cabfe0485 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -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; diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 3cafabab1c..01c7ab8f63 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -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 + /** * */ diff --git a/panda/src/putil/bitArray_ext.cxx b/panda/src/putil/bitArray_ext.cxx index 2a48951040..b454593d1b 100644 --- a/panda/src/putil/bitArray_ext.cxx +++ b/panda/src/putil/bitArray_ext.cxx @@ -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 + ); } } diff --git a/panda/src/putil/doubleBitMask_ext.I b/panda/src/putil/doubleBitMask_ext.I index a40b91355d..1674cccd49 100644 --- a/panda/src/putil/doubleBitMask_ext.I +++ b/panda/src/putil/doubleBitMask_ext.I @@ -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::half_bits); + PyObject *shifted = PyNumber_Lshift(hi, half_bits); + Py_DECREF(half_bits); +#else PyObject *shifted = _PyLong_Lshift(hi, DoubleBitMask::half_bits); +#endif Py_DECREF(hi); result = PyNumber_Or(shifted, lo); Py_DECREF(shifted); diff --git a/pandatool/src/deploy-stub/deploy-stub.c b/pandatool/src/deploy-stub/deploy-stub.c index 7e0b22464d..6cd2c2803c 100644 --- a/pandatool/src/deploy-stub/deploy-stub.c +++ b/pandatool/src/deploy-stub/deploy-stub.c @@ -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