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/2005-November/058344.html below:

[Python-Dev] reference leaks

[Python-Dev] reference leaks [Python-Dev] reference leaksNeal Norwitz nnorwitz at gmail.com
Fri Nov 25 19:02:56 CET 2005
On 11/25/05, Walter Dörwald <walter at livinglogic.de> wrote:
>
> Can you move the call to codecs.register_error() out of test_callbacks()
> and retry?

It then leaks 3 refs on each call to test_callbacks().

n
--

>>> import codecs
[24540 refs]
>>>
[24541 refs]
>>> def handler(exc):
...   l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)]
...   return (u"[%s]" % u"".join(l), exc.end)
...
[24575 refs]
>>> codecs.register_error("test.handler", handler)
[24579 refs]
>>>
[24579 refs]
>>> def test_callbacks():
...   # the {} is necessary to cause the leak
...   codecs.charmap_decode("abc", "test.handler", {})
...
[24604 refs]
>>> test_callbacks()
[24608 refs]
>>> test_callbacks()
[24611 refs]
>>> test_callbacks()
[24614 refs]
More information about the Python-Dev mailing list

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