Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: devel/llvm/16 and Python 3.13
To:
Daniel Dickman <didickman@gmail.com>
Cc:
Sebastien Marie <semarie@online.fr>, Robert Nagy <robert@openbsd.org>, ports@openbsd.org
Date:
Tue, 25 Feb 2025 12:50:04 +0000

Download raw body.

Thread
On 2025/02/24 19:25, Daniel Dickman wrote:
> I was able to build llvm 16 under Python 3.13 with the diff below.

I'm hoping we get rid of llvm 16 before we switch to 3.13.

Diff looks right though. Those files are compiled into liblldb.so.X so
that is the correct subpackage.

> Did I bump the correct subpackage?
> 
> ok?
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/llvm/16/Makefile,v
> diff -u -p -u -r1.38 Makefile
> --- Makefile	28 Dec 2024 22:29:24 -0000	1.38
> +++ Makefile	25 Feb 2025 00:24:33 -0000
> @@ -3,7 +3,7 @@ LLVM_VERSION =	${LLVM_MAJOR}.0.6
>  LLVM_PKGSPEC =	>=16,<17
>  
>  REVISION-main =		32
> -REVISION-lldb =		11
> +REVISION-lldb =		12
>  REVISION-python =	4
>  
>  SHARED_LIBS +=	LTO		0.0 \
> Index: patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_PythonDataObjects_cpp
> ===================================================================
> RCS file: patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_PythonDataObjects_cpp
> diff -N patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_PythonDataObjects_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_PythonDataObjects_cpp	25 Feb 2025 00:24:33 -0000
> @@ -0,0 +1,19 @@
> +Python 3.13 removed _Py_IsFinalizing.
> +
> +See: https://docs.python.org/3/whatsnew/3.13.html
> +
> +Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
> +--- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp.orig
> ++++ lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
> +@@ -72,8 +72,10 @@ Expected<std::string> python::As<std::string>(Expected
> + static bool python_is_finalizing() {
> + #if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 7
> +   return _Py_Finalizing != nullptr;
> +-#else
> ++#elif PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 12 
> +   return _Py_IsFinalizing();
> ++#else
> ++  return Py_IsFinalizing();
> + #endif
> + }
> + 
> Index: patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython_cpp
> ===================================================================
> RCS file: patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython_cpp
> diff -N patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-lldb_source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython_cpp	25 Feb 2025 00:24:33 -0000
> @@ -0,0 +1,23 @@
> +Python 3.13 removed PyEval_ThreadsInitialized, deprecated since Python 3.9.
> +
> +See: https://docs.python.org/3/whatsnew/3.13.html
> +
> +Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
> +--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp.orig
> ++++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
> +@@ -177,6 +177,7 @@ struct InitializePythonRAII { (private)
> +       return;
> + #endif
> + 
> ++#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 12)
> +     if (PyEval_ThreadsInitialized()) {
> +       Log *log = GetLog(LLDBLog::Script);
> + 
> +@@ -186,6 +187,7 @@ struct InitializePythonRAII { (private)
> +                 m_gil_state == PyGILState_UNLOCKED ? "un" : "");
> +       return;
> +     }
> ++#endif
> + 
> +     // InitThreads acquires the GIL if it hasn't been called before.
> +     PyEval_InitThreads();
>