[glom/boostpythonretry] More blind hackery
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom/boostpythonretry] More blind hackery
- Date: Tue, 2 Feb 2010 22:33:56 +0000 (UTC)
commit 0c7279dfa65fe9c147a8fcbaacaecce0fc411db3
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Feb 2 23:33:49 2010 +0100
More blind hackery
glom/libglom/python_embed/py_glom_record.cc | 4 +++-
glom/python_embed/glom_python.cc | 12 +++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/glom/libglom/python_embed/py_glom_record.cc b/glom/libglom/python_embed/py_glom_record.cc
index 5d8b7e2..d83eb77 100644
--- a/glom/libglom/python_embed/py_glom_record.cc
+++ b/glom/libglom/python_embed/py_glom_record.cc
@@ -115,7 +115,9 @@ boost::python::object PyGlomRecord::getitem(boost::python::object cppitem)
void PyGlomRecord_SetFields(PyGlomRecord* self, const PyGlomRecord::type_map_field_values& field_values, Document* document, const Glib::ustring& table_name, const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection)
{
- self->m_map_field_values = field_values; //This was allocated in Record_new().
+ g_assert(self);
+
+ self->m_map_field_values = field_values;
self->m_table_name = table_name;
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index 1492d65..0b6a12b 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -261,7 +261,7 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
}
//Create the function definition:
- //PyObject* pyValue = PyRun_String(func_def.c_str(), Py_file_input, pDict.ptr(), pDict.ptr());
+ /*
boost::python::object pyValue;
try
{
@@ -269,9 +269,15 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
}
catch(const boost::python::error_already_set& ex)
{
- ShowTrace();
+ std::cerr << "Glom: boost::python::eval() threw boost::python_error_already_set." << std::endl;
+ HandlePythonError();
}
-
+ */
+ PyObject* pyValueC = PyRun_String(func_def.c_str(), Py_file_input,
+ boost::python::get_managed_object(pDict, boost::python::tag),
+ boost::python::get_managed_object(pDict, boost::python::tag) );
+ boost::python::handle<> handle(pyValueC);
+ boost::python::object pyValue(handle);
if(!pyValue)
{
ShowTrace();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]