[pygtk] [PATCH] pyg_value_as_pyobject returns for PY_TYPE_OBJECT

2002-06-14 Thread Matt Wilson

I believe that pyg_value_as_pyobj should return a valid PyObject* if a
GValue is holding a PY_TYPE_OBJECT.  This means we should translate
NULL returns to Py_None.

Comments before committing?

Cheers,

Matt


Index: ChangeLog
===
RCS file: /cvs/gnome/gnome-python/pygtk/ChangeLog,v
retrieving revision 1.412
diff -u -r1.412 ChangeLog
--- ChangeLog   11 Jun 2002 19:14:38 -  1.412
+++ ChangeLog   14 Jun 2002 20:39:15 -
@@ -1,3 +1,9 @@
+2002-06-14  Matt Wilson  [EMAIL PROTECTED]
+
+   * pygtype.c (pyg_value_as_pyobject): if a value holds a PyObject*,
+   the code that is getting the value is expecting a valid object.
+   Translate NULL pointers to Py_None.
+
 Fri Jun  7 12:39:27 2002  Jonathan Blandford  [EMAIL PROTECTED]
 
* gtk/gtk.override (pygtk_tree_selection_foreach_marshal): fix
Index: pygtype.c
===
RCS file: /cvs/gnome/gnome-python/pygtk/pygtype.c,v
retrieving revision 1.10
diff -u -r1.10 pygtype.c
--- pygtype.c   31 May 2002 19:59:47 -  1.10
+++ pygtype.c   14 Jun 2002 20:39:15 -
@@ -565,9 +565,15 @@
{
PyGBoxedMarshal *bm;
 
-   if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT))
-   return (PyObject *)g_value_dup_boxed(value);
-
+   if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) {
+   PyObject *ret = (PyObject *)g_value_dup_boxed(value);
+   if (ret == NULL) {
+   Py_INCREF(Py_None);
+   return Py_None;
+   }
+   return ret;
+   }
+   
bm = pyg_boxed_lookup(G_VALUE_TYPE(value));
if (bm)
return bm-fromvalue(value);



PyGTK versions and Redhat 7 (was Re: [pygtk] [PATCH] pyg_value_as_pyobject returns for PY_TYPE_OBJECT)

2002-06-14 Thread Christian Reis

On Fri, Jun 14, 2002 at 04:58:46PM -0400, Matt Wilson wrote:
 I believe that pyg_value_as_pyobj should return a valid PyObject* if a
 GValue is holding a PY_TYPE_OBJECT.  This means we should translate
 NULL returns to Py_None.

On an unrelated note, I have a small problem with Redhat that perhaps
you have an idea how to solve.

Our software product, Stoq, uses pygtk (not pygtk2), and is provided
with RPMs for most platforms. The recent Redhat versions, however,
install pygtk2 with the same name - gtk.py - which causes us much grief
over what version is installed, since we need pygtk-0.6.9 or compatible.

What do you think should be our approach? We can provide a pygtk RPM
separately, but then we would have to change the module names and it
would hassle us a bit. We could also provide a directory with our
packages and change pythonpath. What do you suggest?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/