Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
25bf8639
Commit
25bf8639
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
6f077e60
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 @
25bf8639
...
@@ -1235,6 +1235,12 @@ Per_setstate(cPersistentObject *self)
...
@@ -1235,6 +1235,12 @@ Per_setstate(cPersistentObject *self)
static
PyObject
*
static
PyObject
*
simple_new
(
PyObject
*
self
,
PyObject
*
type_object
)
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
);
return
PyType_GenericNew
((
PyTypeObject
*
)
type_object
,
NULL
,
NULL
);
}
}
...
...
src/persistent/tests/persistent.txt
View file @
25bf8639
...
@@ -462,7 +462,7 @@ that might be tedious.
...
@@ -462,7 +462,7 @@ that might be tedious.
Interfaces
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
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
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
`zope.interface` is available, so this test looks a little unusual. One
...
...
src/persistent/tests/test_persistent.py
View file @
25bf8639
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
##############################################################################
##############################################################################
import
unittest
import
unittest
from
zope.testing
import
doctest
from
zope.testing
import
doctest
from
persistent
import
Persistent
from
persistent
import
Persistent
,
simple_new
class
P
(
Persistent
):
class
P
(
Persistent
):
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -35,6 +35,13 @@ def cpersistent_setstate_pointer_sanity():
...
@@ -35,6 +35,13 @@ def cpersistent_setstate_pointer_sanity():
TypeError: this object has no instance dictionary
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
():
def
test_suite
():
return
unittest
.
TestSuite
((
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