Accepting request 227350 from home:AndreasSchwab:f

- type-mismatch.patch: Use Py_ssize_t rather than PY_LONG_LONG for sizes

OBS-URL: https://build.opensuse.org/request/show/227350
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-persistent?expand=0&rev=3
This commit is contained in:
Hans-Peter Jansen 2014-03-24 19:48:00 +00:00 committed by Git OBS Bridge
parent e2e18aae5b
commit b6cfd62ffe
3 changed files with 103 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Mar 21 23:02:35 UTC 2014 - schwab@linux-m68k.org
- type-mismatch.patch: Use Py_ssize_t rather than PY_LONG_LONG for sizes
-------------------------------------------------------------------
Mon Jul 29 14:58:49 UTC 2013 - hpj@urpla.net

View File

@ -1,7 +1,7 @@
#
# spec file for package python-persistent
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 LISA GmbH, Bingen, Germany.
#
# All modifications and additions to the file contributed by third parties
@ -12,10 +12,11 @@
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python-persistent
Version: 4.0.6
Release: 0
@ -24,6 +25,8 @@ Summary: Translucent persistent objects
License: ZPL-2.1
Group: Development/Languages/Python
Source: persistent-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/zopefoundation/persistent/commit/33daf91246f85c3248658c4d81d768bd78617003
Patch: type-mismatch.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
BuildRequires: python-setuptools
@ -60,6 +63,7 @@ This package contains documentation files for %{name}.
%prep
%setup -q -n persistent-%{version}
%patch -p1
%build
python setup.py build

92
type-mismatch.patch Normal file
View File

@ -0,0 +1,92 @@
From 33daf91246f85c3248658c4d81d768bd78617003 Mon Sep 17 00:00:00 2001
From: Tres Seaver <tseaver@palladion.com>
Date: Mon, 24 Mar 2014 13:39:46 -0400
Subject: [PATCH] Use Py_ssize_t rather than PY_LONG_LONG for sizes.
---
persistent/cPersistence.h | 2 +-
persistent/cPickleCache.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/persistent/cPersistence.h b/persistent/cPersistence.h
index 52d3bad..ac9a885 100644
--- a/persistent/cPersistence.h
+++ b/persistent/cPersistence.h
@@ -24,7 +24,7 @@
PyObject_HEAD \
CPersistentRing ring_home; \
int non_ghost_count; \
- PY_LONG_LONG total_estimated_size;
+ Py_ssize_t total_estimated_size;
struct ccobject_head_struct;
diff --git a/persistent/cPickleCache.c b/persistent/cPickleCache.c
index 5753922..57f33bf 100644
--- a/persistent/cPickleCache.c
+++ b/persistent/cPickleCache.c
@@ -123,7 +123,7 @@ typedef struct
PyObject *data; /* oid -> object dict */
PyObject *jar; /* Connection object */
int cache_size; /* target number of items in cache */
- PY_LONG_LONG cache_size_bytes; /* target total estimated size of
+ Py_ssize_t cache_size_bytes; /* target total estimated size of
items in cache */
/* Most of the time the ring contains only:
@@ -176,7 +176,7 @@ unlink_from_ring(CPersistentRing *self)
}
static int
-scan_gc_items(ccobject *self, int target, PY_LONG_LONG target_bytes)
+scan_gc_items(ccobject *self, int target, Py_ssize_t target_bytes)
{
/* This function must only be called with the ring lock held,
because it places non-object placeholders in the ring.
@@ -262,7 +262,7 @@ Done:
}
static PyObject *
-lockgc(ccobject *self, int target_size, PY_LONG_LONG target_size_bytes)
+lockgc(ccobject *self, int target_size, Py_ssize_t target_size_bytes)
{
/* This is thread-safe because of the GIL, and there's nothing
* in between checking the ring_lock and acquiring it that calls back
@@ -292,7 +292,7 @@ cc_incrgc(ccobject *self, PyObject *args)
int obsolete_arg = -999;
int starting_size = self->non_ghost_count;
int target_size = self->cache_size;
- PY_LONG_LONG target_size_bytes = self->cache_size_bytes;
+ Py_ssize_t target_size_bytes = self->cache_size_bytes;
if (self->cache_drain_resistance >= 1)
{
@@ -850,10 +850,10 @@ static int
cc_init(ccobject *self, PyObject *args, PyObject *kwds)
{
int cache_size = 100;
- PY_LONG_LONG cache_size_bytes = 0;
+ Py_ssize_t cache_size_bytes = 0;
PyObject *jar;
- if (!PyArg_ParseTuple(args, "O|iL", &jar, &cache_size, &cache_size_bytes))
+ if (!PyArg_ParseTuple(args, "O|in", &jar, &cache_size, &cache_size_bytes))
return -1;
self->jar = NULL;
@@ -1245,9 +1245,9 @@ static PyGetSetDef cc_getsets[] =
static PyMemberDef cc_members[] =
{
{"cache_size", T_INT, offsetof(ccobject, cache_size)},
- {"cache_size_bytes", T_LONG, offsetof(ccobject, cache_size_bytes)},
- {"total_estimated_size", T_LONG, offsetof(ccobject, total_estimated_size),
- READONLY},
+ {"cache_size_bytes", T_PYSSIZET, offsetof(ccobject, cache_size_bytes)},
+ {"total_estimated_size", T_PYSSIZET,
+ offsetof(ccobject, total_estimated_size), READONLY},
{"cache_drain_resistance", T_INT,
offsetof(ccobject, cache_drain_resistance)},
{"cache_non_ghost_count", T_INT, offsetof(ccobject, non_ghost_count),
--
1.9.1