Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80209
| 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 | 2014-11-04 12:28 -0500 |
| Subject | Re: Python extension using a C library with one 'hello' function |
| From | Jason Swails <jason.swails@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15458.1415122451.18130.python-list@python.org> (permalink) |
[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
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