[PATCH 1 of 5] wireproto: fix repr(frame) to not crash by unknown type id

Yuya Nishihara yuya at tcha.org
Sun Apr 8 08:59:41 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1523153687 -32400
#      Sun Apr 08 11:14:47 2018 +0900
# Node ID 9cf44f780dc77847c7d8628c623148cadd0c252f
# Parent  632b928992039afe96df8f99a8dec6127ff983f1
wireproto: fix repr(frame) to not crash by unknown type id

Follows up 5ef2da00e935.

diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py
--- a/mercurial/wireprotoframing.py
+++ b/mercurial/wireprotoframing.py
@@ -150,7 +150,7 @@ class frame(object):
                 'type=%s; flags=%s)' % (
             len(self.payload), self.requestid, self.streamid,
             humanflags(STREAM_FLAGS, self.streamflags), typename,
-            humanflags(FRAME_TYPE_FLAGS[self.typeid], self.flags)))
+            humanflags(FRAME_TYPE_FLAGS.get(self.typeid, {}), self.flags)))
 
 def makeframe(requestid, streamid, streamflags, typeid, flags, payload):
     """Assemble a frame into a byte array."""


More information about the Mercurial-devel mailing list