[glom] Fix the crash when calling python functions that return dates.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom] Fix the crash when calling python functions that return dates.
- Date: Wed, 9 Dec 2009 09:18:11 +0000 (UTC)
commit bb9448a9b5d49704a008dd80f2defac081d935e7
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Dec 9 10:18:01 2009 +0100
Fix the crash when calling python functions that return dates.
* glom/libglom/python_embed/pygdavalue_conversions.c
(glom_pygda_value_from_pyobject): Call the macro PyDateTime_IMPORT here,
though it was already called in libglom_init(). I don't know why this
fixes the crash, but it does. Bug #603686. (Andrew Ruthven)
ChangeLog | 11 ++++++++++-
glom/libglom/python_embed/pygdavalue_conversions.c | 6 ++++++
2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7101dcc..6e0aa02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-12-09 Murray Cumming <murrayc murrayc com>
+
+ Fix the crash when calling python functions that return dates.
+
+ * glom/libglom/python_embed/pygdavalue_conversions.c
+ (glom_pygda_value_from_pyobject): Call the macro PyDateTime_IMPORT here,
+ though it was already called in libglom_init(). I don't know why this
+ fixes the crash, but it does. Bug #603686. (Andrew Ruthven)
+
2009-12-08 Murray Cumming <murrayc murrayc com>
Tests: Added glom_evaluate_python_function_implementation() tests.
@@ -6,7 +15,7 @@
* tests/test_python_execute_func.cc:
* tests/test_python_execute_func_date.cc: Added two unit tests for
Glom::glom_evaluate_python_function_implementation(). The date one
- currently fails, as in bug #603686.
+ currently fails, as in bug #603686. (Andrew Ruthven)
2009-12-07 Murray Cumming <murrayc murrayc com>
diff --git a/glom/libglom/python_embed/pygdavalue_conversions.c b/glom/libglom/python_embed/pygdavalue_conversions.c
index 31d6609..521286d 100644
--- a/glom/libglom/python_embed/pygdavalue_conversions.c
+++ b/glom/libglom/python_embed/pygdavalue_conversions.c
@@ -19,6 +19,12 @@
int
glom_pygda_value_from_pyobject(GValue *boxed, PyObject *input)
{
+ // We shouldn't need to call PyDateTime_IMPORT again,
+ // after already doing it in libglom_init(),
+ // but PyDate_Check crashes (with valgrind warnings) if we don't.
+ PyDateTime_IMPORT; //A macro, needed to use PyDate_Check(), PyDateTime_Check(), etc.
+ g_assert(PyDateTimeAPI); //This should have been set by the PyDateTime_IMPORT macro.
+
/* Use an appropriate gda_value_set_*() function.
We can not know what GValue type is actually wanted, so
we must still have the get_*() functions in the python API.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]