Skip to content

Conversation

@lic9
Copy link
Contributor

@lic9 lic9 commented Mar 8, 2019

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the pull request. Notes below.

def extract_stack(f: Optional[FrameType] = ...,
limit: Optional[int] = ...) -> StackSummary: ...
def format_list(extracted_list: List[FrameSummary]) -> List[str]: ...
def print_list(extracted_list: List[FrameSummary], file: Optional[IO[str]] = ...) -> None: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This should be marked with # undocumented.
  2. While StackSummary.from_list() is also annotated as expecting a list, expecting an Iterable[FrameSummary] should suffice.
  3. print() is annotated as expecting an IO[str]. We are trying to move away from using IO for argument types. Could you defined a protocol like this and use it for the file argument:
class _Writable(Protocol):
    def write(self, s: str) -> Any:
        pass

I will send a separate PR for print().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. Thanks for the commends and suggestions!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, the print PR is #2848.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like all tests have finished but status is still pending...

The patch contains two minor fixes:
1) Mark the method as '# undocumented'
2) Change 'file' argument type from IO to _Writable
@srittau
Copy link
Collaborator

srittau commented Mar 11, 2019

I don't know why it's still showing as pending, but since all tests are green, I'm meeting.

@srittau srittau merged commit 5918098 into python:master Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants