Patchwork [3,of,5] py3: system-stringify repr(frame)

login
register
mail settings
Submitter Yuya Nishihara
Date April 8, 2018, 8:59 a.m.
Message ID <9a35569ef5ab58c975f5.1523177983@mimosa>
Download mbox | patch
Permalink /patch/30554/
State Accepted
Headers show

Comments

Yuya Nishihara - April 8, 2018, 8:59 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1523154235 -32400
#      Sun Apr 08 11:23:55 2018 +0900
# Node ID 9a35569ef5ab58c975f56ecb063a1b82b25ec6b8
# Parent  bb8635c7a6c30b988e9439ed9057857250838a7a
py3: system-stringify repr(frame)

That's the Py3 requirement.

Patch

diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py
--- a/mercurial/wireprotoframing.py
+++ b/mercurial/wireprotoframing.py
@@ -19,6 +19,7 @@  from .thirdparty import (
     cbor,
 )
 from . import (
+    encoding,
     error,
     util,
 )
@@ -142,6 +143,7 @@  class frame(object):
     flags = attr.ib()
     payload = attr.ib()
 
+    @encoding.strmethod
     def __repr__(self):
         typename = '<unknown 0x%02x>' % self.typeid
         for name, value in FRAME_TYPES.iteritems():