> 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
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
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
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
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"
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
*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
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.
>
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
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
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
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
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
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
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"
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
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
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
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:
>
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
>
>
>
>
Евгений Почитаев, 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
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
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
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
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
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,
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...?
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
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
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
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
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...
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
> 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:
>
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
> 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://
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
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);
>
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
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_
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
Hi!
Any ideas? Thanks, :)
--
http://mail.python.org/mailman/listinfo/python-list
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
[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
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
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
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):
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
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
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
>
> >
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
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
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
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
> 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
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
It seems to be what I need. Thank you!
--
http://mail.python.org/mailman/listinfo/python-list
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
thanks, I get it now.
--
http://mail.python.org/mailman/listinfo/python-list
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
[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
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
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
[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
78 matches
Mail list logo