Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(61680)

#25902: Fixed various refcount issues in ElementTree iteration

Can't Edit
Can't Publish+Mail
Start Review
Created:
3 years, 6 months ago by storchaka+cpython
Modified:
3 years, 5 months ago
Reviewers:
vadmium+py
CC:
devnull_psf.upfronthosting.co.za, Martin Panter, storchaka
Visibility:
Public.

Patch Set 1 #

Total comments: 4

Patch Set 2 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_xml_etree.py View 1 1 chunk +51 lines, -0 lines 0 comments Download
Lib/xml/etree/ElementTree.py View 1 1 chunk +6 lines, -4 lines 0 comments Download
Modules/_elementtree.c View 1 5 chunks +60 lines, -32 lines 0 comments Download

Messages

Total messages: 2
Martin Panter
https://bugs.python.org/review/25902/diff/16189/Modules/_elementtree.c File Modules/_elementtree.c (right): https://bugs.python.org/review/25902/diff/16189/Modules/_elementtree.c#newcode2088 Modules/_elementtree.c:2088: Py_INCREF(elem); As far as I can see, root_element is ...
3 years, 5 months ago #1
storchaka_gmail.com
3 years, 5 months ago #2
https://bugs.python.org/review/25902/diff/16189/Modules/_elementtree.c
File Modules/_elementtree.c (right):

https://bugs.python.org/review/25902/diff/16189/Modules/_elementtree.c#newcod...
Modules/_elementtree.c:2088: Py_INCREF(elem);
On 2015/12/21 04:50:16, vadmium wrote:
> As far as I can see, root_element is constant for the life of the iterator, so
> is its extra reference counting really necessary?

May be not. At least I failed to get a crash here. But for certainty I'll left
it here.

https://bugs.python.org/review/25902/diff/16189/Modules/_elementtree.c#newcod...
Modules/_elementtree.c:2139: Py_INCREF(elem);
On 2015/12/21 04:50:16, vadmium wrote:
> It looks like parent_stack_push_new() cannot cause the borrowed reference to
be
> lost, so maybe you can move this until afterwards. Or do you think the code is
> cleaner this way?

Yes, this can be moved until afterwards.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+