Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 462a2fc

Browse files
slatenymerwok
andauthored
gh-54358: Clarify data chunking in pyexpat (GH-31629)
Co-authored-by: Éric Araujo <[email protected]>
1 parent 3d8fc06 commit 462a2fc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Doc/library/pyexpat.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ XMLParser Objects
214214
:meth:`CharacterDataHandler` callback whenever possible. This can improve
215215
performance substantially since Expat normally breaks character data into chunks
216216
at every line ending. This attribute is false by default, and may be changed at
217-
any time.
217+
any time. Note that when it is false, data that does not contain newlines
218+
may be chunked too.
218219

219220

220221
.. attribute:: xmlparser.buffer_used
@@ -372,7 +373,10 @@ otherwise stated.
372373
marked content, and ignorable whitespace. Applications which must distinguish
373374
these cases can use the :attr:`StartCdataSectionHandler`,
374375
:attr:`EndCdataSectionHandler`, and :attr:`ElementDeclHandler` callbacks to
375-
collect the required information.
376+
collect the required information. Note that the character data may be
377+
chunked even if it is short and so you may receive more than one call to
378+
:meth:`CharacterDataHandler`. Set the :attr:`buffer_text` instance attribute
379+
to ``True`` to avoid that.
376380

377381

378382
.. method:: xmlparser.UnparsedEntityDeclHandler(entityName, base, systemId, publicId, notationName)

0 commit comments

Comments
 (0)