Skip to content

Commit 5c6f17f

Browse files
authored
Communication: sax parser: add flush() after feed() (#556) (#569)
This is due to libexpat 2.6 reparse deferral as documented in #556. Unfortunately ExpatParser doesn't seem to have SetReparseDeferralEnabled(), so we use an explicit flush() call to make sure all handlers are called immediately. We control the source XML. NOTE: Only available in Python 3.13 and backports.
1 parent e49f842 commit 5c6f17f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/ClusterShell/Communication.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ def ev_read(self, worker, node, sname, msg):
229229

230230
try:
231231
self._parser.feed(msg + b'\n')
232+
if hasattr(self._parser, 'flush'): # GH#556
233+
self._parser.flush()
232234
except SAXParseException as ex:
233235
self.logger.error("SAXParseException: %s: %s", ex.getMessage(), msg)
234236
# Warning: do not send malformed raw message back

0 commit comments

Comments
 (0)