Subject: Re: PL/Python Postgresql 7.1.1 under Cygwin (with attachment)
From: Jason Tishler <[email-masked]>
To: Ernesto Revilla <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 14 May 2001 10:26:39 -0400

Erny,

[OK, let's try again with the attachment this time...]

On Fri, May 11, 2001 at 03:54:06AM +0200, Ernesto Revilla wrote:
> now I did it, so I wanted to ask
> 1. if somebody could merge my makefile with the original one
> 2. put the plpython into the postgres source tree 'pl' (as experimental or
> whatever)

It appears that plpython was recently (i.e., 2001/05/09) added to
PostgreSQL CVS.  So the above is not necessary.

However, a small patch is necessary for plpython to build cleanly under
Cygwin.  Please get the latest PostgreSQL from CVS and apply the
attached patch.  I ran the supplied test.sh and all tests passed with
the exception of the oid related ones (which is to be expected).

I would be very interested to hear if plpython works for you in a real
application, so please let me know.

I intend improve my patch as follows:

1. add -DUSE_DL_IMPORT to CPPFLAGS in a cleaner way
2. deal with the different socket module name in Python 1.5.x and 2.x,
if possible

I will also test it out on a non-Cygwin platform to make sure that I
didn't break anything on a UNIX platform.

Once the above is completed, I will submit the patch to pgsql-patches
for consideration.

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: [email-masked]
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com
Index: Makefile
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/pl/plpython/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- Makefile	2001/05/12 17:49:32	1.5
+++ Makefile	2001/05/14 14:07:10
@@ -5,7 +5,8 @@ top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global

-override CPPFLAGS := -I$(srcdir) -I$(python_includedir) $(CPPFLAGS)
+override CPPFLAGS := -I$(srcdir) -I$(python_includedir) $(CPPFLAGS) -DUSE_DL_IMPORT
+override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
 
 NAME = plpython
 SO_MAJOR_VERSION = 0
Index: feature.expected
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/pl/plpython/feature.expected,v
retrieving revision 1.2
diff -u -p -r1.2 feature.expected
--- feature.expected	2001/05/12 17:49:32	1.2
+++ feature.expected	2001/05/14 14:07:10
@@ -29,7 +29,7 @@ SELECT global_test_two();
 (1 row)
 
 SELECT import_fail();
-NOTICE:  ('import socket failed -- untrusted dynamic module: socket',)
+NOTICE:  ('import socket failed -- untrusted dynamic module: _socket',)
     import_fail     
 --------------------
  failed as expected
Index: plpython.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.2
diff -u -p -r1.2 plpython.c
--- plpython.c	2001/05/12 01:30:30	1.2
+++ plpython.c	2001/05/14 14:07:11
@@ -1534,7 +1534,7 @@ static PyObject *PLy_spi_execute_fetch_r

 PyTypeObject PLy_PlanType = {
-  PyObject_HEAD_INIT(&PyType_Type)
+  PyObject_HEAD_INIT(NULL)
   0,                               /*ob_size*/
   "PLyPlan",                       /*tp_name*/
   sizeof(PLyPlanObject),           /*tp_size*/
@@ -1577,7 +1577,7 @@ PySequenceMethods PLy_result_as_sequence
 };
 
 PyTypeObject PLy_ResultType = {
-  PyObject_HEAD_INIT(&PyType_Type)
+  PyObject_HEAD_INIT(NULL)
   0,                                 /*ob_size*/
   "PLyResult",                       /*tp_name*/
   sizeof(PLyResultObject),           /*tp_size*/
@@ -2287,6 +2287,7 @@ PLy_init_plpy(void)
 
   /* initialize plpy module
    */
+  PLy_PlanType.ob_type = PLy_ResultType.ob_type = &PyType_Type;
   plpy = Py_InitModule("plpy", PLy_methods);
   plpy_dict = PyModule_GetDict(plpy);

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple