git: 975217edf22f - main - cad/camotics: Fix build with Python 3.13

From: Thierry Thomas <thierry_at_FreeBSD.org>
Date: Sun, 18 Oct 2026 15:47:32 UTC
The branch main has been updated by thierry:

URL: https://cgit.FreeBSD.org/ports/commit/?id=975217edf22fbfd2fab5f514167febadf2c3bde7

commit 975217edf22fbfd2fab5f514167febadf2c3bde7
Author:     Pattems <patrick@crandol.com>
AuthorDate: 2026-10-13 23:58:02 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2026-10-18 15:47:24 +0000

    cad/camotics: Fix build with Python 3.13
    
    PyEval_ThreadsInitialized() was removed in Python 3.13.  It and
    PyEval_InitThreads() have been no-ops since Python 3.9, so only call
    them on older versions.
    
    While here, document the patches.
    
    PR:             299529
---
 cad/camotics/files/patch-src_python.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/cad/camotics/files/patch-src_python.cpp b/cad/camotics/files/patch-src_python.cpp
new file mode 100644
index 000000000000..0b730005c8ec
--- /dev/null
+++ b/cad/camotics/files/patch-src_python.cpp
@@ -0,0 +1,20 @@
+Description: Fix build with Python 3.13: only call PyEval_ThreadsInitialized()
+  and PyEval_InitThreads() (no-ops since 3.9, the former removed in 3.13) on
+  older Python versions.
+Issue ID: none
+Changeset: https://github.com/CauldronDevelopmentLLC/camotics/commit/9acf1a4
+TODO: Fixed on upstream master (unreleased); drop when updating to the first
+  release after 1.3.0.
+
+--- src/python.cpp.orig	2023-03-09 16:07:30 UTC
++++ src/python.cpp
+@@ -105,7 +105,9 @@ PyMODINIT_FUNC PyInit_camotics() {
+   cb::Logger::instance().setLogPrefix(true);
+   cb::Logger::instance().setLogColor(false);
+ 
++#if PY_VERSION_HEX < 0x03090000
+   if (!PyEval_ThreadsInitialized()) PyEval_InitThreads();
++#endif
+ 
+   PyObject *mod = PyModule_Create(&module);
+   if (!mod) return 0;