delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/01/01/13:33:52

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8DBE3846410
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1609525991;
bh=xe5T0BpyXWJfABeSXTqv2qfEZv6R5iu5DvMPKTu2xzY=;
h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=QziTCSsdJ8+vXq3lNCmcI4izeLli1Y+2qi9X3IrFDZe9eFUAHVSQGXlXyoOZ4A5iX
FLEdDwSRAh5BhtCK+7sj173wbeZ+AE3gCLY6gQY4FKAHYXXEhCvqaxxU9QpIczXVLx
cbEayKxNXQdimeBKOwCK3BcDmR9QLAUKrm3G4N7A=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 945743850410
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:subject:to:message-id:date:user-agent
:mime-version:content-language:content-transfer-encoding;
bh=j8fI7UmXDq5Dk8Flpvgh+hDkqR9ysAmKC+YH0QcvYfM=;
b=VnaUKqWjnGeMt60OK33PYfG9Nm5SDdfL2LGf1kEZ6yb/JlbWMhi4XdvIbZ2P3oy98B
aZXJk2E03KeTmmAtuYmbPFcFN4/LUZVC5JNLyh0DwHrfkJikphZ7A7gHK05Muhdd6hbl
bUe556dYaxungfXYaOdKYjb+xZo8/uqVqT+AD8UV1LbiUsnr5jahoc2V+Fo/hu6tRVzm
FpLmu12WjS/wr4RECaWf05Hs+LPnr4tQWSpHmeUX6iKAQ3VbceZEtojvWztInPIq3YVx
pIIMyckPAtLF0WbrqtqAAXBUWA17F3qjxcoUMU+5HdZvGlEtnr/BK72rGh0AVpAqk8PA
ZFgg==
X-Gm-Message-State: AOAM5327GStOnr19qd8qarxzE+8xSGqlm/LaVeMqBjJQFnuTS1ORw30x
PCgcnT8UytxeLUMqvInfKMR330KW41n1Jw==
X-Google-Smtp-Source: ABdhPJxkBCaAOfFbWTCvXqBjiIkUYT90gqBojQbH7lfSiw5qC7u2TQqcoCCTDWj1PWlv5eSCgweqFg==
X-Received: by 2002:a17:906:8051:: with SMTP id
x17mr55799544ejw.430.1609525985616;
Fri, 01 Jan 2021 10:33:05 -0800 (PST)
Subject: python header puzzle
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Message-ID: <3c67977a-f7d6-c7bd-2397-b33ed4fba049@gmail.com>
Date: Fri, 1 Jan 2021 19:33:03 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.6.0
MIME-Version: 1.0
X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM,
RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Marco Atzeri via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Marco Atzeri <marco DOT atzeri AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

Hi All,

trying to build postgresql 12.X with python3 interface, I hit an
interesting issue

all headers
/usr/include/python{3.6-3.8}/pyport.h

are including

#                       if defined(__CYGWIN__)
#                               define PyMODINIT_FUNC 
__declspec(dllexport) PyObject*
#                       else /* __CYGWIN__ */
#                               define PyMODINIT_FUNC PyObject*
#                       endif /* __CYGWIN__ */

and the postgresql python 3 interface has in the code and the header
src/pl/plpython/plpy_plpymodule.{h,c}

the following lines:

PyMODINIT_FUNC PyInit_plpy(void);

PyMODINIT_FUNC PyInit_plpy(void)...

Unfortunately the shared lib produced is crippled and does not
export correctly the symbols.

Changing the lines in

extern PyObject* PyInit_plpy(void);

PyObject* PyInit_plpy(void)..

solves the problem and pass all tests.

At first glance the Python headers seem the wrong one; the postgresql
code has no special  CYGWIN handling in that point, just the note

  * Must have external linkage, because PyMODINIT_FUNC does dllexport on
  * Windows-like platforms.

Comments ?
Any one seeing similar issue with Python3 code ?

For what I see the usage of PyMODINIT_FUNC is very limited
only python-cffi and python-lxml seem to use it in their headers


Regards

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019