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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
de7f8401
Commit
de7f8401
authored
Apr 10, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better return value for rc in cacheExtremeDetail under PyPy
parent
312a493d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
src/ZODB/DB.py
src/ZODB/DB.py
+8
-7
No files found.
src/ZODB/DB.py
View file @
de7f8401
...
@@ -530,12 +530,10 @@ class DB(object):
...
@@ -530,12 +530,10 @@ class DB(object):
def
cacheExtremeDetail
(
self
):
def
cacheExtremeDetail
(
self
):
detail
=
[]
detail
=
[]
conn_no
=
[
0
]
# A mutable reference to a counter
conn_no
=
[
0
]
# A mutable reference to a counter
try
:
rc
=
sys
.
getrefcount
except
AttributeError
:
# sys.getrefcount is a CPython implementation detail
# sys.getrefcount is a CPython implementation detail
# not required to exist on, e.g., PyPy. Here we fake it.
# not required to exist on, e.g., PyPy.
rc
=
lambda
o
:
4
rc
=
getattr
(
sys
,
'getrefcount'
,
None
)
def
f
(
con
,
detail
=
detail
,
rc
=
rc
,
conn_no
=
conn_no
):
def
f
(
con
,
detail
=
detail
,
rc
=
rc
,
conn_no
=
conn_no
):
conn_no
[
0
]
+=
1
conn_no
[
0
]
+=
1
cn
=
conn_no
[
0
]
cn
=
conn_no
[
0
]
...
@@ -561,12 +559,15 @@ class DB(object):
...
@@ -561,12 +559,15 @@ class DB(object):
# sys.getrefcount(ob) returns. But, in addition to that,
# sys.getrefcount(ob) returns. But, in addition to that,
# the cache holds an extra reference on non-ghost objects,
# the cache holds an extra reference on non-ghost objects,
# and we also want to pretend that doesn't exist.
# and we also want to pretend that doesn't exist.
# If we have no way to get a refcount, we return False to symbolize
# that. As opposed to None, this has the advantage of being usable
# as a number (0) in case clients depended on that
detail
.
append
({
detail
.
append
({
'conn_no'
:
cn
,
'conn_no'
:
cn
,
'oid'
:
oid
,
'oid'
:
oid
,
'id'
:
id
,
'id'
:
id
,
'klass'
:
"%s%s"
%
(
module
,
ob
.
__class__
.
__name__
),
'klass'
:
"%s%s"
%
(
module
,
ob
.
__class__
.
__name__
),
'rc'
:
rc
(
ob
)
-
3
-
(
ob
.
_p_changed
is
not
None
),
'rc'
:
rc
(
ob
)
-
3
-
(
ob
.
_p_changed
is
not
None
)
if
rc
else
False
,
'state'
:
ob
.
_p_changed
,
'state'
:
ob
.
_p_changed
,
#'references': con.references(oid),
#'references': con.references(oid),
})
})
...
...
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