1
0
python-persistent/type-mismatch.patch

93 lines
3.5 KiB
Diff
Raw Normal View History

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