Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80209

Re: Python extension using a C library with one 'hello' function

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jason.swails@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'causing': 0.04; 'static': 0.04; 'subject:Python': 0.06; 'compiler': 0.07; 'debug': 0.07; "subject:' ": 0.07; 'arguments': 0.09; 'meaningful': 0.09; 'null,': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '11:09': 0.16; 'cc:name:python list': 0.16; 'linux).': 0.16; 'luck,': 0.16; 'subject:library': 0.16; 'symbols': 0.16; 'traceback.': 0.16; 'wrote:': 0.18; 'obviously': 0.18; '(but': 0.19; '3.0': 0.19; 'basically': 0.19; '>>>': 0.22; 'import': 0.22; 'aug': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'switched': 0.24; 'cc:2**0': 0.24; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; '(on': 0.31; '3.2': 0.31; 'flags': 0.31; 'gcc': 0.31; 'problem': 0.35; 'subject:with': 0.35; "can't": 0.35; 'problem.': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'subject:one': 0.36; 'doing': 0.36; 'skip:& 10': 0.38; 'jason': 0.38; 'nov': 0.38; 'files': 0.38; 'skip:& 20': 0.39; 'does': 0.39; 'bad': 0.39; 'sure': 0.39; 'university': 0.39; 'tell': 0.60; "you're": 0.61; 'field': 0.63; '8bit%:10': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'world': 0.66; '8bit%:21': 0.69; 'subject:hello': 0.83; '2014,': 0.84; '4.7': 0.84; 'lying': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SR3COWtOUtQx1FEKE9iqP7eNsY6iuE5VV6FUSpvlsdo=; b=PojmmgRj6BeW8pBsti+hbSRFaqOSlDda2aVGYuClNU0nUx0wxMquXCe71Y8gRHOPy6 qmp7X8pB7OHAs6EETQ8AllDV1xKxlH+FqKwEPTRN90gKzlenmJY5S2LT4Tg7Z1tHlMDQ ozL/dIZRJysx6RAdDACo4cMPJXj3H+e56V8JSHZsNM7X07j7J9ReiD+LB/aag4YJgEy7 SfdNBrNhyXvHvHBdoWLr69nBJhWNslrP6iCfnUyIfHyaIyl510POdbYHs0AtvZZyhLfM L2EwLFSVG9+p+oR7r3Zga9hQ2gg+D3i7MYUxbDHIO/pZH9HOuy1SNtnGjc7OUQ1ZLjvM XpPg==
MIME-Version 1.0
X-Received by 10.236.30.33 with SMTP id j21mr8867587yha.157.1415122084601; Tue, 04 Nov 2014 09:28:04 -0800 (PST)
In-Reply-To <m3b18q$cpe$1@dont-email.me>
References <m3ab5o$kuo$1@dont-email.me> <mailman.15452.1415115002.18130.python-list@python.org> <m3au1u$u36$1@dont-email.me> <mailman.15456.1415118546.18130.python-list@python.org> <m3b18q$cpe$1@dont-email.me>
Date Tue, 4 Nov 2014 12:28:04 -0500
Subject Re: Python extension using a C library with one 'hello' function
From Jason Swails <jason.swails@gmail.com>
To Veek M <vek.m1234@gmail.com>
Content-Type multipart/alternative; boundary=089e0116085c2aa6c505070bc991
Cc python list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15458.1415122451.18130.python-list@python.org> (permalink)
Lines 119
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415122451 news.xs4all.nl 2937 [2001:888:2000:d::a6]:60787
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80209

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Nov 4, 2014 at 11:09 AM, Veek M <vek.m1234@gmail.com> wrote:

> static PyMethodDef hellomethods[] = {
>     {"hello", py_hello, METH_VARARGS, py_hello_doc},
>     {NULL, NULL, 0, NULL},
> };
>
> It's basically the METH_VARARGS field that's giving the problem. Switching
> it to NULL gives,
> SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer
> supported!
>

​Yes, I got that problem too, which is why I switched it to METH_NOARGS.
​

> and METH_NOARGS doesn't work in 3.2
>

I
​t does for me:

​
Python 3.2.5 (default, Aug 24 2014, 10:06:23)
[GCC 4.7.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hello
>>> hello.hello()
hello world
0
>>>

​As you can see -- this is a Python 3.2 built with GCC 4.7 (On Gentoo
Linux).  It also works on Python 3.1 and 3.0 (but obviously doesn't work
for Python 2.X).  I can't tell why you're having so many problems...​  Try
doing a "git clean -fxd" to make sure you don't have leftover files lying
around somewhere that are causing grief.

Also, you need to add "-g" to the compiler arguments to make sure you build
with debug symbols if you want a meaningful traceback.

Good luck,
Jason

-- 
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 16:22 +0630
  Re: Python extension using a C library with one 'hello' function Chris Angelico <rosuav@gmail.com> - 2014-11-05 01:57 +1100
  Re: Python extension using a C library with one 'hello' function Søren <sd@syntonetic.com> - 2014-11-04 13:11 +0100
    Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 21:46 +0630
  Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 10:30 -0500
    Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 21:45 +0630
      Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 11:28 -0500
        Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 22:13 +0630
        Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 22:39 +0630
          Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 12:28 -0500
    Re: Python extension using a C library with one 'hello' function Veek M <vek.m1234@gmail.com> - 2014-11-04 23:03 +0630
      Re: Python extension using a C library with one 'hello' function Jason Swails <jason.swails@gmail.com> - 2014-11-04 13:28 -0500

csiph-web