Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
Kirill Smelkov
persistent
Commits
cb59607c
Commit
cb59607c
authored
Aug 26, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Worked around test failure due to overflow to long on 32-bit systems.
parent
b64c388b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
3 deletions
+34
-3
CHANGES.txt
CHANGES.txt
+2
-0
persistent/cPersistence.c
persistent/cPersistence.c
+22
-2
persistent/tests/test_persistence.py
persistent/tests/test_persistence.py
+10
-1
No files found.
CHANGES.txt
View file @
cb59607c
...
...
@@ -4,6 +4,8 @@
4.0.1 (unreleased)
------------------
- Worked around test failure due to overflow to long on 32-bit systems.
- Renamed ``TimeStamp`` extension module to avoid clash with pure-Python
``timestamp`` module on case-insensitive filesystems.
...
...
persistent/cPersistence.c
View file @
cb59607c
...
...
@@ -24,7 +24,7 @@ struct ccobject_head_struct {
};
/* These two objects are initialized when the module is loaded */
static
PyObject
*
TimeStamp
,
*
py_simple_new
;
static
PyObject
*
TimeStamp
,
*
py_simple_new
,
*
sys_maxint
;
/* Strings initialized by init_strings() below. */
static
PyObject
*
py_keys
,
*
py_setstate
,
*
py___dict__
,
*
py_timeTime
;
...
...
@@ -1118,6 +1118,14 @@ Per_set_estimated_size(cPersistentObject *self, PyObject *v)
{
if
(
v
)
{
if
(
PyLong_Check
(
v
))
{
long
long
llv
=
PyInt_AsLongLong
(
v
);
if
(
llv
>
sys_maxint
)
{
v
=
sys_maxint
;
/* borrow reference */
}
}
if
(
PyInt_Check
(
v
))
{
long
lv
=
PyInt_AS_LONG
(
v
);
...
...
@@ -1422,6 +1430,18 @@ initcPersistence(void)
return
;
TimeStamp
=
PyObject_GetAttrString
(
m
,
"TimeStamp"
);
Py_DECREF
(
m
);
/* fall through to immediate return on error */
if
(
!
TimeStamp
)
return
;
}
if
(
!
sys_maxint
)
{
m
=
PyImport_ImportModule
(
"sys"
);
if
(
!
m
)
return
;
sys_maxint
=
PyObject_GetAttrString
(
m
,
"maxint"
);
Py_DECREF
(
m
);
if
(
!
sys_maxint
)
return
;
}
}
persistent/tests/test_persistence.py
View file @
cb59607c
...
...
@@ -504,7 +504,16 @@ class _Persistent_Base(object):
def
test_assign_p_estimated_size_bigger
(
self
):
inst
=
self
.
_makeOne
()
inst
.
_p_estimated_size
=
1073741697
*
1024
inst
.
_p_estimated_size
=
1073741697
*
4
#still <= 32 bits
self
.
assertEqual
(
inst
.
_p_estimated_size
,
16777215
*
64
)
def
test_assign_p_estimated_size_bigger_than_sys_maxint
(
self
):
try
:
from
sys
import
maxint
except
ImportError
:
#pragma NO COVER PYTHON3
maxint
=
2
**
32
-
1
inst
=
self
.
_makeOne
()
inst
.
_p_estimated_size
=
maxint
+
1
self
.
assertEqual
(
inst
.
_p_estimated_size
,
16777215
*
64
)
def
test___getattribute___p__names
(
self
):
...
...
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