typo: missing line of output in pull parser example by don-patterson · Pull Request #111068 · python/cpython · GitHub
Skip to content

typo: missing line of output in pull parser example - #111068

Merged
hugovk merged 1 commit into
python:mainfrom
don-patterson:patch-1
Oct 23, 2023
Merged

hugovk merged 1 commit into
python:mainfrom
don-patterson:patch-1

Conversation

@don-patterson

@don-patterson don-patterson commented Oct 19, 2023

Copy link
Copy Markdown
Contributor

I was reading over this example and thought there should have been one more line printed.

Running the example code produced the extra line of output as expected!

code:

import xml.etree.ElementTree as ET
parser = ET.XMLPullParser(['start', 'end'])
parser.feed('<mytag>sometext')
list(parser.read_events())
# output: [('start', <Element 'mytag' at 0x1055559a0>)]
parser.feed(' more text</mytag>')
for event, elem in parser.read_events():
    print(event)
    print(elem.tag, 'text=', elem.text)

# output: end
# output: mytag text= sometext more text

📚 Documentation preview 📚: https://cpython-previews--111068.org.readthedocs.build/

Link to updated line in docs preview: https://cpython-previews--111068.org.readthedocs.build/en/111068/library/xml.etree.elementtree.html#pull-api-for-non-blocking-parsing

@ghost

ghost commented Oct 19, 2023

Copy link
Copy Markdown

@bedevere-app bedevere-app Bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 19, 2023
@don-patterson

Copy link
Copy Markdown
Contributor Author

I was hoping that this doc change was small enough that it wouldn't require an issue, but please let me know if you'd prefer that I create one.

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed with Python 3.11, 3.12 and 3.13. Thanks!

@hugovk
hugovk merged commit 94c2ddf into python:main Oct 23, 2023
@miss-islington-app

Copy link
Copy Markdown

Thanks @don-patterson for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @don-patterson for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 23, 2023
(cherry picked from commit 94c2ddf)

Co-authored-by: Don Patterson <37046246+don-patterson@users.noreply.github.com>
@bedevere-app

bedevere-app Bot commented Oct 23, 2023

Copy link
Copy Markdown

GH-111217 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 23, 2023
(cherry picked from commit 94c2ddf)

Co-authored-by: Don Patterson <37046246+don-patterson@users.noreply.github.com>
@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Oct 23, 2023
@bedevere-app

bedevere-app Bot commented Oct 23, 2023

Copy link
Copy Markdown

@bedevere-app bedevere-app Bot removed the needs backport to 3.11 only security fixes label Oct 23, 2023
@don-patterson
don-patterson deleted the patch-1 branch October 23, 2023 15:57
hugovk pushed a commit that referenced this pull request Oct 23, 2023
#111217)

Co-authored-by: Don Patterson <37046246+don-patterson@users.noreply.github.com>
hugovk pushed a commit that referenced this pull request Oct 23, 2023
#111218)

Co-authored-by: Don Patterson <37046246+don-patterson@users.noreply.github.com>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants