Index: VirtualBox-7.1.4/configure =================================================================== --- VirtualBox-7.1.4.orig/configure +++ VirtualBox-7.1.4/configure @@ -2185,7 +2185,7 @@ extern "C" int main(void) } EOF found= - SUPPYTHONLIBS="python2.7 python2.6 python3.1 python3.2 python3.3 python3.4 python3.4m python3.5 python3.5m python3.6 python3.6m python3.7 python3.7m python3.8 python3.9 python3.10 python3.11 python3.12" + SUPPYTHONLIBS="python2.7 python2.6 python3.1 python3.2 python3.3 python3.4 python3.4m python3.5 python3.5m python3.6 python3.6m python3.7 python3.7m python3.8 python3.9 python3.10 python3.11 python3.12 python3.13" for p in $PYTHONDIR; do for d in $SUPPYTHONLIBS; do for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do Index: VirtualBox-7.1.4/src/libs/xpcom18a4/python/gen_python_deps.py =================================================================== --- VirtualBox-7.1.4.orig/src/libs/xpcom18a4/python/gen_python_deps.py +++ VirtualBox-7.1.4/src/libs/xpcom18a4/python/gen_python_deps.py @@ -29,7 +29,7 @@ if sys.version_info >= (3, 10): else: from distutils.version import StrictVersion as Version -versions = ["2.6", "2.7", "3.1", "3.2", "3.2m", "3.3", "3.3m", "3.4", "3.4m", "3.5", "3.5m", "3.6", "3.6m", "3.7", "3.7m", "3.8", "3.9", "3.10", "3.11", "3.12" ] +versions = ["2.6", "2.7", "3.1", "3.2", "3.2m", "3.3", "3.3m", "3.4", "3.4m", "3.5", "3.5m", "3.6", "3.6m", "3.7", "3.7m", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"] known = {} Index: VirtualBox-7.1.4/src/libs/xpcom18a4/python/Makefile.kmk =================================================================== --- VirtualBox-7.1.4.orig/src/libs/xpcom18a4/python/Makefile.kmk +++ VirtualBox-7.1.4/src/libs/xpcom18a4/python/Makefile.kmk @@ -658,6 +658,27 @@ ifndef VBOX_ONLY_SDK endif endif + ifdef VBOX_PYTHON313_INC + # + # Python 3.13 version (implicitly with pymalloc) + # + DLLS += VBoxPython3_13 + VBoxPython3_13_EXTENDS = VBoxPythonBase + VBoxPython3_13_EXTENDS_BY = appending + VBoxPython3_13_INCS = $(VBOX_PYTHON313_INC) + VBoxPython3_13_LIBS = $(VBOX_PYTHON313_LIB) + + ifdef VBOX_WITH_32_ON_64_MAIN_API + ifdef VBOX_PYTHON313_LIB_X86 + DLLS += VBoxPython3_13_x86 + VBoxPython3_13_x86_EXTENDS = VBoxPythonBase_x86 + VBoxPython3_13_x86_EXTENDS_BY = appending + VBoxPython3_13_x86_INCS = $(VBOX_PYTHON313_INC) + VBoxPython3_13_x86_LIBS = $(VBOX_PYTHON313_LIB_X86) + endif + endif + endif + ifdef VBOX_PYTHONDEF_INC # # Python without versioning @@ -700,7 +721,7 @@ ifndef VBOX_ONLY_SDK # TODO: ASSUMING that we don't need a different headers for pymalloc # ('m' builds < 3.8) and CRT malloc. # - VBOX_PYTHON_LIMITED_API_VER := $(firstword $(foreach ver, 35 36 37 38 39 310 311 312 34 33 \ + VBOX_PYTHON_LIMITED_API_VER := $(firstword $(foreach ver, 35 36 37 38 39 310 311 312 313 34 33 \ ,$(if-expr defined(VBOX_PYTHON$(ver)_INC),$(ver),)$(if-expr defined(VBOX_PYTHON$(ver)M_INC),$(ver)M,))) ifneq ($(VBOX_PYTHON_LIMITED_API_VER),) DLLS += VBoxPython3 Index: VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyXPCOM.h =================================================================== --- VirtualBox-7.1.4.orig/src/libs/xpcom18a4/python/src/PyXPCOM.h +++ VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyXPCOM.h @@ -254,7 +254,9 @@ DECLINLINE(Py_ssize_t) PyUnicode_GET_SIZ # endif } +# if (PY_VERSION_HEX <= 0x030d00f0) # define PyObject_CheckBuffer(pAllegedBuffer) PyObject_CheckReadBuffer(pAllegedBuffer) +# endif # include DECLINLINE(Py_hash_t) _Py_HashPointer(void *p) Index: VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyGInputStream.cpp =================================================================== --- VirtualBox-7.1.4.orig/src/libs/xpcom18a4/python/src/PyGInputStream.cpp +++ VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyGInputStream.cpp @@ -103,15 +103,16 @@ PyG_nsIInputStream::Read(char * buf, PRU const char *methodName = "read"; nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "i", count); if (NS_SUCCEEDED(nr)) { -#if 0 /* VBox: new buffer protocol (though I could use it for Py_LIMITED_API and ditch the warning, but cpython specific) */ + +# if (PY_VERSION_HEX >= 0x030d00f0) /* VBox: new buffer protocol (though I could use it for Py_LIMITED_API and ditch the warning, but cpython specific) */ Py_buffer py_view; if (PyObject_GetBuffer(ret, &py_view, PyBUF_SIMPLE) == 0) { if (py_view.len <= count) { count = py_view.len; } else { - PyXPCOM_LogWarning("nsIInputStream::read() was asked for %d bytes, but the string returned is %d bytes - truncating!\n", count, py_size); + PyXPCOM_LogWarning("nsIInputStream::read() was asked for %d bytes, but the string returned is %d bytes - truncating!\n", count, py_view.len); } - memcpy(buf, py_view.py_buf, count); + memcpy(buf, py_view.buf, count); PyBuffer_Release(&py_view); *_retval = count; } else { Index: VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyGBase.cpp =================================================================== --- VirtualBox-7.1.4.orig/src/libs/xpcom18a4/python/src/PyGBase.cpp +++ VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyGBase.cpp @@ -222,7 +222,11 @@ PyG_Base::AutoWrapPythonInstance(PyObjec if (obIID==NULL) goto done; args = Py_BuildValue("OOzi", ob, obIID, NULL, 0); if (args==NULL) goto done; +#if (PY_VERSION_HEX < 0x030d00f0) wrap_ret = PyEval_CallObject(func, args); +#else + wrap_ret = PyObject_Call(func, args, NULL); +#endif if (wrap_ret==NULL) goto done; ok = Py_nsISupports::InterfaceFromPyObject(wrap_ret, iid, ppret, PR_FALSE, PR_FALSE); #ifdef DEBUG @@ -570,7 +574,11 @@ static nsresult do_dispatch( goto done; } // Make the call +#if (PY_VERSION_HEX < 0x030d00f0) *ppResult = PyEval_CallObject(method, args); +#else + *ppResult = PyObject_Call(method, args, NULL); +#endif ret = *ppResult ? NS_OK : NS_ERROR_FAILURE; done: Py_XDECREF(method); Index: VirtualBox-7.1.4/Config.kmk =================================================================== --- VirtualBox-7.1.4.orig/Config.kmk +++ VirtualBox-7.1.4/Config.kmk @@ -884,7 +884,7 @@ VBOX_WITH_JAVA_SUPPORT_IN_XPIDL ?= # unless VBOX_WITH_ONLY_PYTHON_LIMITED_API is overridden). VBOX_WITH_MULTIVERSION_PYTHON ?= 1 # Only build the limited Python extension API version for 3.3 and later. -VBOX_WITH_ONLY_PYTHON_LIMITED_API = 1 +# VBOX_WITH_ONLY_PYTHON_LIMITED_API = 1 # Build the Validation Kit. VBOX_WITH_VALIDATIONKIT = 1 # Include unit tests (testcases) on the Validation Kit .ISO Index: VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/module/_xpcom.cpp =================================================================== --- VirtualBox-7.1.4.orig/src/libs/xpcom18a4/python/src/module/_xpcom.cpp +++ VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/module/_xpcom.cpp @@ -79,7 +79,19 @@ # define MANGLE_MODULE_INIT(a_Name) RT_CONCAT(a_Name, MODULE_NAME_SUFFIX) # endif # if defined(VBOX_PYXPCOM_VERSIONED) && !defined(VBOX_PYXPCOM_MAJOR_VERSIONED) -# if PY_VERSION_HEX >= 0x030a0000 && PY_VERSION_HEX < 0x030b0000 +# if PY_VERSION_HEX >= 0x030d0000 && PY_VERSION_HEX < 0x030e0000 +# define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_13") +# define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_13) + +# elif PY_VERSION_HEX >= 0x030c0000 && PY_VERSION_HEX < 0x030b0000 +# define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_12") +# define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_12) + +# elif PY_VERSION_HEX >= 0x030b0000 && PY_VERSION_HEX < 0x030a0000 +# define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_11") +# define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_11) + +# elif PY_VERSION_HEX >= 0x030a0000 && PY_VERSION_HEX < 0x030b0000 # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_10") # define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_10) Index: VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyIInputStream.cpp =================================================================== --- VirtualBox-7.1.4.orig/src/libs/xpcom18a4/python/src/PyIInputStream.cpp +++ VirtualBox-7.1.4/src/libs/xpcom18a4/python/src/PyIInputStream.cpp @@ -74,7 +74,14 @@ static PyObject *DoPyRead_Buffer(nsIInpu # else int buf_len; # endif /* VBOX */ +# if (PY_VERSION_HEX < 0x030d0000) if (PyObject_AsWriteBuffer(obBuffer, &buf, &buf_len) != 0) { +# else + Py_buffer py_view; + if (PyObject_GetBuffer(obBuffer, &py_view, PyBUF_SIMPLE) == 0) { + buf = py_view.buf; + buf_len = py_view.len; +# endif #endif PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "The buffer object does not have a write buffer!"); @@ -91,6 +98,9 @@ static PyObject *DoPyRead_Buffer(nsIInpu nsresult r; Py_BEGIN_ALLOW_THREADS; r = pI->Read((char *)buf, n, &nread); +# if (PY_VERSION_HEX >= 0x030d0000) + PyBuffer_Release(&py_view); +# endif Py_END_ALLOW_THREADS; if ( NS_FAILED(r) ) return PyXPCOM_BuildPyException(r);