Subject: Re: Perl + Python Postgresql 7.1.1 under Cygwin
From: Jason Tishler <[email-masked]>
To: Ernesto Revilla <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Fri, 11 May 2001 11:26:13 -0400

Erny,

On Fri, May 11, 2001 at 01:21:07AM +0200, Ernesto Revilla wrote:
> For the Python interface to compile, I had to add the -DMS_WIN32 in the
> Makefile.pre.in . If not a 'not constant type' happens in pgmodule.c line
> 951.  I don't know if there is a better place tu put the def. After this it
> compiles and seems to work well. I used Python 2.1.

While changing Cygwin Python to build its core as a DLL (like Win32
Python) to support shared extension modules, I have learned that Guido
prefers the style of the attached patch to solve the above problem.
I feel that this solution is particularly appropriate in this case
because the following:

    PglargeType
    PgType
    PgQueryType

are already being handled in the way that I am proposing for PgSourceType.

I will submit this patch to pgsql-patches for consideration.

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: pgmodule.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/python/pgmodule.c,v
retrieving revision 1.18
diff -u -p -r1.18 pgmodule.c
--- pgmodule.c	2001/05/02 11:17:24	1.18
+++ pgmodule.c	2001/05/11 12:01:03
@@ -947,11 +947,7 @@ pgsource_print(pgsourceobject * self, FI
 
 /* query type definition */
 staticforward PyTypeObject PgSourceType = {
-#ifndef MS_WIN32
-	PyObject_HEAD_INIT(&PyType_Type)
-#else
 	PyObject_HEAD_INIT(NULL)
-#endif
 
 	0,							/* ob_size */
 	"pgsourceobject",			/* tp_name */
@@ -3141,7 +3137,8 @@ init_pg(void)
 			   *v;
 
 	/* Initialize here because some WIN platforms get confused otherwise */
-	PglargeType.ob_type = PgType.ob_type = PgQueryType.ob_type = &PyType_Type;
+	PglargeType.ob_type = PgType.ob_type = PgQueryType.ob_type =
+		PgSourceType.ob_type = &PyType_Type;
 
 	/* Create the module and add the functions */
 	mod = Py_InitModule4("_pg", pg_methods, pg__doc__, NULL, PYTHON_API_VERSION);

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