Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/encoding.py @ 43720:3364a15f61f0
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]
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 16 Nov 2019 15:10:41 +0900 |
parents | 7cf332318f62 |
children | b65fcccd9100 |
comparison
equal
deleted
inserted
replaced
43719:7cf332318f62 | 43720:3364a15f61f0 |
---|---|
33 | 33 |
34 # keep pyflakes happy | 34 # keep pyflakes happy |
35 for t in (Any, Callable, List, Text, Type, Union): | 35 for t in (Any, Callable, List, Text, Type, Union): |
36 assert t | 36 assert t |
37 | 37 |
38 _Tlocalstr = TypeVar('_Tlocalstr', bound=localstr) | 38 _Tlocalstr = TypeVar('_Tlocalstr', bound='localstr') |
39 | 39 |
40 charencode = policy.importmod('charencode') | 40 charencode = policy.importmod('charencode') |
41 | 41 |
42 isasciistr = charencode.isasciistr | 42 isasciistr = charencode.isasciistr |
43 asciilower = charencode.asciilower | 43 asciilower = charencode.asciilower |