14
0

- Add patch use-pydict-size.patch:

* Use PyDict_Size rather then PyList_GET_SIZE on a dict object.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Logbook?expand=0&rev=33
This commit is contained in:
2025-03-06 04:07:10 +00:00
committed by Git OBS Bridge
parent bb040d7e89
commit f6bb758d73
3 changed files with 47 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Mar 6 04:05:59 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch use-pydict-size.patch:
* Use PyDict_Size rather then PyList_GET_SIZE on a dict object.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jan 9 09:56:38 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com> Thu Jan 9 09:56:38 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

View File

@@ -23,6 +23,8 @@ Summary: A logging replacement for Python
License: BSD-3-Clause License: BSD-3-Clause
URL: https://github.com/getlogbook/logbook URL: https://github.com/getlogbook/logbook
Source: https://files.pythonhosted.org/packages/source/l/logbook/logbook-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/l/logbook/logbook-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#getlogbook/logbook#413
Patch0: use-pydict-size.patch
BuildRequires: %{python_module Brotli} BuildRequires: %{python_module Brotli}
BuildRequires: %{python_module Cython} BuildRequires: %{python_module Cython}
BuildRequires: %{python_module Jinja2} BuildRequires: %{python_module Jinja2}
@@ -62,8 +64,8 @@ export CFLAGS="%{optflags} -fno-strict-aliasing"
%pyproject_wheel %pyproject_wheel
%install %install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%pyproject_install %pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check %check
export CFLAGS="%{optflags}" export CFLAGS="%{optflags}"
@@ -74,8 +76,8 @@ kill %%1
%files %{python_files} %files %{python_files}
%license LICENSE %license LICENSE
%doc CHANGES %doc README.md CHANGES
%{python_sitearch}/logbook %{python_sitearch}/logbook
%{python_sitearch}/Logbook-%{version}*-info %{python_sitearch}/Logbook-%{version}.dist-info
%changelog %changelog

36
use-pydict-size.patch Normal file
View File

@@ -0,0 +1,36 @@
From db82f93b90b15794fdc720c98eda07bdd273c260 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Thu, 6 Mar 2025 14:56:42 +1100
Subject: [PATCH] Use PyDict methods in ContextStackManager
With Python 3.12+, calling PyList_GET_SIZE on a dict object results in an
assertion error followed by an abort. Correct this by using PyDict_Size
on the cache object.
---
src/cython/speedups.pyx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/cython/speedups.pyx b/src/cython/speedups.pyx
index a4bb55a..3741403 100644
--- a/src/cython/speedups.pyx
+++ b/src/cython/speedups.pyx
@@ -21,8 +21,8 @@ from logbook.concurrency import (
thread_local,
)
-from cpython.dict cimport PyDict_Clear, PyDict_SetItem
-from cpython.list cimport PyList_Append, PyList_GET_SIZE, PyList_Sort
+from cpython.dict cimport PyDict_Clear, PyDict_SetItem, PyDict_Size
+from cpython.list cimport PyList_Append, PyList_Sort
from cpython.pythread cimport (
WAIT_LOCK,
PyThread_acquire_lock,
@@ -218,7 +218,7 @@ cdef class ContextStackManager:
objects = self._cache.get(tid)
if objects is None:
- if PyList_GET_SIZE(self._cache) > _MAX_CONTEXT_OBJECT_CACHE:
+ if PyDict_Size(self._cache) > _MAX_CONTEXT_OBJECT_CACHE:
PyDict_Clear(self._cache)
objects = self._global[:]
objects.extend(getattr(self._thread_context, 'stack', ()))