Skip to content

Commit 31d7393

Browse files
rowilliaJelleZijlstra
authored andcommitted
Support calling eval and ast module with unicode in Python 2 (#1440)
1 parent d3f9c55 commit 31d7393

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: stdlib/2/__builtin__.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ class UnicodeWarning(Warning): ...
939939
class BytesWarning(Warning): ...
940940
class ResourceWarning(Warning): ...
941941

942-
def eval(s: str, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
942+
def eval(s: Union[str, unicode], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
943943
def exec(object: str,
944944
globals: Optional[Dict[str, Any]] = None,
945945
locals: Optional[Dict[str, Any]] = None) -> Any: ... # TODO code object as source

Diff for: stdlib/2/ast.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ __version__ = ... # type: str
2121
PyCF_ONLY_AST = ... # type: int
2222

2323

24-
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> Module: ...
24+
def parse(source: Union[str, unicode], filename: Union[str, unicode] = ..., mode: Union[str, unicode] = ...) -> Module: ...
2525
def copy_location(new_node: AST, old_node: AST) -> AST: ...
2626
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
2727
def fix_missing_locations(node: AST) -> AST: ...
2828
def get_docstring(node: AST, clean: bool = ...) -> str: ...
2929
def increment_lineno(node: AST, n: int = ...) -> AST: ...
3030
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
3131
def iter_fields(node: AST) -> Iterator[typing.Tuple[str, Any]]: ...
32-
def literal_eval(node_or_string: Union[str, AST]) -> Any: ...
32+
def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ...
3333
def walk(node: AST) -> Iterator[AST]: ...
3434

3535
class NodeVisitor():

0 commit comments

Comments
 (0)