Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nicolas Wavrant
ZODB
Commits
6b975ad4
Commit
6b975ad4
authored
22 years ago
by
Jeremy Hylton
Browse files
Options
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/1
4 15:34:30
jeremy Exp $
\n
"
;
"$Id: cPersistence.c,v 1.6
2
2002/06/1
8 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
);
...
...
This diff is collapsed.
Click to expand it.
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/1
4 15:34:30
jeremy Exp $
\n
"
;
"$Id: cPersistence.c,v 1.6
2
2002/06/1
8 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
);
...
...
This diff is collapsed.
Click to expand it.
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/1
4 15:34:30
jeremy Exp $
\n
"
;
"$Id: cPersistence.c,v 1.6
2
2002/06/1
8 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
);
...
...
This diff is collapsed.
Click to expand it.
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