Re: python module patch

2007-08-20 Thread Jason Tishler
On Sun, Aug 19, 2007 at 11:46:27AM +0200, Reini Urban wrote:
> Yaakov (Cygwin Ports) schrieb:
> >Reini Urban wrote:
> >>extern __declspec(dllexport) cannot be used as constant during
> >>compile-time.
> >>=> "initializer element is not constant"
> >>cygwin auto-import feature get's that right at link-time.
> >>
> >>This is needed for the constant (compile-time) resolution of
> >>PyObject_HEAD_INIT(&PyType_Type) in a typical PyTypeObject struct.
> >
> >I believe the commonly accepted solution is to change this to
> >PyObject_HEAD_INIT(NULL) in the struct.
> >
> >http://starship.python.net/crew/mwh/toext/node20.html
> 
> Indeed. That sounds better.

FWIW, I concur too.

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: python module patch

2007-08-19 Thread Reini Urban

Yaakov (Cygwin Ports) schrieb:

Reini Urban wrote:

extern __declspec(dllexport) cannot be used as constant during
compile-time.
=> "initializer element is not constant"
cygwin auto-import feature get's that right at link-time.

This is needed for the constant (compile-time) resolution of
PyObject_HEAD_INIT(&PyType_Type) in a typical PyTypeObject struct.


I believe the commonly accepted solution is to change this to
PyObject_HEAD_INIT(NULL) in the struct.

http://starship.python.net/crew/mwh/toext/node20.html


Indeed. That sounds better.
--
Reini Urban

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: python module patch

2007-08-18 Thread Yaakov (Cygwin Ports)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Reini Urban wrote:
> extern __declspec(dllexport) cannot be used as constant during
> compile-time.
> => "initializer element is not constant"
> cygwin auto-import feature get's that right at link-time.
> 
> This is needed for the constant (compile-time) resolution of
> PyObject_HEAD_INIT(&PyType_Type) in a typical PyTypeObject struct.

I believe the commonly accepted solution is to change this to
PyObject_HEAD_INIT(NULL) in the struct.

http://starship.python.net/crew/mwh/toext/node20.html


Yaakov


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGx8VzpiWmPGlmQSMRCLlxAKCCTgwgX9MjeFYKP8TZzuGx0wuOFgCeLaQl
g3scbbc36HcUr6u8uLFnZkU=
=/p7G
-END PGP SIGNATURE-

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



python module patch

2007-08-18 Thread Reini Urban

On order to compile some python modules I needed the attached patch.
Can the maintainer confirm this? Or Yaakov?

extern __declspec(dllexport) cannot be used as constant during compile-time.
=> "initializer element is not constant"
cygwin auto-import feature get's that right at link-time.

This is needed for the constant (compile-time) resolution of 
PyObject_HEAD_INIT(&PyType_Type) in a typical PyTypeObject struct.


As workaround overriding this in object.h helped also:

diff -ub /usr/include/python2.5/object.h.orig 
/usr/include/python2.5/object.h
--- /usr/include/python2.5/object.h.orig2007-06-20 
03:57:08.00100 +

+++ /usr/include/python2.5/object.h 2007-08-18 10:37:03.93750 +
@@ -372,7 +372,7 @@
 #define PyObject_TypeCheck(ob, tp) \
((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp)))

-PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
+extern PyTypeObject PyType_Type; /* built-in 'type' */
 PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
 PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */


--
Reini Urban
http://phpwiki.org/  http://murbreak.at/
http://helsinki.at/  http://spacemovie.mur.at/
difforig /usr/include/python2.5

2007-08-18  Reini Urban <[EMAIL PROTECTED]>

diff -ub  /usr/include/python2.5/pyport.h.orig
--- /usr/include/python2.5/pyport.h.orig2007-06-20 03:57:09.00100 
+
+++ /usr/include/python2.5/pyport.h 2007-08-18 10:38:12.140625000 +
@@ -609,12 +609,13 @@
 #  if defined(HAVE_DECLSPEC_DLL)
 #  ifdef Py_BUILD_CORE
 #  define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
-#  define PyAPI_DATA(RTYPE) extern __declspec(dllexport) 
RTYPE
/* module init functions inside the core need no 
external linkage */
/* except for Cygwin to handle embedding (FIXME: BeOS 
too?) */
 #  if defined(__CYGWIN__)
+#  define PyAPI_DATA(RTYPE) extern RTYPE
 #  define PyMODINIT_FUNC __declspec(dllexport) void
 #  else /* __CYGWIN__ */
+#  define PyAPI_DATA(RTYPE) extern 
__declspec(dllexport) RTYPE
 #  define PyMODINIT_FUNC void
 #  endif /* __CYGWIN__ */
 #  else /* Py_BUILD_CORE */

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/