Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As of Python 3.6 dump_stats method allows PathLike object to be passed. #2741

Merged
merged 1 commit into from Jan 15, 2019

Conversation

Projects
None yet
2 participants
@playpauseandstop
Copy link
Contributor

commented Jan 15, 2019

Replicate typings from pstats.dump_stats into profile and cProfile libraries.


Before given changes next code required # type: ignore comment to have mypy passed:

import cProfile
from pathlib import Path

profiler = cProfile.Profile()
rel = Path(__file__).parent.parent

filename = rel / f'{rel.name}.prof'
profiler.dump_stats(filename)  # type: ignore
profiler.disable()

But in reality Python 3.6 allow to pass PathLike objects into .dump_stats methods and # type: ignore comments are redundant.

As of Python 3.6 dump_stats method allows PathLike object to be passed.
Replicate typings from `pstats.dump_stats` into `profile` and `cProfile`
libraries.

@JelleZijlstra JelleZijlstra merged commit 8e6e178 into python:master Jan 15, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@JelleZijlstra

This comment has been minimized.

Copy link
Collaborator

commented Jan 15, 2019

Thank you!

yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019

As of Python 3.6 dump_stats method allows PathLike object to be passe…
…d. (python#2741)

Replicate typings from `pstats.dump_stats` into `profile` and `cProfile`
libraries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.