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
Example for Profile Module shows incorrect method #62233
Comments
The example on this page: Shows: import cProfile, pstats, io
pr = cProfile.Profile()
pr.enable()
... do something ...
pr.disable()
s = io.StringIO()
ps = pstats.Stats(pr, stream=s)
ps.print_results() Where "ps.print_results()" should be "ps.print_stats()" |
Added py3 patch |
py2 |
Thanks for the patches, however the Python 2 example doesn't work. |
A slightly more complete example that I tested: |
Here is a fixed version for python2.7. Using StringIO instead of io module fixes the problem pointed by Ezio. |
New changeset 93018d47793f by Senthil Kumaran in branch '2.7': New changeset ab4d3ccb92e6 by Senthil Kumaran in branch '3.3': New changeset 88182b388bae by Senthil Kumaran in branch 'default': |
I consolidated the patches and example and have committed them to 2.7, 3.3 and 3.4. Thanks for your contributions. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: