Re: python C-api and thread

2024-08-06 Thread Barry Scott via Python-list
> On 6 Aug 2024, at 07:11, aotto1968 via Python-list > wrote: > > I know but I use a thread like a process because the "conversation" between > the threads is done by my > software. a Thread is usually faster to startup (thread-pool) this mean for > high-load this is > significant faster ev

Re: python C-api and thread

2024-08-06 Thread aotto1968 via Python-list
On 06.08.24 04:34, Grant Edwards wrote: On 2024-08-05, aotto1968 via Python-list wrote: Is it possible to run two completely independent Python interpreters in one process, each using a thread? By independent, I mean that no data is shared between the interpreters and thus the C API can be us

Re: python C-api and thread (Posting On Python-List Prohibited)

2024-08-06 Thread aotto1968 via Python-list
On 06.08.24 02:32, Lawrence D'Oliveiro wrote: On Mon, 5 Aug 2024 23:19:14 +0200, aotto1968 wrote: Is it possible to run two completely independent Python interpreters in one process, each using a thread? By independent, I mean that no data is shared between the interpreters and thus the C API

Re: python C-api and thread

2024-08-05 Thread Chris Angelico via Python-list
On Tue, 6 Aug 2024 at 08:48, aotto1968 via Python-list wrote: > > hi, > > Is it possible to run two completely independent Python interpreters in one > process, each using a thread? > > By independent, I mean that no data is shared between the interpreters and > thus the C API can be used withou

Re: python C-api and thread

2024-08-05 Thread Grant Edwards via Python-list
On 2024-08-05, aotto1968 via Python-list wrote: > Is it possible to run two completely independent Python interpreters > in one process, each using a thread? > > By independent, I mean that no data is shared between the > interpreters and thus the C API can be used without any other > "lock/GIL"

Re: Python C API: how to mark a type as subclass of another type

2021-11-02 Thread Dieter Maurer
Marco Sulla wrote at 2021-11-2 13:43 +0100: >I already added the address of the type to tp_base, but it does not work. It worked for me in `dm.incrementalsearch`. Maybe, you need a special value for `tp_flags`. Look at the examples. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python C API: how to mark a type as subclass of another type

2021-11-02 Thread Marco Sulla
*ahem* evidently I didn't check the right package. it works like a charme :D On Tue, 2 Nov 2021 at 13:43, Marco Sulla wrote: > > I already added the address of the type to tp_base, but it does not work. > > On Mon, 1 Nov 2021 at 17:18, Dieter Maurer wrote: > > > > Marco Sulla wrote at 2021-1

Re: Python C API: how to mark a type as subclass of another type

2021-11-02 Thread Marco Sulla
I already added the address of the type to tp_base, but it does not work. On Mon, 1 Nov 2021 at 17:18, Dieter Maurer wrote: > > Marco Sulla wrote at 2021-10-31 23:59 +0100: > >I have two types declared as > > > >PyTypeObject PyX_Type = { > >PyVarObject_HEAD_INIT(&PyType_Type, 0) > > > >etc. >

Re: Python C API: how to mark a type as subclass of another type

2021-11-01 Thread Dieter Maurer
Marco Sulla wrote at 2021-10-31 23:59 +0100: >I have two types declared as > >PyTypeObject PyX_Type = { >PyVarObject_HEAD_INIT(&PyType_Type, 0) > >etc. > >How can I mark one of the types as subclass of the other one? I tried >to use tp_base but it didn't work. Read the "Python/C Api" documenta

Re: Python C API: How to debug reference leak?

2016-09-28 Thread Chris Angelico
On Wed, Sep 28, 2016 at 9:25 PM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> If you've Py_DECREFed it and then peek into its internals, you're >> aiming a gun at your foot. > > > That's true. A safer way would be to look at the refcount > *before* decreffing and verify that it's what you ex

Re: Python C API: How to debug reference leak?

2016-09-28 Thread Gregory Ewing
Chris Angelico wrote: If you've Py_DECREFed it and then peek into its internals, you're aiming a gun at your foot. That's true. A safer way would be to look at the refcount *before* decreffing and verify that it's what you expect. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Python C API: How to debug reference leak?

2016-09-28 Thread Chris Angelico
On Wed, Sep 28, 2016 at 6:56 PM, Gregory Ewing wrote: > dieter wrote: >> >> dl l writes: >> >>> When I debug in C++, I see the reference count of a PyObject is 1. > >>> How can I find out where is referencing this object? >> >> >> Likely, it is the reference, you are holding: > > > Unless you've

Re: Python C API: How to debug reference leak?

2016-09-28 Thread Gregory Ewing
dieter wrote: dl l writes: When I debug in C++, I see the reference count of a PyObject is 1. >> How can I find out where is referencing this object? Likely, it is the reference, you are holding: Unless you've just Py_DECREFed it, expecting it to go away, and the recfcount is still 1, in

Re: Python C API: How to debug reference leak?

2016-09-28 Thread dieter
dl l writes: > When I debug in C++, I see the reference count of a PyObject is 1. I don't > know where is referencing this object. How can I find out where is > referencing this object? Likely, it is the reference, you are holding: typically, whenever you can access a Python object, this object

Re: Python C API: How to debug reference leak?

2016-09-28 Thread dieter
dl l writes: > Thanks for reply. Is there any function in C to get the reference objects > of a object? I want to debug where are referencing the object. Depending on your understanding of "reference objects", this would be "gc.get_referents" or "gc.get_referrers". Of course, those are not "C"

Re: Python C API: How to debug reference leak?

2016-09-27 Thread dl l
When I debug in C++, I see the reference count of a PyObject is 1. I don't know where is referencing this object. How can I find out where is referencing this object? 2016-09-27 15:47 GMT+08:00 dl l : > Thanks for reply. Is there any function in C to get the reference objects > of a object? I wan

Re: Python C API: How to debug reference leak?

2016-09-27 Thread dl l
Thanks for reply. Is there any function in C to get the reference objects of a object? I want to debug where are referencing the object. 2016-09-27 15:01 GMT+08:00 dieter : > dl l writes: > > I want to check the references of an object. Any way to get the > references > > of an object with Pytho

Re: Python C API: How to debug reference leak?

2016-09-27 Thread dieter
dl l writes: > I want to check the references of an object. Any way to get the references > of an object with Python C API? Like: gc.get_referrs(), is there similar > API in C lib? "gc" is a module. You can import and access modules from the C API. Thus, you can use "gc.get_referers" from "C" cod

Re: Python C-API: how to define nested classes?

2013-05-16 Thread Stefan Behnel
Serge WEINSTOCK, 16.05.2013 10:55: > I'm currently writing a C extension module for python using the "raw" C-API. > I would like to be able to define "nested classes" like in the following > python code > > > class A: > class B: >

Re: Python C-API: how to define nested classes?

2013-05-16 Thread 88888 Dihedral
Serge WEINSTOCK於 2013年5月16日星期四UTC+8下午4時55分07秒寫道: > Hi, > >   > > I'm currently writing a C extension module for python using the "raw" C-API. > I would like to be able to define "nested classes" like in the following > python code > >   > >

Re: Python/C API Inheritance

2011-02-02 Thread Stefan Behnel
Евгений Почитаев, 02.02.2011 18:21: May be someone do class inheritance in Python/C API, I know how create superclass/subclass. But how I can initialize superclass from subclass initializer? struct SuperClass { PyObject_HEAD; //... }; struct SubClass { PyObject_HEAD; You need t

Re: python/c api

2010-10-16 Thread Stefan Behnel
Tony, 14.10.2010 20:04: is the python/c api extensively used? and what world-famous software use it? thanks! The Sage math system makes heavy use of it, mostly through Cython. And the Python standard library has lots of modules that use it, e.g. zlib and sqlite3. You can expect that most pack

Re: python/c api

2010-10-16 Thread Diez B. Roggisch
alex23 writes: > On Oct 15, 5:53 am, de...@web.de (Diez B. Roggisch) wrote: >> For example Ableton Live, an audio sequencer. > > I _have_ Live and I didn't realise this :O Thanks! Well, it's not a feature for end-users, it's used internally for some midi controller mapping stuff. Our "API" so to

Re: python/c api

2010-10-14 Thread Lawrence D'Oliveiro
In message , Diez B. Roggisch wrote: > ... and a lot of embedding python into a software. Let me mention some notable Free Software that does this: Blender, GIMP and Scribus, among ones I’ve messed about with recently. Makes an amazing amount of power available. -- http://mail.python.org/mailm

Re: python/c api

2010-10-14 Thread alex23
On Oct 15, 5:53 am, de...@web.de (Diez B. Roggisch) wrote: > For example Ableton Live, an audio sequencer. I _have_ Live and I didn't realise this :O Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: python/c api

2010-10-14 Thread Diez B. Roggisch
Tony writes: > hi, > > is the python/c api extensively used? and what world-famous software > use it? thanks! It is, for a lot of extensions for python, and a lot of embedding python into a software. For example Ableton Live, an audio sequencer. Arc GIS has it, and the Eve Online. Many more do,

Re: Python C API, building a module

2009-11-27 Thread MRAB
P.F.C. wrote: I see what your saying. Is there another way of declaring (at least) the docstring apart from the actual array?(it would get messy otherwise) I had also tried defining the variables as static but got the same result (I thought static meant in code memory instead of the heap...?

Re: Python C API, building a module

2009-11-27 Thread MRAB
P.F.C. wrote: Hello, I'm new to the mailing list but have been using python for a while. I am now attempting to embed the interpreter into a C application but am having an issue when building a module exposing my application's functions to python. I do not know if this is the right place to as

Re: Python C API and references

2009-11-13 Thread Gabriel Genellina
En Thu, 12 Nov 2009 06:23:54 -0300, lallous escribió: Everytime I use PyObject_SetAttrString(obj, attr_name, py_val) and I don't need the reference to py_val I should decrement the reference after this call? If you own a reference to py_val, and you don't need it anymore, you must decremen

Re: Python C API and references

2009-11-12 Thread Mark Dickinson
On Nov 12, 9:23 am, "lallous" wrote: > Hello, > > Everytime I use PyObject_SetAttrString(obj, attr_name, py_val) and I don't > need the reference to py_val I should decrement the reference after this > call? Not necessarily: it depends where py_val came from. I find the 'ownership' model descri

Re: Python C API and references

2009-11-12 Thread lallous
Hello Daniel, Thanks for the reply. Everytime I use PyObject_SetAttrString(obj, attr_name, py_val) and I don't need the reference to py_val I should decrement the reference after this call? It really depends on /how/ the object is created. If the method used to create *py_val* increases t

Re: Python C api: create a new object class

2009-11-11 Thread samwyse
On Nov 10, 1:09 pm, "lallous" wrote: > Hello > > I have 3 questions, hope someone can help: > > 1) > How can I create an instance class in Python, currently I do: > > class empty: >   pass > > Then anytime I want that class (which I treat like a dictionary): > > o = empty() > o.myattr = 1 > etc...

Re: Python C api: create a new object class

2009-11-10 Thread Benjamin Peterson
lallous lgwm.org> writes: > Is there is a one line syntax to instantiate an instance? You can't instantiate an instance; it's already instantiated. > > Any other ways than this: > o = new.classobj('object', (), {}) class x: pass > How can I, similarly, create an object "o" in C api: Use PyOb

Re: Python C api: create a new object class

2009-11-10 Thread Martin v. Löwis
> How can I create an instance class in Python, currently I do: > > class empty: > pass > > Then anytime I want that class (which I treat like a dictionary): > > o = empty() > o.myattr = 1 > etc > > Is there is a one line syntax to instantiate an instance? > > Any other ways than this: >

Re: Python C/API Problem

2009-09-17 Thread Gabriel Genellina
En Sat, 12 Sep 2009 07:37:18 -0300, Gianfranco Murador escribió: Ok, I solved the previous error changing the second argument , but i have another question. Does PyNode_Compile function store the object code in the file passed as argument? And it will be execute by python? I mean, it works if

Re: Python C/API Problem

2009-09-12 Thread Gianfranco Murador
Ok, I solved the previous error changing the second argument , but i have another question. Does PyNode_Compile function store the object code in the file passed as argument? And it will be execute by python? I mean, it works if i type 'python prova.pyc'? Thank. -- http://mail.python.org/mailman/l

Re: Python C/API Problem

2009-09-12 Thread Gianfranco Murador
Yes, i've done some debugging and the error is on PyParser_SimpleParseString(..) call. I'll try to change the second arguments.. Thank to all. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C/API Problem

2009-09-11 Thread Gabriel Genellina
En Fri, 11 Sep 2009 15:10:45 -0300, Gianfranco Murador escribió: int main(int argc, char *argv[]) { Py_Initialize(); struct _node *node = PyParser_SimpleParseString("from time import time,ctime\n" "print 'Today is',ctim

Re: Python C/API Problem

2009-09-11 Thread Philip Semanchuk
On Sep 11, 2009, at 2:10 PM, Gianfranco Murador wrote: Hi to all python fans, i'm trying to run this C source file: [code] #include #include #include #include #include int main(int argc, char *argv[]) { Py_Initialize(); struct _node *node = PyParser_SimpleParseString("f

Re: Python C API String Memory Consumption

2009-04-10 Thread Hrvoje Niksic
Carl Banks writes: > On Apr 9, 11:23 pm, Hrvoje Niksic wrote: >> a...@pythoncraft.com (Aahz) writes: >> > BTW, note that if you're using Python 2.x, range(100) will cause >> > a "leak" because ints are never freed.  Instead, use xrange(). >> >> Note that using xrange() won't help with that p

Re: Python C API String Memory Consumption

2009-04-10 Thread Carl Banks
On Apr 9, 11:23 pm, Hrvoje Niksic wrote: > a...@pythoncraft.com (Aahz) writes: > > BTW, note that if you're using Python 2.x, range(100) will cause > > a "leak" because ints are never freed.  Instead, use xrange(). > > Note that using xrange() won't help with that particular problem. I think

Re: Python C API String Memory Consumption

2009-04-10 Thread Hrvoje Niksic
a...@pythoncraft.com (Aahz) writes: > BTW, note that if you're using Python 2.x, range(100) will cause > a "leak" because ints are never freed. Instead, use xrange(). Note that using xrange() won't help with that particular problem. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C API String Memory Consumption

2009-04-09 Thread Aahz
In article <41d95468-8f7a-4647-83e1-6df147744...@u8g2000yqn.googlegroups.com>, k3xji wrote: > >When I run the following function, I seem to have a mem leak, a 20 mb >of memory >is allocated and is not freed. Here is the code I run: > import esauth for i in range(100): > >... ss

Re: Python C API String Memory Consumption

2009-04-07 Thread Floris Bruynooghe
On Apr 7, 2:10 pm, John Machin wrote: > On Apr 7, 9:19 pm, MRAB wrote: > > > > > k3xji wrote: > > > Interestaing I changed malloc()/free() usage with PyMem_xx APIs and > > > the problem resolved. However, I really cannot understand why the > > > first version does not work. Here is the latest cod

Re: Python C API String Memory Consumption

2009-04-07 Thread Benjamin Peterson
Carl Banks gmail.com> writes: > However, Python apparently does leak a reference if passed a Unicode > object; PyArg_ParseTuple automatically creates an encoded string but > never decrefs it. (That might be necessary evil to preserve > compatibility, though. PyString_AS_STRING does it too.) Uni

Re: Python C API String Memory Consumption

2009-04-07 Thread John Machin
On Apr 7, 9:19 pm, MRAB wrote: > k3xji wrote: > > Interestaing I changed malloc()/free() usage with PyMem_xx APIs and > > the problem resolved. However, I really cannot understand why the > > first version does not work. Here is the latest code that has no > > problems at all: > > > static PyObjec

Re: Python C API String Memory Consumption

2009-04-07 Thread MRAB
k3xji wrote: Interestaing I changed malloc()/free() usage with PyMem_xx APIs and the problem resolved. However, I really cannot understand why the first version does not work. Here is the latest code that has no problems at all: static PyObject * penc(PyObject *self, PyObject *args) { Py

Re: Python C API String Memory Consumption

2009-04-07 Thread k3xji
Interestaing I changed malloc()/free() usage with PyMem_xx APIs and the problem resolved. However, I really cannot understand why the first version does not work. Here is the latest code that has no problems at all: static PyObject * penc(PyObject *self, PyObject *args) { PyObject * result

Re: Python C API String Memory Consumption

2009-04-07 Thread Carl Banks
On Apr 7, 12:01 am, k3xji wrote: > When I run the following function, I seem to have a mem leak, a 20 mb > of memory > is allocated and is not freed. Here is the code I run: > > >>> import esauth > >>> for i in range(100): > > ...     ss = esauth.penc('sumer') > ... > > >>> for i in range(1000

Re: Python C-API Object Allocation

2009-02-24 Thread Stefan Behnel
> On Feb 21, 2009, at 10:01 AM, William Newbery wrote: >> Ive been learning the C-API lately so I can write python extensions >> for some of my c++ stuff. First thing that comes to (my) mind is that you probably do not want to write code against the bare C-API. Instead, give Cython a try. http://

Re: Python C-API Object Allocation

2009-02-23 Thread Philip Semanchuk
On Feb 21, 2009, at 10:01 AM, William Newbery wrote: Ive been learning the C-API lately so I can write python extensions for some of my c++ stuff. I want to use the new and delete operators for creating and destroying my objects. The problem is python seems to break it into several stage

Re: Python C API (PyObject_CallMethod clear object)

2009-01-26 Thread Gabriel Genellina
En Mon, 26 Jan 2009 08:47:31 -0200, escribió: On 26 Jan., 03:25, "Gabriel Genellina" wrote: En Sun, 25 Jan 2009 23:46:01 -0200, escribió: > I have a problm with deallocating stuff. I call a function with this > command: > PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); >

Re: Python C API (PyObject_CallMethod clear object)

2009-01-26 Thread googler . 1 . webmaster
the hook is, how to delete the locals of this function, maybe thats a workaround? thanks and bye. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C API (PyObject_CallMethod clear object)

2009-01-26 Thread googler . 1 . webmaster
On 26 Jan., 03:25, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:46:01 -0200,   > escribió: > > > > > I have a problm with deallocating stuff. I call a function with this > > command: > > > PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); > > > if(rvalue==NULL) > >     PyErr_

Re: Python C API (PyObject_CallMethod clear object)

2009-01-25 Thread Gabriel Genellina
En Sun, 25 Jan 2009 23:46:01 -0200, escribió: I have a problm with deallocating stuff. I call a function with this command: PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); if(rvalue==NULL) PyErr_Print(); else Py_DECREF(rvalue); Can it be, that something is missing h

Re: Python C API

2008-12-05 Thread googler . 1 . webmaster
Hi! Any ideas? Thanks, :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C API

2008-12-05 Thread googler . 1 . webmaster
Hi! thats a very interesting point and good to know. I have to release the GIL but how do I do? In this case i need PyEval_AcquireLock and PyEval_ReleaseLock? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C API

2008-12-05 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > The first question is, I found out the API contains other commands lik > PyEval_AcquireLock(). I don't really understand if I have to use them > too, could anyone explain? Thanks. That's unrelated. The GIL is special in that it has its own handling functions. > void My

Re: Python C/API simple debugging

2008-11-26 Thread Aaron Brady
On Nov 26, 5:27 am, k3xji <[EMAIL PROTECTED]> wrote: > Hi all, > > I am new to Python C API and finding it difficult to debug C > extensions. So, basically I want to see the value of an integer value > during the C API. Here is the code: > > #define LAST_MIX_VAL 0xDEADBEEF > > static PyObject * > c

Re: Python/C API: using from a shared library

2008-11-26 Thread Graham Dumpleton
On Nov 26, 10:29 pm, Robie Basak <[EMAIL PROTECTED]> wrote: > On 2008-11-25, Robie Basak <[EMAIL PROTECTED]> wrote: > > > If I use dlopen() to open a shared library that I've written, and that > > shared library tries to use the Python/C API, then it fails. I've > > reduced the problem to the test

Re: Python C/API simple debugging

2008-11-26 Thread Philip Semanchuk
On Nov 26, 2008, at 6:47 AM, k3xji wrote: By the way for simple print-debugging, below works right now, I forgot to try that fprintf(stderr,"%d", key); As a new extension developer myself, I'll pass along the following handy macro that I swiped from another extension (psycopg I think):

Re: Python C/API simple debugging

2008-11-26 Thread k3xji
On Nov 26, 1:43 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > k3xji wrote: > > On Nov 26, 1:34 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > >> k3xji wrote: > >> > I am new to Python C API and finding it difficult to debug C > >> > extensions. So, basically I want to see the value of an inte

Re: Python C/API simple debugging

2008-11-26 Thread Diez B. Roggisch
k3xji wrote: > On Nov 26, 1:34 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: >> k3xji wrote: >> > I am new to Python C API and finding it difficult to debug C >> > extensions. So, basically I want to see the value of an integer value >> > during the C API. Here is the code: >> >> > #define LAST_MIX

Re: Python C/API simple debugging

2008-11-26 Thread k3xji
On Nov 26, 1:34 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > k3xji wrote: > > I am new to Python C API and finding it difficult to debug C > > extensions. So, basically I want to see the value of an integer value > > during the C API. Here is the code: > > > #define LAST_MIX_VAL 0xDEADBEEF > > >

Re: Python C/API simple debugging

2008-11-26 Thread Stefan Behnel
k3xji wrote: > I am new to Python C API and finding it difficult to debug C > extensions. So, basically I want to see the value of an integer value > during the C API. Here is the code: > > #define LAST_MIX_VAL 0xDEADBEEF > > static PyObject * > chash(PyObject *self, PyObject *args) > { > uns

Re: Python/C API: using from a shared library

2008-11-26 Thread Robie Basak
On 2008-11-25, Robie Basak <[EMAIL PROTECTED]> wrote: > If I use dlopen() to open a shared library that I've written, and that > shared library tries to use the Python/C API, then it fails. I've > reduced the problem to the test case below. The error is: > > ImportError: /usr/lib/python2.5/lib-dynl

Re: Python/C API bug (multithreading)

2007-06-20 Thread Krzysztof Włodarczyk
Nick Craig-Wood pisze: > Krzysztof W³odarczyk <[EMAIL PROTECTED]> wrote: > >> I think I've found a bug in Python/C API and multithreading. >> > > You don't state your python version. > > There is an old bug about a similar issue :- > > http://mail.python.org/pipermail/python-dev/2005-May

Re: Python/C API bug (multithreading)

2007-06-20 Thread Nick Craig-Wood
Krzysztof W³odarczyk <[EMAIL PROTECTED]> wrote: > I think I've found a bug in Python/C API and multithreading. You don't state your python version. There is an old bug about a similar issue :- http://mail.python.org/pipermail/python-dev/2005-May/053840.html http://sourceforge.net/tracker/i

Re: Python/C API bug (multithreading)

2007-06-19 Thread Martin v. Löwis
> Is there any simple way to fix this damned bug?? Sure: just fixed your damned code!! Regards, Marttin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python c-api and reusing python-objects: works only once

2006-11-08 Thread Gabriel Genellina
At Wednesday 8/11/2006 17:04, [EMAIL PROTECTED] wrote: I'm trying to access python objects from c++. It works once. Second time it hangs. Does someone have any clue or some example code or pointer? In general, try to make a *small* example that reproduces the problem you have. And the c++ cl

Re: Python C API question

2006-04-24 Thread Gabriele *darkbard* Farina
It seems to be what I need. Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C API question

2006-04-24 Thread Steve Juranich
Gabriele *darkbard* Farina wrote: > Hi, > > I'm a newbie in python extension development, and I'd like to ask you a > simple question. I have to implement a simple estension that parses a > source file and returns an xml.dom.minidom.Document instance. I'd like > to know how can I import and then

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread [EMAIL PROTECTED]
thanks, I get it now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread Carsten Haese
On Wed, 2005-12-14 at 12:00, [EMAIL PROTECTED] wrote: > essentially I already use PyArg_ParseTupleAndKeywords, but that seems > to emulate fixed arg list definitions like - >func (x,y,t=0,u=1) It's unclear what you are actually trying to accomplish. My guess is that you want to implement a fu

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I am writing a C extension with python 2.3.5 and need constructs > similar to python >func(*args, **kwds) > What's a neat way to do that? static PyObject* myfunc(PyObject* self, PyObject* args, PyObject* kw) { ... args is a tuple, kw is a dictionary ... } stati

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread [EMAIL PROTECTED]
essentially I already use PyArg_ParseTupleAndKeywords, but that seems to emulate fixed arg list definitions like - func (x,y,t=0,u=1) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread [EMAIL PROTECTED]
I saw that in 2.4, although it's not clear how I can make it work. the argument char *format and char *keywords[] are fixed there. Does anyone have a working example? I'm just wondering if there are plans or already an API/C in python core similar to __Pyx_GetStarArgs. It seems like a very usefull

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread Raymond L. Buvel
[EMAIL PROTECTED] wrote: > I am writing a C extension with python 2.3.5 and need constructs > similar to python >func(*args, **kwds) > What's a neat way to do that? > I found pyrex has a __Pyx_GetStarArgs - > is there something I'm missing from the regular C/API maybe using one > of the PyArg_P