Fix segfault at exit with Python 3.12

This commit is contained in:
Scott Talbert 2023-06-16 11:04:20 -04:00
parent 6486ad6e32
commit 0a67d370b5
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,31 @@
# HG changeset patch
# User Phil Thompson <phil@riverbankcomputing.com>
# Date 1686925181 -3600
# Node ID 312476401030130daed2eecfd1c93413f49e4458
# Parent 88452293f4e4cdc9d22cb5dfca02ba83216f662b
sipMalloc() and sipFree() are now implemented using PyMem_RawMalloc() and
PyMem_RawFree() so that they should be safe to call from functions registered
with Py_AtExit().
diff -r 88452293f4e4 -r 312476401030 sipbuild/module/source/12/siplib.c
--- a/siplib.c Thu Jun 08 14:30:02 2023 +0100
+++ b/siplib.c Fri Jun 16 15:19:41 2023 +0100
@@ -2147,7 +2147,7 @@
{
void *mem;
- if ((mem = PyMem_Malloc(nbytes)) == NULL)
+ if ((mem = PyMem_RawMalloc(nbytes)) == NULL)
PyErr_NoMemory();
return mem;
@@ -2159,7 +2159,7 @@
*/
void sip_api_free(void *mem)
{
- PyMem_Free(mem);
+ PyMem_RawFree(mem);
}

View File

@ -6,12 +6,13 @@
Name: python-%{pkg_name} Name: python-%{pkg_name}
Version: 12.12.1 Version: 12.12.1
Release: 2%{?dist} Release: 3%{?dist}
Summary: The sip module support for PyQt5 Summary: The sip module support for PyQt5
License: GPLv2 or GPLv3 License: GPLv2 or GPLv3
URL: https://www.riverbankcomputing.com/software/sip/ URL: https://www.riverbankcomputing.com/software/sip/
Source0: %{pypi_source} Source0: %{pypi_source}
Patch0: fix-py3.12-segfault-at-exit.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: python3-devel BuildRequires: python3-devel
@ -51,6 +52,9 @@ Provides: python3-pyqt5-sip-api(%{_sip_api_major})%{?_isa} = %{_sip_api}
%{python3_sitearch}/PyQt5/ %{python3_sitearch}/PyQt5/
%changelog %changelog
* Fri Jun 16 2023 Scott Talbert <swt@techie.net> - 12.12.1-3
- Fix segfault at exit with Python 3.12
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 12.12.1-2 * Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 12.12.1-2
- Rebuilt for Python 3.12 - Rebuilt for Python 3.12