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
6b975ad4
Commit
6b975ad4
authored
Jun 18, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't silently ignore exceptions in _p_deactivate().
parent
f1227aab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
18 deletions
+93
-18
src/Persistence/cPersistence.c
src/Persistence/cPersistence.c
+31
-6
src/ZODB/cPersistence.c
src/ZODB/cPersistence.c
+31
-6
src/persistent/cPersistence.c
src/persistent/cPersistence.c
+31
-6
No files found.
src/Persistence/cPersistence.c
View file @
6b975ad4
...
...
@@ -14,7 +14,7 @@
static
char
cPersistence_doc_string
[]
=
"Defines Persistent mixin class for persistent objects.
\n
"
"
\n
"
"$Id: cPersistence.c,v 1.6
1 2002/06/14 15:34:30
jeremy Exp $
\n
"
;
"$Id: cPersistence.c,v 1.6
2 2002/06/18 21:37:56
jeremy Exp $
\n
"
;
#include "cPersistence.h"
...
...
@@ -624,6 +624,7 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
return
0
;
}
else
if
(
strcmp
(
name
+
3
,
"changed"
)
==
0
)
{
int
deactivate
=
0
;
if
(
!
v
)
{
/* delatter is used to invalidate the object
...
...
@@ -631,13 +632,37 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
*/
if
(
self
->
state
!=
cPersistent_GHOST_STATE
)
self
->
state
=
cPersistent_UPTODATE_STATE
;
v
=
Py_None
;
deactivate
=
1
;
}
if
(
v
==
Py_None
)
else
if
(
v
==
Py_None
)
deactivate
=
1
;
if
(
deactivate
)
{
v
=
PyObject_GetAttr
(
OBJECT
(
self
),
py__p_deactivate
);
if
(
v
)
{
ASSIGN
(
v
,
PyObject_CallObject
(
v
,
NULL
));
}
if
(
v
)
{
Py_DECREF
(
v
);
}
PyObject
*
res
;
PyObject
*
meth
=
PyObject_GetAttr
(
OBJECT
(
self
),
py__p_deactivate
);
if
(
meth
==
NULL
)
return
-
1
;
res
=
PyObject_CallObject
(
meth
,
NULL
);
if
(
res
)
{
Py_DECREF
(
res
);
}
else
{
/* an error occured in _p_deactivate().
It's not clear what we should do here. The code is
obviously ignoring the exception, but it shouldn't
return 0 for a getattr and set an exception. The
simplest change is to clear the exception, but that
simply masks the error.
XXX We'll print an error to stderr just like
exceptions in __del__(). It would probably be
better to log it but that would be painful from C.
*/
PyErr_WriteUnraisable
(
meth
);
}
Py_DECREF
(
meth
);
return
0
;
}
if
(
PyObject_IsTrue
(
v
))
return
changed
(
self
);
...
...
src/ZODB/cPersistence.c
View file @
6b975ad4
...
...
@@ -14,7 +14,7 @@
static
char
cPersistence_doc_string
[]
=
"Defines Persistent mixin class for persistent objects.
\n
"
"
\n
"
"$Id: cPersistence.c,v 1.6
1 2002/06/14 15:34:30
jeremy Exp $
\n
"
;
"$Id: cPersistence.c,v 1.6
2 2002/06/18 21:37:56
jeremy Exp $
\n
"
;
#include "cPersistence.h"
...
...
@@ -624,6 +624,7 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
return
0
;
}
else
if
(
strcmp
(
name
+
3
,
"changed"
)
==
0
)
{
int
deactivate
=
0
;
if
(
!
v
)
{
/* delatter is used to invalidate the object
...
...
@@ -631,13 +632,37 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
*/
if
(
self
->
state
!=
cPersistent_GHOST_STATE
)
self
->
state
=
cPersistent_UPTODATE_STATE
;
v
=
Py_None
;
deactivate
=
1
;
}
if
(
v
==
Py_None
)
else
if
(
v
==
Py_None
)
deactivate
=
1
;
if
(
deactivate
)
{
v
=
PyObject_GetAttr
(
OBJECT
(
self
),
py__p_deactivate
);
if
(
v
)
{
ASSIGN
(
v
,
PyObject_CallObject
(
v
,
NULL
));
}
if
(
v
)
{
Py_DECREF
(
v
);
}
PyObject
*
res
;
PyObject
*
meth
=
PyObject_GetAttr
(
OBJECT
(
self
),
py__p_deactivate
);
if
(
meth
==
NULL
)
return
-
1
;
res
=
PyObject_CallObject
(
meth
,
NULL
);
if
(
res
)
{
Py_DECREF
(
res
);
}
else
{
/* an error occured in _p_deactivate().
It's not clear what we should do here. The code is
obviously ignoring the exception, but it shouldn't
return 0 for a getattr and set an exception. The
simplest change is to clear the exception, but that
simply masks the error.
XXX We'll print an error to stderr just like
exceptions in __del__(). It would probably be
better to log it but that would be painful from C.
*/
PyErr_WriteUnraisable
(
meth
);
}
Py_DECREF
(
meth
);
return
0
;
}
if
(
PyObject_IsTrue
(
v
))
return
changed
(
self
);
...
...
src/persistent/cPersistence.c
View file @
6b975ad4
...
...
@@ -14,7 +14,7 @@
static
char
cPersistence_doc_string
[]
=
"Defines Persistent mixin class for persistent objects.
\n
"
"
\n
"
"$Id: cPersistence.c,v 1.6
1 2002/06/14 15:34:30
jeremy Exp $
\n
"
;
"$Id: cPersistence.c,v 1.6
2 2002/06/18 21:37:56
jeremy Exp $
\n
"
;
#include "cPersistence.h"
...
...
@@ -624,6 +624,7 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
return
0
;
}
else
if
(
strcmp
(
name
+
3
,
"changed"
)
==
0
)
{
int
deactivate
=
0
;
if
(
!
v
)
{
/* delatter is used to invalidate the object
...
...
@@ -631,13 +632,37 @@ _setattro(cPersistentObject *self, PyObject *oname, PyObject *v,
*/
if
(
self
->
state
!=
cPersistent_GHOST_STATE
)
self
->
state
=
cPersistent_UPTODATE_STATE
;
v
=
Py_None
;
deactivate
=
1
;
}
if
(
v
==
Py_None
)
else
if
(
v
==
Py_None
)
deactivate
=
1
;
if
(
deactivate
)
{
v
=
PyObject_GetAttr
(
OBJECT
(
self
),
py__p_deactivate
);
if
(
v
)
{
ASSIGN
(
v
,
PyObject_CallObject
(
v
,
NULL
));
}
if
(
v
)
{
Py_DECREF
(
v
);
}
PyObject
*
res
;
PyObject
*
meth
=
PyObject_GetAttr
(
OBJECT
(
self
),
py__p_deactivate
);
if
(
meth
==
NULL
)
return
-
1
;
res
=
PyObject_CallObject
(
meth
,
NULL
);
if
(
res
)
{
Py_DECREF
(
res
);
}
else
{
/* an error occured in _p_deactivate().
It's not clear what we should do here. The code is
obviously ignoring the exception, but it shouldn't
return 0 for a getattr and set an exception. The
simplest change is to clear the exception, but that
simply masks the error.
XXX We'll print an error to stderr just like
exceptions in __del__(). It would probably be
better to log it but that would be painful from C.
*/
PyErr_WriteUnraisable
(
meth
);
}
Py_DECREF
(
meth
);
return
0
;
}
if
(
PyObject_IsTrue
(
v
))
return
changed
(
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