# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1573884641 -32400
#      Sat Nov 16 15:10:41 2019 +0900
# Node ID 278616fbbe76deecad94eb99886b01aed6fe9661
# Parent  788e92d3589b8007e47db7533d01654911335cc5
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]

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -35,7 +35,7 @@ if not globals():  # hide this from non-
     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')
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to