[issue33565] strange tracemalloc results

Alexander Mohr report at bugs.python.org
Sun May 20 16:16:58 EDT 2018


Alexander Mohr <thehesiod at gmail.com> added the comment:

here's another problem, if I change that function signature to:
def test(s3_client):
    try:
        method = getattr(s3_client, sys.argv[1])
        method(Bucket='archpi.dabase.com', Key='doesnotexist')
    except botocore.exceptions.ClientError as e:
        if e.response['ResponseMetadata']['HTTPStatusCode'] != 404:
            raise 

    print('.', end='', flush=True)

the print happens every time and the raise does not ever get hit, yet the raise line is still marked as the top "leak" (unfreed blocks).  It's really strange.  Furthermore the second top "leak" is this stack:
  File "/tmp/Python-3.6.5/Lib/sre_compile.py", line 439
    return prefix, prefix_skip, False
  File "/tmp/Python-3.6.5/Lib/sre_compile.py", line 498
    prefix, prefix_skip, got_all = _get_literal_prefix(pattern)
  File "/tmp/Python-3.6.5/Lib/sre_compile.py", line 548
    _compile_info(code, p, flags)


which doesn't make sense either, why would the return line be marked as having allocated anything?

and btw I did change the implementation to start early, and then compare differences between a snapshot at iter 20 and iter 100 and the same holds true as I stated, there should logically be no difference between starting it later, or starting in the beginning and comparing two snapshots as all what you're doing in either cases is comparing two

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33565>
_______________________________________


More information about the Python-bugs-list mailing list