On Apr 12, 4:27 pm, Gerhard Häring
wrote:
> Maybe somebody can enlighten me here. I can't figure out why doing a
> rich comparison on my object decreases the total reference count by 1. [...]
Doh! It turned out the strange effect was due to my particular build
process.
My Python
Can be run like this:
ghaer...@ws124~/src/gh/test$ python3 setup.py build_ext --inplace
running build_ext
building 'foo' extension
gcc -fno-strict-aliasing -g -fwrapv -O0 -Wall -Wstrict-prototypes -
arch i386 -m32 -I/opt/jetstream/include/python3.1 -c foo.c -o build/
temp.macosx-10.4-i386-3.1-pyde
Maybe somebody can enlighten me here. I can't figure out why doing a
rich comparison on my object decreases the total reference count by 1.
Linked is the minimal test case with a C exension that compiles under
both Python 2.6 and 3.1. No external dependencies, except a DEBUG
build of Pyth
En Tue, 01 Apr 2008 18:49:28 -0300, Mitko Haralanov <[EMAIL PROTECTED]>
escribió:
> For the most part, I understand the theory behind reference counting in
> Python C code. But there is one thing that I am confused about and I
> have not been able to clear it up.
>
> Let say that you have the fo
For the most part, I understand the theory behind reference counting in
Python C code. But there is one thing that I am confused about and I
have not been able to clear it up.
Let say that you have the following function (over-simplified):
PyObject *do_work (PyObject *self, PyObject *args) {
ating a dict subclass that counts
> the number of assignments and deletions but that seems cumbersome (an
> bug-prone).
>
> Is there a way to get the reference count of these datadict items? I
> imagine that this would be a more stable implementation of such a feature.
>
>
t found an easy way to determine if said
dictionary contents are still in use (so it is ok to delete them from
the dictionary). I've thought about creating a dict subclass that counts
the number of assignments and deletions but that seems cumbersome (an
bug-prone).
Is there a way to get th
I tend to answer my own questions a lot. But he, lets grow the
knowledge base :)... PyErr_Clear() after PyErr_Print did the trick
J
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I have a problem with the reference count after an error occurs
in a script which I execute as follows..
PyObject* lDict = PyDict_New();
PyDict_SetItemString(lDict, "item", (PyObject*)iItem->mPyObject);
PyObject* lResult = PyEval_EvalCode(mCode, ScnGlobal::sDictionary,
lDict);
"tiissa" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's interesting to note that self.pop instead of A.pop works as
> expected.
> But I don't know why A.pop doesn't.
Because the name 'A' is no longer associated with the class object.
However, self has a reference to the cla
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> it looks like we have to use other way, hold the data we want to
> preseve in an object, because it is possible the class is removed
> before the instance cleaned,
What is removed first is the binding between name A and the class obje
[EMAIL PROTECTED] wrote:
look at this discussion:
http://www.dbforums.com/archive/index.php/t-1100372.html
it looks like we have to use other way, hold the data we want to
preseve in an object, because it is possible the class is removed
before the instance cleaned, and we can not expect __del__ 10
look at this discussion:
http://www.dbforums.com/archive/index.php/t-1100372.html
it looks like we have to use other way, hold the data we want to
preseve in an object, because it is possible the class is removed
before the instance cleaned, and we can not expect __del__ 100% in
handling finalizin
[EMAIL PROTECTED] wrote:
Your problem can be simplified :
class A:
pop = 11
def __del__(self):
print A.pop
if __name__ == '__main__':
objA = A()
I got the same error message, and I don't know why ? it looks like the
class variable can't be accessed from __del__?
It's interesting to note t
[EMAIL PROTECTED] wrote:
Your problem can be simplified :
class A:
pop = 11
def __del__(self):
print A.pop
if __name__ == '__main__':
objA = A()
Exception exceptions.AttributeError: "'NoneType' object has no
attribute 'pop'" in > ignored
I got the same error message, and I don't know why ? it
Your problem can be simplified :
class A:
pop = 11
def __del__(self):
print A.pop
if __name__ == '__main__':
objA = A()
Exception exceptions.AttributeError: "'NoneType' object has no
attribute 'pop'" in > ignored
I got the same error message, and I don't know why ? it looks like the
c
Hi,
i'm starting work and a simple database layer and wanted to use the
__del__ to open and close a connection. However, i get an erro when
executing this script:
class Table:
refcount = 0
def __init__(self, name):
self.name = name
print "table %s " % repr(self)
T
John Machin wrote:
>> you should check the return value, though. PyList_SetItem may (in
>> theory) fail.
>
> :-)
> Only a bot could say that. We mere mortals have been known to do things
> like (a) pass a non-list as the first argument (b) pass an out-of-range
> value for the second argument.
ev
Fredrik Lundh wrote:
>
> >PyList_SetItem(List,i,Str);
>
> you should check the return value, though. PyList_SetItem may (in
> theory) fail.
>
:-)
Only a bot could say that. We mere mortals have been known to do things
like (a) pass a non-list as the first argument (b) pass an out-of-range
va
"cedric paille" wrote:
> I'm making python's modules to extend my application's functions with a built
> in script editor.
> At now all works very well, but i'd like to know if i'm not forgetting some
> references inc/dec
>
> Here is a portion of my code:
>
> static PyObject *
> Scene_GetNod
Hi all, i'm working on an app that embed python 2.3
with Gnu/Linux, and i'd like to have some precisions:
I'm making python's modules to extend my
application's functions with a built in script editor.
At now all works very well, but i'd like to know if
i'm not forgetting some references
21 matches
Mail list logo