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
Kirill Smelkov
ZODB
Commits
f32b1627
Commit
f32b1627
authored
Apr 07, 2010
by
Patrick Strawderman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise an error when an invalid argument is passed to persistent.simple_new.
parent
b2ec9b58
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
src/persistent/cPersistence.c
src/persistent/cPersistence.c
+6
-0
src/persistent/tests/persistent.txt
src/persistent/tests/persistent.txt
+1
-1
src/persistent/tests/test_persistent.py
src/persistent/tests/test_persistent.py
+8
-1
No files found.
src/persistent/cPersistence.c
View file @
f32b1627
...
...
@@ -1235,6 +1235,12 @@ Per_setstate(cPersistentObject *self)
static
PyObject
*
simple_new
(
PyObject
*
self
,
PyObject
*
type_object
)
{
if
(
!
PyType_Check
(
type_object
))
{
PyErr_SetString
(
PyExc_TypeError
,
"simple_new argument must be a type object."
);
return
NULL
;
}
return
PyType_GenericNew
((
PyTypeObject
*
)
type_object
,
NULL
,
NULL
);
}
...
...
src/persistent/tests/persistent.txt
View file @
f32b1627
...
...
@@ -462,7 +462,7 @@ that might be tedious.
Interfaces
----------
Some versions of Zope and ZODB have the `zope.interface
s
` package available.
Some versions of Zope and ZODB have the `zope.interface` package available.
If it is available, then persistent will be associated with several
interfaces. It's hard to write a doctest test that runs the tests only if
`zope.interface` is available, so this test looks a little unusual. One
...
...
src/persistent/tests/test_persistent.py
View file @
f32b1627
...
...
@@ -13,7 +13,7 @@
##############################################################################
import
unittest
from
zope.testing
import
doctest
from
persistent
import
Persistent
from
persistent
import
Persistent
,
simple_new
class
P
(
Persistent
):
def
__init__
(
self
):
...
...
@@ -35,6 +35,13 @@ def cpersistent_setstate_pointer_sanity():
TypeError: this object has no instance dictionary
"""
def
cpersistent_simple_new_invalid_argument
():
"""
>>> simple_new('')
Traceback (most recent call last):
...
TypeError: simple_new argument must be a type object.
"""
def
test_suite
():
return
unittest
.
TestSuite
((
...
...
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