Open
Description
Bug report
Bug description:
Reproducer:
import _elementtree as ET
a = ET.XMLParser()
a.__init__()
current main branch:
./python.exe -X showrefcount example.py
[8736 refs, 5267 blocks]
3.12 branch:
./python.exe -X showrefcount example.py
[8327 refs, 4977 blocks]
3.11 branch:
./python.exe -X showrefcount example.py
[1557 refs, 575 blocks]
The number of leaks increases if we call __init__
multiple times (current main branch):
Code:
import _elementtree as ET
a = ET.XMLParser()
a.__init__()
a.__init__()
a.__init__()
a.__init__()
a.__init__()
a.__init__()
a.__init__()
./python.exe -X showrefcount example.py
[8838 refs, 5357 blocks]
I doesn't sure, is this worth to fix? This is pure python code, so in my opinion we should fix it.
CPython versions tested on:
3.11, 3.12, CPython main branch
Operating systems tested on:
macOS