typing: fix forward reference in _Tlocalstr type bound
authorYuya Nishihara <yuya@tcha.org>
Sat, 16 Nov 2019 15:10:41 +0900
changeset 43680 3364a15f61f0
parent 43679 7cf332318f62
child 43681 b65fcccd9100
typing: fix forward reference in _Tlocalstr type bound AFAIK, a quoted string in type position is translated to its ForwardRef. https://github.com/python/typing/issues/34 This fixes the following error: File "mercurial/encoding.py", line 38, in <module>: Name 'localstr' is not defined [name-error]
mercurial/encoding.py
--- a/mercurial/encoding.py	Sat Nov 16 15:43:21 2019 +0900
+++ b/mercurial/encoding.py	Sat Nov 16 15:10:41 2019 +0900
@@ -35,7 +35,7 @@
     for t in (Any, Callable, List, Text, Type, Union):
         assert t
 
-    _Tlocalstr = TypeVar('_Tlocalstr', bound=localstr)
+    _Tlocalstr = TypeVar('_Tlocalstr', bound='localstr')
 
 charencode = policy.importmod('charencode')