A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/006048.html below:

[Python-Dev] GC core dump caused by stringobject changes?

[Python-Dev] GC core dump caused by stringobject changes?Andrew Kuchling akuchlin@mems-exchange.org
Mon, 10 Jul 2000 22:34:04 -0400
On Mon, Jul 10, 2000 at 07:28:33PM -0600, Neil Schemenauer wrote:
>These seem to be the changes that trigger the bug.  My problem or
>someone elses?  No time to look in detail right now. :(

>+	seq = PySequence_Fast(orig, "");
      ...
>+		item = PySequence_Fast_GET_ITEM(seq, i);
   ...
>+		Py_DECREF(item);

I think item shouldn't be DECREF'ed at all.  Looking at what
PySequence_Fast does, it either INCREF's its argument if it's a list
or tuple and returns it, or coerces it to a tuple.  It doesn't look
like PySequence_Fast increments the refcount of what it returns.

seq does need to be DECREF'ed, though:

>>> import sys
>>> L=['a', 'b', 'c']
>>> sys.getrefcount(L)
2
>>> for i in range(1000): a = ' '.join(L)
...
>>> sys.getrefcount(L)
1002
>>>

--amk





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4