#2 Workaround hang/OOM kill in Python 3.13
Merged 2 months ago by swt2c. Opened 2 months ago by churchyard.
rpms/ churchyard/sip6 python3.13  into  rawhide

@@ -0,0 +1,47 @@ 

+ From 483edb8136919d82013284ad3b0cd834e68fce15 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>

+ Date: Thu, 14 Mar 2024 10:23:59 +0100

+ Subject: [PATCH] Workaround hang/OOM kill in Python 3.13, avoid calling

+  list.remove() in try-except

+ 

+ See https://bugzilla.redhat.com/show_bug.cgi?id=2250649#c9 and bellow for details.

+ 

+ Python 3.13 changed the exception message for list.remove() to include the repr

+ of the missing object. Previously, it never mentioned the object at all.

+ 

+ https://github.com/python/cpython/commit/217f47d6e5e56bca78b8556e910cd00890f6f84a

+ 

+ Unfortunately, the repr() of the removed klass object

+ seems to very expensive to construct.

+ 

+ Even on Python 3.12, calling a repr(klass) directly causes

+ the build of PyQt5 and PyQt6 to hang in copr and time out after 5 hours.

+ In local mock, it causes sip-build to be OOM killed.

+ 

+ By checking if klass is in the list before attempting the removal,

+ we avoid the repr() call on Python 3.13+.

+ 

+ CPython upstream report: https://github.com/python/cpython/issues/116792

+ ---

+  sipbuild/generator/parser/parser_manager.py | 4 +---

+  1 file changed, 1 insertion(+), 3 deletions(-)

+ 

+ diff --git a/sipbuild/generator/parser/parser_manager.py b/sipbuild/generator/parser/parser_manager.py

+ index 666d904..70d7e3c 100644

+ --- a/sipbuild/generator/parser/parser_manager.py

+ +++ b/sipbuild/generator/parser/parser_manager.py

+ @@ -432,10 +432,8 @@ class ParserManager:

+          for klass in self.spec.classes:

+              if klass.iface_file is iface_file:

+                  if not self.parsing_template:

+ -                    try:

+ +                    if klass in self._template_arg_classes:

+                          self._template_arg_classes.remove(klass)

+ -                    except ValueError:

+ -                        pass

+  

+                  return klass

+  

+ -- 

+ 2.44.0

+ 

file modified
+9 -1
@@ -2,13 +2,18 @@ 

  

  Name:           sip6

  Version:        6.8.3

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        SIP - Python/C++ Bindings Generator

  %py_provides    python3-sip6

  

  License:        GPL-2.0-only OR GPL-3.0-only

  URL:            https://www.riverbankcomputing.com/software/sip

  Source0:        %{pypi_source}

+ 

+ # Workaround hang/OOM kill in Python 3.13, avoid calling list.remove() in try-except.

+ # See commit message in the patch for details.

+ Patch:          Workaround-hang-OOM-kill-in-Python-3.13.patch

+ 

  BuildArch:      noarch

  

  BuildRequires:  python3-devel
@@ -46,6 +51,9 @@ 

  %{python3_sitelib}/sipbuild/

  

  %changelog

+ * Thu Mar 14 2024 Miro Hrončok <mhroncok@redhat.com> - 6.8.3-2

+ - Workaround hang/OOM kill in Python 3.13

+ 

  * Wed Feb 21 2024 Scott Talbert <swt@techie.net> - 6.8.3-1

  - Update to new upstream release 6.8.3 (#2263494)

  

rebased onto bf711ae

2 months ago

Pull-Request has been merged by swt2c

2 months ago