Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > reference count

Reply
Thread Tools

reference count

 
 
J
Guest
Posts: n/a
 
      09-28-2005
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);
if (! lResult)
{
PyErr_Print();
}
else
{
Py_DECREF(lResult);
}
Py_DECREF(lDict);


The script within the mCode object only contains the following line,
which generates an error.

print aasas


The problem is that after PyEval_EvalCode returns the reference count
for lDict is one larger than before. Py_DECREF(lDict) does
therefore not delete the Dictionary, which causes me problems. Is
Python keeping an exception around. I assume that I have to do some
more cleanup ??


Cheers
Jochen

 
Reply With Quote
 
 
 
 
J
Guest
Posts: n/a
 
      09-28-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count = Count + 1 Using only std_logic_1164 Doubt efelnavarro09 VHDL 2 01-26-2011 03:49 AM
setting a reference count to zero Peter Jones Java 10 01-10-2006 04:48 PM
Count(*) in a Subquery with multiple tables: How does SQL determine which table to generate the Count() from? Kaimuri MCSD 3 12-29-2004 06:38 PM
I am adding a new row to the datagrid dynamically but if i use the Count property of Item it is not showing the count of the new rows being added Praveen Balanagendra via .NET 247 ASP .Net 2 06-06-2004 07:16 AM
Re: can I get the reference count Christophe Vanfleteren Java 9 08-11-2003 04:37 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57