Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
8153e4c9
Commit
8153e4c9
authored
Apr 01, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix one more (last?) refcount problem with the cache.
parent
2bdcff7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
21 deletions
+18
-21
src/Persistence/cPickleCache.c
src/Persistence/cPickleCache.c
+6
-7
src/ZODB/cPickleCache.c
src/ZODB/cPickleCache.c
+6
-7
src/persistent/cPickleCache.c
src/persistent/cPickleCache.c
+6
-7
No files found.
src/Persistence/cPickleCache.c
View file @
8153e4c9
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static
char
cPickleCache_doc_string
[]
=
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.7
7 2003/04/01 16:17:50
jeremy Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.7
8 2003/04/01 18:44:25
jeremy Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
#define UNLESS(E) if(!(E))
...
@@ -506,7 +506,7 @@ cc_oid_unreferenced(ccobject *self, PyObject *oid)
...
@@ -506,7 +506,7 @@ cc_oid_unreferenced(ccobject *self, PyObject *oid)
Py_INCREF
(
v
);
Py_INCREF
(
v
);
/* XXX Should we call _Py_ForgetReference() on error exit? */
/* XXX Should we call _Py_ForgetReference() on error exit? */
if
(
PyDict_DelItem
(
self
->
data
,
oid
)
<
0
)
if
(
PyDict_DelItem
(
self
->
data
,
oid
)
<
0
)
return
-
1
;
return
-
1
;
Py_DECREF
((
ccobject
*
)((
cPersistentObject
*
)
v
)
->
cache
);
Py_DECREF
((
ccobject
*
)((
cPersistentObject
*
)
v
)
->
cache
);
...
@@ -648,6 +648,7 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
...
@@ -648,6 +648,7 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
static
int
static
int
cc_length
(
ccobject
*
self
)
cc_length
(
ccobject
*
self
)
{
{
fprintf
(
stderr
,
"non_ghost_count = %d
\n
"
,
self
->
non_ghost_count
);
return
PyObject_Length
(
self
->
data
);
return
PyObject_Length
(
self
->
data
);
}
}
...
@@ -762,6 +763,9 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
...
@@ -762,6 +763,9 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
PyDict_SetItem
(
self
->
data
,
key
,
v
)
<
0
)
if
(
PyDict_SetItem
(
self
->
data
,
key
,
v
)
<
0
)
return
-
1
;
return
-
1
;
/* Remove the reference used by the dict. The cache should only
have borrowed references to objects. */
Py_DECREF
(
v
);
p
=
(
cPersistentObject
*
)
v
;
p
=
(
cPersistentObject
*
)
v
;
Py_INCREF
(
self
);
Py_INCREF
(
self
);
...
@@ -774,12 +778,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
...
@@ -774,12 +778,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
p
->
ring
.
prev
=
self
->
ring_home
.
prev
;
p
->
ring
.
prev
=
self
->
ring_home
.
prev
;
self
->
ring_home
.
prev
->
next
=
&
p
->
ring
;
self
->
ring_home
.
prev
->
next
=
&
p
->
ring
;
self
->
ring_home
.
prev
=
&
p
->
ring
;
self
->
ring_home
.
prev
=
&
p
->
ring
;
}
else
{
/* steal a reference from the dictionary;
ghosts have a weak reference */
Py_DECREF
(
v
);
}
}
return
0
;
return
0
;
}
}
...
...
src/ZODB/cPickleCache.c
View file @
8153e4c9
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static
char
cPickleCache_doc_string
[]
=
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.7
7 2003/04/01 16:17:50
jeremy Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.7
8 2003/04/01 18:44:25
jeremy Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
#define UNLESS(E) if(!(E))
...
@@ -506,7 +506,7 @@ cc_oid_unreferenced(ccobject *self, PyObject *oid)
...
@@ -506,7 +506,7 @@ cc_oid_unreferenced(ccobject *self, PyObject *oid)
Py_INCREF
(
v
);
Py_INCREF
(
v
);
/* XXX Should we call _Py_ForgetReference() on error exit? */
/* XXX Should we call _Py_ForgetReference() on error exit? */
if
(
PyDict_DelItem
(
self
->
data
,
oid
)
<
0
)
if
(
PyDict_DelItem
(
self
->
data
,
oid
)
<
0
)
return
-
1
;
return
-
1
;
Py_DECREF
((
ccobject
*
)((
cPersistentObject
*
)
v
)
->
cache
);
Py_DECREF
((
ccobject
*
)((
cPersistentObject
*
)
v
)
->
cache
);
...
@@ -648,6 +648,7 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
...
@@ -648,6 +648,7 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
static
int
static
int
cc_length
(
ccobject
*
self
)
cc_length
(
ccobject
*
self
)
{
{
fprintf
(
stderr
,
"non_ghost_count = %d
\n
"
,
self
->
non_ghost_count
);
return
PyObject_Length
(
self
->
data
);
return
PyObject_Length
(
self
->
data
);
}
}
...
@@ -762,6 +763,9 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
...
@@ -762,6 +763,9 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
PyDict_SetItem
(
self
->
data
,
key
,
v
)
<
0
)
if
(
PyDict_SetItem
(
self
->
data
,
key
,
v
)
<
0
)
return
-
1
;
return
-
1
;
/* Remove the reference used by the dict. The cache should only
have borrowed references to objects. */
Py_DECREF
(
v
);
p
=
(
cPersistentObject
*
)
v
;
p
=
(
cPersistentObject
*
)
v
;
Py_INCREF
(
self
);
Py_INCREF
(
self
);
...
@@ -774,12 +778,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
...
@@ -774,12 +778,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
p
->
ring
.
prev
=
self
->
ring_home
.
prev
;
p
->
ring
.
prev
=
self
->
ring_home
.
prev
;
self
->
ring_home
.
prev
->
next
=
&
p
->
ring
;
self
->
ring_home
.
prev
->
next
=
&
p
->
ring
;
self
->
ring_home
.
prev
=
&
p
->
ring
;
self
->
ring_home
.
prev
=
&
p
->
ring
;
}
else
{
/* steal a reference from the dictionary;
ghosts have a weak reference */
Py_DECREF
(
v
);
}
}
return
0
;
return
0
;
}
}
...
...
src/persistent/cPickleCache.c
View file @
8153e4c9
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
...
@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static
char
cPickleCache_doc_string
[]
=
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.7
7 2003/04/01 16:17:50
jeremy Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.7
8 2003/04/01 18:44:25
jeremy Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
#define UNLESS(E) if(!(E))
...
@@ -506,7 +506,7 @@ cc_oid_unreferenced(ccobject *self, PyObject *oid)
...
@@ -506,7 +506,7 @@ cc_oid_unreferenced(ccobject *self, PyObject *oid)
Py_INCREF
(
v
);
Py_INCREF
(
v
);
/* XXX Should we call _Py_ForgetReference() on error exit? */
/* XXX Should we call _Py_ForgetReference() on error exit? */
if
(
PyDict_DelItem
(
self
->
data
,
oid
)
<
0
)
if
(
PyDict_DelItem
(
self
->
data
,
oid
)
<
0
)
return
-
1
;
return
-
1
;
Py_DECREF
((
ccobject
*
)((
cPersistentObject
*
)
v
)
->
cache
);
Py_DECREF
((
ccobject
*
)((
cPersistentObject
*
)
v
)
->
cache
);
...
@@ -648,6 +648,7 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
...
@@ -648,6 +648,7 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
static
int
static
int
cc_length
(
ccobject
*
self
)
cc_length
(
ccobject
*
self
)
{
{
fprintf
(
stderr
,
"non_ghost_count = %d
\n
"
,
self
->
non_ghost_count
);
return
PyObject_Length
(
self
->
data
);
return
PyObject_Length
(
self
->
data
);
}
}
...
@@ -762,6 +763,9 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
...
@@ -762,6 +763,9 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
PyDict_SetItem
(
self
->
data
,
key
,
v
)
<
0
)
if
(
PyDict_SetItem
(
self
->
data
,
key
,
v
)
<
0
)
return
-
1
;
return
-
1
;
/* Remove the reference used by the dict. The cache should only
have borrowed references to objects. */
Py_DECREF
(
v
);
p
=
(
cPersistentObject
*
)
v
;
p
=
(
cPersistentObject
*
)
v
;
Py_INCREF
(
self
);
Py_INCREF
(
self
);
...
@@ -774,12 +778,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
...
@@ -774,12 +778,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
p
->
ring
.
prev
=
self
->
ring_home
.
prev
;
p
->
ring
.
prev
=
self
->
ring_home
.
prev
;
self
->
ring_home
.
prev
->
next
=
&
p
->
ring
;
self
->
ring_home
.
prev
->
next
=
&
p
->
ring
;
self
->
ring_home
.
prev
=
&
p
->
ring
;
self
->
ring_home
.
prev
=
&
p
->
ring
;
}
else
{
/* steal a reference from the dictionary;
ghosts have a weak reference */
Py_DECREF
(
v
);
}
}
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment