aboutsummaryrefslogtreecommitdiffstats
path: root/databases
diff options
context:
space:
mode:
authorpav <pav@FreeBSD.org>2007-09-05 16:17:44 +0800
committerpav <pav@FreeBSD.org>2007-09-05 16:17:44 +0800
commit554147cb29593b9e8f20b0f9e41163f1b344fd4a (patch)
tree94a37123731877cb0e897481b3b05fb8b187c94d /databases
parent5daeb20a226f9d5ed6b7a3590a03d30a603d71ed (diff)
downloadfreebsd-ports-gnome-554147cb29593b9e8f20b0f9e41163f1b344fd4a.tar.gz
freebsd-ports-gnome-554147cb29593b9e8f20b0f9e41163f1b344fd4a.tar.zst
freebsd-ports-gnome-554147cb29593b9e8f20b0f9e41163f1b344fd4a.zip
- Fix build with python25
PR: ports/115980 Submitted by: Scot Hetzel <swhetzel@gmail.com> Obtained from: vendor SVN
Diffstat (limited to 'databases')
-rw-r--r--databases/glom/files/patch-glom-libglom-python_embed-py_glom_record.cc153
-rw-r--r--databases/glom/files/patch-glom-libglom-python_embed-py_glom_related.cc170
-rw-r--r--databases/glom/files/patch-glom-libglom-python_embed-py_glom_relatedrecord.cc153
3 files changed, 468 insertions, 8 deletions
diff --git a/databases/glom/files/patch-glom-libglom-python_embed-py_glom_record.cc b/databases/glom/files/patch-glom-libglom-python_embed-py_glom_record.cc
index a83ec8738c29..24ce492ec3a0 100644
--- a/databases/glom/files/patch-glom-libglom-python_embed-py_glom_record.cc
+++ b/databases/glom/files/patch-glom-libglom-python_embed-py_glom_record.cc
@@ -1,20 +1,157 @@
---- glom/libglom/python_embed/py_glom_record.cc.orig Sun Jul 15 13:34:18 2007
-+++ glom/libglom/python_embed/py_glom_record.cc Sun Jul 15 13:34:44 2007
-@@ -122,7 +122,7 @@
+--- glom/libglom/python_embed/py_glom_record.cc.orig 2006-04-28 03:12:31.000000000 -0500
++++ glom/libglom/python_embed/py_glom_record.cc 2007-09-05 00:21:02.305894450 -0500
+@@ -50,51 +50,57 @@
+ //Set the object's member data, from the parameters supplied when creating the object:
+ static int
+-Record_init(PyGlomRecord *self, PyObject * /* args */, PyObject * /* kwds */)
++Record_init(PyObject *self, PyObject * /* args */, PyObject * /* kwds */)
+ {
++ PyGlomRecord *self_record = (PyGlomRecord*)self;
++
+ //static char *kwlist[] = {"test", NULL};
+
+ //if(!PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist,
+ // &self->m_test))
+ // return -1;
+
+- if(self)
++ if(self_record)
+ {
+- self->m_related = 0;
++ self_record->m_related = 0;
+
+- if(self->m_pMap_field_values == 0)
+- self->m_pMap_field_values = new PyGlomRecord::type_map_field_values();
++ if(self_record->m_pMap_field_values == 0)
++ self_record->m_pMap_field_values = new PyGlomRecord::type_map_field_values();
+ }
+
+ return 0;
+ }
+
+ static void
+-Record_dealloc(PyGlomRecord* self)
++Record_dealloc(PyObject* self)
+ {
+- if(self->m_pMap_field_values)
++ PyGlomRecord *self_record = (PyGlomRecord*)self;
++
++ if(self_record->m_pMap_field_values)
+ {
+- delete self->m_pMap_field_values;
+- self->m_pMap_field_values = 0;
++ delete self_record->m_pMap_field_values;
++ self_record->m_pMap_field_values = 0;
+ }
+
+- self->ob_type->tp_free((PyObject*)self);
++ self_record->ob_type->tp_free((PyObject*)self);
+ }
+
+
+ static PyObject *
+-Record__get_related(PyGlomRecord* self, void* /* closure */)
++Record__get_related(PyObject* self, void* /* closure */)
+ {
++ PyGlomRecord *self_record = (PyGlomRecord*)self;
++
+ //We initialize it here, so that this work never happens if it's not needed:
+- if(!(self->m_related))
++ if(!(self_record->m_related))
+ {
+ //Return a new RelatedRecord:
+ PyObject* new_args = PyTuple_New(0);
+- self->m_related = (PyGlomRelated*)PyObject_Call((PyObject*)PyGlomRelated_GetPyType(), new_args, 0);
++ self_record->m_related = (PyGlomRelated*)PyObject_Call((PyObject*)PyGlomRelated_GetPyType(), new_args, 0);
+ Py_DECREF(new_args);
+
+ //Fill it:
+- Document_Glom::type_vecRelationships vecRelationships = self->m_document->get_relationships(*(self->m_table_name));
++ Document_Glom::type_vecRelationships vecRelationships = self_record->m_document->get_relationships(*(self_record->m_table_name));
+ PyGlomRelated::type_map_relationships map_relationships;
+ for(Document_Glom::type_vecRelationships::const_iterator iter = vecRelationships.begin(); iter != vecRelationships.end(); ++iter)
+ {
+@@ -102,14 +108,14 @@
+ map_relationships[(*iter)->get_name()] = *iter;
+ }
+- PyGlomRelated_SetRelationships(self->m_related, map_relationships);
++ PyGlomRelated_SetRelationships(self_record->m_related, map_relationships);
--static int
+- self->m_related->m_record = self;
+- Py_XINCREF(self); //unreffed in the self->m_related's _dealloc. //TODO: Is this a circular reference?
++ self_record->m_related->m_record = self_record;
++ Py_XINCREF(self_record); //unreffed in the self->m_related's _dealloc. //TODO: Is this a circular reference?
+ }
+
+- Py_INCREF(self->m_related); //Should we do this?
+- return (PyObject*)self->m_related;
++ Py_INCREF(self_record->m_related); //Should we do this?
++ return (PyObject*)self_record->m_related;
+ }
+
+
+@@ -122,31 +128,44 @@
+
+
+
++//Adapt to API changes in Python 2.5:
++#if defined(PY_VERSION_HEX) && (PY_VERSION_HEX >= 0x02050000) /* Python 2.5+ */
+static Py_ssize_t
- Record_tp_as_mapping_length(PyGlomRecord *self)
++Record_tp_as_mapping_length(PyObject *self)
++{
++ PyGlomRecord *self_record = (PyGlomRecord*)self;
++ return self_record->m_pMap_field_values->size();
++}
++#else
+ static int
+-Record_tp_as_mapping_length(PyGlomRecord *self)
++Record_tp_as_mapping_length(PyObject *self)
{
- return self->m_pMap_field_values->size();
-@@ -146,7 +146,7 @@
+- return self->m_pMap_field_values->size();
++ PyGlomRecord *self_record = (PyGlomRecord*)self;
++ return (int)(self->m_pMap_field_values->size());
+ }
++#endif
+
+ static PyObject *
+-Record_tp_as_mapping_getitem(PyGlomRecord *self, PyObject *item)
++Record_tp_as_mapping_getitem(PyObject *self, PyObject *item)
+ {
++ PyGlomRecord *self_record = (PyGlomRecord*)self;
++
+ if(PyString_Check(item))
+ {
+ const char* pchKey = PyString_AsString(item);
+ if(pchKey)
+ {
+ const Glib::ustring key(pchKey);
+- if(self && self->m_pMap_field_values)
++ if(self_record && self_record->m_pMap_field_values)
+ {
+- PyGlomRecord::type_map_field_values::const_iterator iterFind = self->m_pMap_field_values->find(key);
+- if(iterFind != self->m_pMap_field_values->end())
++ PyGlomRecord::type_map_field_values::const_iterator iterFind = self_record->m_pMap_field_values->find(key);
++ if(iterFind != self_record->m_pMap_field_values->end())
+ {
+ return pygda_value_as_pyobject(iterFind->second.gobj(), true /* copy */);
}
else
{
- g_warning("Record_tp_as_mapping_getitem(): item not found in m_pMap_field_values. size=%d, item=%s", self->m_pMap_field_values->size(), pchKey);
-+ g_warning("Record_tp_as_mapping_getitem(): item not found in m_pMap_field_values. size=%d, item=%s", (int)self->m_pMap_field_values->size(), pchKey);
++ g_warning("Record_tp_as_mapping_getitem(): item not found in m_pMap_field_values. size=%d, item=%s", (int)self_record->m_pMap_field_values->size(), pchKey);
}
}
else
+@@ -180,8 +199,8 @@
+ */
+
+ static PyMappingMethods Record_tp_as_mapping = {
+- (inquiry)Record_tp_as_mapping_length,
+- (binaryfunc)Record_tp_as_mapping_getitem,
++ Record_tp_as_mapping_length,
++ Record_tp_as_mapping_getitem,
+ (objobjargproc)0 /* Record_tp_as_mapping_setitem */
+ };
+
diff --git a/databases/glom/files/patch-glom-libglom-python_embed-py_glom_related.cc b/databases/glom/files/patch-glom-libglom-python_embed-py_glom_related.cc
new file mode 100644
index 000000000000..206b2133b49e
--- /dev/null
+++ b/databases/glom/files/patch-glom-libglom-python_embed-py_glom_related.cc
@@ -0,0 +1,170 @@
+--- glom/libglom/python_embed/py_glom_related.cc.orig 2006-05-20 06:35:32.000000000 -0500
++++ glom/libglom/python_embed/py_glom_related.cc 2007-09-05 00:42:52.657306150 -0500
+@@ -52,62 +52,79 @@
+
+ //Set the object's member data, from the parameters supplied when creating the object:
+ static int
+-Related_init(PyGlomRelated *self, PyObject* /* args */, PyObject* /* kwds */)
++Related_init(PyObject *self, PyObject* /* args */, PyObject* /* kwds */)
+ {
+- if(self)
++ PyGlomRelated *self_related = (PyGlomRelated*)self;
++
++ if(self_related)
+ {
+- self->m_record = 0;
++ self_related->m_record = 0;
+
+- if(self->m_pMap_relationships == 0)
+- self->m_pMap_relationships = new PyGlomRelated::type_map_relationships();
++ if(self_related->m_pMap_relationships == 0)
++ self_related->m_pMap_relationships = new PyGlomRelated::type_map_relationships();
+
+- if(self->m_pMap_relatedrecords == 0)
+- self->m_pMap_relatedrecords = new PyGlomRelated::type_map_relatedrecords();
++ if(self_related->m_pMap_relatedrecords == 0)
++ self_related->m_pMap_relatedrecords = new PyGlomRelated::type_map_relatedrecords();
+ }
+
+ return 0;
+ }
+
+ static void
+-Related_dealloc(PyGlomRelated* self)
++Related_dealloc(PyObject* self)
+ {
+- if(self->m_pMap_relationships)
++ PyGlomRelated *self_related = (PyGlomRelated*)self;
++
++ if(self_related->m_pMap_relationships)
+ {
+- delete self->m_pMap_relationships;
+- self->m_pMap_relationships = 0;
++ delete self_related->m_pMap_relationships;
++ self_related->m_pMap_relationships = 0;
+ }
+
+- if(self->m_record)
++ if(self_related->m_record)
+ {
+- Py_XDECREF( (PyObject*)self->m_record );
+- self->m_record = 0;
++ Py_XDECREF( (PyObject*)self_related->m_record );
++ self_related->m_record = 0;
+ }
+
+- if(self->m_pMap_relatedrecords)
++ if(self_related->m_pMap_relatedrecords)
+ {
+ //Unref each item:
+- for(PyGlomRelated::type_map_relatedrecords::iterator iter = self->m_pMap_relatedrecords->begin(); iter != self->m_pMap_relatedrecords->end(); ++iter)
++ for(PyGlomRelated::type_map_relatedrecords::iterator iter = self_related->m_pMap_relatedrecords->begin(); iter != self_related->m_pMap_relatedrecords->end(); ++iter)
+ {
+ Py_XDECREF( (PyObject*)(iter->second) );
+ }
+
+- delete self->m_pMap_relatedrecords;
+- self->m_pMap_relatedrecords = 0;
++ delete self_related->m_pMap_relatedrecords;
++ self_related->m_pMap_relatedrecords = 0;
+ }
+
+- self->ob_type->tp_free((PyObject*)self);
++ self_related->ob_type->tp_free((PyObject*)self);
+ }
+
+
++//Adapt to API changes in Python 2.5:
++#if defined(PY_VERSION_HEX) && (PY_VERSION_HEX >= 0x02050000) /* Python 2.5 */
++static Py_ssize_t
++Related_tp_as_mapping_length(PyObject *self)
++{
++ PyGlomRelated *self_related = (PyGlomRelated*)self;
++ return self_related->m_pMap_relationships->size();
++}
++#else
+ static int
+-Related_tp_as_mapping_length(PyGlomRelated *self)
++Related_tp_as_mapping_length(PyObject *self)
+ {
+- return self->m_pMap_relationships->size();
++ PyGlomRelated *self_related = (PyGlomRelated*)self;
++ return self_related->m_pMap_relationships->size();
+ }
++#endif
+
+ static PyObject *
+-Related_tp_as_mapping_getitem(PyGlomRelated *self, PyObject *item)
++Related_tp_as_mapping_getitem(PyObject *self, PyObject *item)
+ {
++ PyGlomRelated *self_related = (PyGlomRelated*)self;
++
+ if(PyString_Check(item))
+ {
+ const char* pchKey = PyString_AsString(item);
+@@ -116,8 +133,8 @@
+ const Glib::ustring key(pchKey);
+
+ //Return a cached item if possible:
+- PyGlomRelated::type_map_relatedrecords::iterator iterCacheFind = self->m_pMap_relatedrecords->find(key);
+- if(iterCacheFind != self->m_pMap_relatedrecords->end())
++ PyGlomRelated::type_map_relatedrecords::iterator iterCacheFind = self_related->m_pMap_relatedrecords->find(key);
++ if(iterCacheFind != self_related->m_pMap_relatedrecords->end())
+ {
+ //Return a reference to the cached item:
+ PyGlomRelatedRecord* pyRelatedRecord = iterCacheFind->second;
+@@ -127,8 +144,8 @@
+ else
+ {
+ //If the relationship exists:
+- PyGlomRelated::type_map_relationships::const_iterator iterFind = self->m_pMap_relationships->find(key);
+- if(iterFind != self->m_pMap_relationships->end())
++ PyGlomRelated::type_map_relationships::const_iterator iterFind = self_related->m_pMap_relationships->find(key);
++ if(iterFind != self_related->m_pMap_relationships->end())
+ {
+ //Return a new RelatedRecord:
+ PyObject* new_args = PyTuple_New(0);
+@@ -140,15 +157,15 @@
+ //Get the value of the from_key in the parent record.
+ sharedptr<Relationship> relationship = iterFind->second;
+ const Glib::ustring from_key = relationship->get_from_field();
+- PyGlomRecord::type_map_field_values::const_iterator iterFromKey = self->m_record->m_pMap_field_values->find(from_key);
+- if(iterFromKey != self->m_record->m_pMap_field_values->end())
++ PyGlomRecord::type_map_field_values::const_iterator iterFromKey = self_related->m_record->m_pMap_field_values->find(from_key);
++ if(iterFromKey != self_related->m_record->m_pMap_field_values->end())
+ {
+ const Gnome::Gda::Value from_key_value = iterFromKey->second;
+
+ //TODO_Performance:
+ //Get the full field details so we can sqlize its value:
+ sharedptr<Field> from_key_field;
+- from_key_field = self->m_record->m_document->get_field(*(self->m_record->m_table_name), from_key);
++ from_key_field = self_related->m_record->m_document->get_field(*(self_related->m_record->m_table_name), from_key);
+ if(from_key_field)
+ {
+ Glib::ustring key_value_sqlized;
+@@ -157,11 +174,11 @@
+ if(!GlomConversions::value_is_empty(from_key_value)) //Do not link on null-values. That would cause us to link on 0, or "0".
+ key_value_sqlized = from_key_field->sql(from_key_value);
+
+- PyGlomRelatedRecord_SetRelationship(pyRelatedRecord, iterFind->second, key_value_sqlized, self->m_record->m_document);
++ PyGlomRelatedRecord_SetRelationship(pyRelatedRecord, iterFind->second, key_value_sqlized, self_related->m_record->m_document);
+
+ //Store it in the cache:
+ Py_INCREF((PyObject*)pyRelatedRecord); //Dereferenced in _dealloc().
+- (*(self->m_pMap_relatedrecords))[key] = pyRelatedRecord;
++ (*(self_related->m_pMap_relatedrecords))[key] = pyRelatedRecord;
+
+ return (PyObject*)pyRelatedRecord; //TODO: pygda_value_as_pyobject(iterFind->second.gobj(), true /* copy */);
+ }
+@@ -185,8 +202,8 @@
+ */
+
+ static PyMappingMethods Related_tp_as_mapping = {
+- (inquiry)Related_tp_as_mapping_length,
+- (binaryfunc)Related_tp_as_mapping_getitem,
++ Related_tp_as_mapping_length,
++ Related_tp_as_mapping_getitem,
+ (objobjargproc)0 /* Related_tp_as_mapping_setitem */
+ };
+
diff --git a/databases/glom/files/patch-glom-libglom-python_embed-py_glom_relatedrecord.cc b/databases/glom/files/patch-glom-libglom-python_embed-py_glom_relatedrecord.cc
new file mode 100644
index 000000000000..43f0df8e9706
--- /dev/null
+++ b/databases/glom/files/patch-glom-libglom-python_embed-py_glom_relatedrecord.cc
@@ -0,0 +1,153 @@
+--- glom/libglom/python_embed/py_glom_relatedrecord.cc.orig 2006-05-20 06:35:36.000000000 -0500
++++ glom/libglom/python_embed/py_glom_relatedrecord.cc 2007-09-05 01:02:13.606806043 -0500
+@@ -137,11 +137,22 @@
+ */
+
+
++//Adapt to API changes in Python 2.5:
++#if defined(PY_VERSION_HEX) && (PY_VERSION_HEX >= 0x02050000) /* Python 2.5+ */
++static Py_ssize_t
++RelatedRecord_tp_as_mapping_length(PyObject *self)
++{
++ PyGlomRelatedRecord* self_derived = (PyGlomRelatedRecord*)self;
++ return self_derived->m_pMap_field_values->size();
++}
++#else
+ static int
+-RelatedRecord_tp_as_mapping_length(PyGlomRelatedRecord *self)
++RelatedRecord_tp_as_mapping_length(PyObject *self)
+ {
+- return self->m_pMap_field_values->size();
++ PyGlomRelatedRecord* self_derived = (PyGlomRelatedRecord*)self;
++ return (int)(self_derived->m_pMap_field_values->size());
+ }
++#endif
+
+ static void RelatedRecord_HandlePythonError()
+ {
+@@ -150,29 +161,31 @@
+ }
+
+ static PyObject *
+-RelatedRecord_tp_as_mapping_getitem(PyGlomRelatedRecord *self, PyObject *item)
++RelatedRecord_tp_as_mapping_getitem(PyObject *self, PyObject *item)
+ {
++ PyGlomRelatedRecord* self_derived = (PyGlomRelatedRecord*)self;
++
+ if(PyString_Check(item))
+ {
+ const char* pchKey = PyString_AsString(item);
+ if(pchKey)
+ {
+ const Glib::ustring field_name(pchKey);
+- PyGlomRelatedRecord::type_map_field_values::const_iterator iterFind = self->m_pMap_field_values->find(field_name);
+- if(iterFind != self->m_pMap_field_values->end())
++ PyGlomRelatedRecord::type_map_field_values::const_iterator iterFind = self_derived->m_pMap_field_values->find(field_name);
++ if(iterFind != self_derived->m_pMap_field_values->end())
+ {
+ //If the value has already been stored, then just return it again:
+ return pygda_value_as_pyobject(iterFind->second.gobj(), true /* copy */);
+ }
+ else
+ {
+- const Glib::ustring related_table = (*(self->m_relationship))->get_to_table();
++ const Glib::ustring related_table = (*(self_derived->m_relationship))->get_to_table();
+
+ //Check whether the field exists in the table.
+ //TODO_Performance: Do this without the useless Field information?
+- sharedptr<Field> field = self->m_document->get_field((*(self->m_relationship))->get_to_table(), field_name);
++ sharedptr<Field> field = self_derived->m_document->get_field((*(self_derived->m_relationship))->get_to_table(), field_name);
+ if(!field)
+- g_warning("RelatedRecord_tp_as_mapping_getitem: field %s not found in table %s", field_name.c_str(), (*(self->m_relationship))->get_to_table().c_str());
++ g_warning("RelatedRecord_tp_as_mapping_getitem: field %s not found in table %s", field_name.c_str(), (*(self_derived->m_relationship))->get_to_table().c_str());
+ else
+ {
+ //Try to get the value from the database:
+@@ -182,15 +195,15 @@
+ {
+ Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
+
+- const Glib::ustring related_key_name = (*(self->m_relationship))->get_to_field();
++ const Glib::ustring related_key_name = (*(self_derived->m_relationship))->get_to_field();
+
+ //Do not try to get a value based on a null key value:
+- if(!(self->m_from_key_value_sqlized))
++ if(!(self_derived->m_from_key_value_sqlized))
+ return Py_None;
+
+ //Get the single value from the related records:
+ Glib::ustring sql_query = "SELECT \"" + related_table + "\".\"" + field_name + "\" FROM \"" + related_table + "\""
+- + " WHERE \"" + related_table + "\".\"" + related_key_name + "\" = " + *(self->m_from_key_value_sqlized);
++ + " WHERE \"" + related_table + "\".\"" + related_key_name + "\" = " + *(self_derived->m_from_key_value_sqlized);
+
+ //std::cout << "PyGlomRelatedRecord: Executing: " << sql_query << std::endl;
+ Glib::RefPtr<Gnome::Gda::DataModel> datamodel = gda_connection->execute_single_command(sql_query);
+@@ -200,7 +213,7 @@
+ //g_warning("RelatedRecord_tp_as_mapping_getitem(): value from datamodel = %s", value.to_string().c_str());
+
+ //Cache it, in case it's asked-for again.
+- (*(self->m_pMap_field_values))[field_name] = value;
++ (*(self_derived->m_pMap_field_values))[field_name] = value;
+ return pygda_value_as_pyobject(value.gobj(), true /* copy */);
+ }
+ else if(!datamodel)
+@@ -211,7 +224,7 @@
+ }
+ else
+ {
+- g_warning("RelatedRecord_tp_as_mapping_getitem(): No related records exist yet for relationship %s.", (*(self->m_relationship))->get_name().c_str());
++ g_warning("RelatedRecord_tp_as_mapping_getitem(): No related records exist yet for relationship %s.", (*(self_derived->m_relationship))->get_name().c_str());
+ }
+ }
+ }
+@@ -234,8 +247,8 @@
+ */
+
+ static PyMappingMethods RelatedRecord_tp_as_mapping = {
+- (inquiry)RelatedRecord_tp_as_mapping_length,
+- (binaryfunc)RelatedRecord_tp_as_mapping_getitem,
++ RelatedRecord_tp_as_mapping_length,
++ RelatedRecord_tp_as_mapping_getitem,
+ (objobjargproc)0 /* RelatedRecord_tp_as_mapping_setitem */
+ };
+
+@@ -311,27 +324,31 @@
+ }
+
+ static PyObject *
+-RelatedRecord_sum(PyGlomRelatedRecord* self, PyObject *args, PyObject *kwargs)
++RelatedRecord_sum(PyObject* self, PyObject *args, PyObject *kwargs)
+ {
+- return RelatedRecord_generic_aggregate(self, args, kwargs, "sum");
++ PyGlomRelatedRecord* self_derived = (PyGlomRelatedRecord*)self;
++ return RelatedRecord_generic_aggregate(self_derived, args, kwargs, "sum");
+ }
+
+ static PyObject *
+-RelatedRecord_count(PyGlomRelatedRecord* self, PyObject *args, PyObject *kwargs)
++RelatedRecord_count(PyObject* self, PyObject *args, PyObject *kwargs)
+ {
+- return RelatedRecord_generic_aggregate(self, args, kwargs, "count");
++ PyGlomRelatedRecord* self_derived = (PyGlomRelatedRecord*)self;
++ return RelatedRecord_generic_aggregate(self_derived, args, kwargs, "count");
+ }
+
+ static PyObject *
+-RelatedRecord_min(PyGlomRelatedRecord* self, PyObject *args, PyObject *kwargs)
++RelatedRecord_min(PyObject* self, PyObject *args, PyObject *kwargs)
+ {
+- return RelatedRecord_generic_aggregate(self, args, kwargs, "min");
++ PyGlomRelatedRecord* self_derived = (PyGlomRelatedRecord*)self;
++ return RelatedRecord_generic_aggregate(self_derived, args, kwargs, "min");
+ }
+
+ static PyObject *
+-RelatedRecord_max(PyGlomRelatedRecord* self, PyObject *args, PyObject *kwargs)
++RelatedRecord_max(PyObject* self, PyObject *args, PyObject *kwargs)
+ {
+- return RelatedRecord_generic_aggregate(self, args, kwargs, "max");
++ PyGlomRelatedRecord* self_derived = (PyGlomRelatedRecord*)self;
++ return RelatedRecord_generic_aggregate(self_derived, args, kwargs, "max");
+ }
+
+ static PyMethodDef RelatedRecord_methods[] = {