From 0acdfd15485b5fd5ee5b0e9287c704474f677244 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 6 Apr 2018 11:09:45 -0700 Subject: [PATCH] more 3.7 features (#2017) --- stdlib/2and3/struct.pyi | 5 ++++- stdlib/3/_ast.pyi | 10 +++++++++- stdlib/3/types.pyi | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/stdlib/2and3/struct.pyi b/stdlib/2and3/struct.pyi index be4474ecd..cbc5e8315 100644 --- a/stdlib/2and3/struct.pyi +++ b/stdlib/2and3/struct.pyi @@ -27,7 +27,10 @@ if sys.version_info >= (3, 4): def calcsize(fmt: _FmtType) -> int: ... class Struct: - format = ... # type: bytes + if sys.version_info >= (3, 7): + format: str + else: + format: bytes size = ... # type: int def __init__(self, format: _FmtType) -> None: ... diff --git a/stdlib/3/_ast.pyi b/stdlib/3/_ast.pyi index ca75bcac5..c903b246c 100644 --- a/stdlib/3/_ast.pyi +++ b/stdlib/3/_ast.pyi @@ -1,4 +1,4 @@ -# Python 3.5 _ast +import sys import typing from typing import Any, Optional, Union @@ -16,6 +16,8 @@ class mod(AST): class Module(mod): body = ... # type: typing.List[stmt] + if sys.version_info >= (3, 7): + docstring: Optional[str] class Interactive(mod): body = ... # type: typing.List[stmt] @@ -37,6 +39,8 @@ class FunctionDef(stmt): body = ... # type: typing.List[stmt] decorator_list = ... # type: typing.List[expr] returns = ... # type: Optional[expr] + if sys.version_info >= (3, 7): + docstring: Optional[str] class AsyncFunctionDef(stmt): name = ... # type: _identifier @@ -44,6 +48,8 @@ class AsyncFunctionDef(stmt): body = ... # type: typing.List[stmt] decorator_list = ... # type: typing.List[expr] returns = ... # type: Optional[expr] + if sys.version_info >= (3, 7): + docstring: Optional[str] class ClassDef(stmt): name = ... # type: _identifier @@ -51,6 +57,8 @@ class ClassDef(stmt): keywords = ... # type: typing.List[keyword] body = ... # type: typing.List[stmt] decorator_list = ... # type: typing.List[expr] + if sys.version_info >= (3, 7): + docstring: Optional[str] class Return(stmt): value = ... # type: Optional[expr] diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 34ab3379e..634ac39b0 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -175,6 +175,9 @@ class FrameType: f_lineno = ... # type: int f_locals = ... # type: Dict[str, Any] f_trace = ... # type: Callable[[], None] + if sys.version_info >= (3, 7): + f_frace_lines: bool + f_trace_opcodes: bool def clear(self) -> None: ...