Skip to content

[3.7] bpo-29564: warnings suggests to enable tracemalloc (GH-10486) #10509

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

Merged
merged 1 commit into from
Dec 4, 2018

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Nov 13, 2018

The warnings module now suggests to enable tracemalloc if the source
is specified, tracemalloc module is available, but tracemalloc is not
tracing memory allocations.
(cherry picked from commit 2c07c49)

Co-authored-by: Victor Stinner vstinner@redhat.com

https://bugs.python.org/issue29564

The warnings module now suggests to enable tracemalloc if the source
is specified, tracemalloc module is available, but tracemalloc is not
tracing memory allocations.
(cherry picked from commit 2c07c49)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
@vstinner
Copy link
Member

@ncoghlan, @serhiy-storchaka: Do you think that it would be acceptable to modify the warnings module in Python 3.7 to add "ResourceWarning: Enable tracemalloc to get the object allocation traceback" hint when a ResourceWarning is logged? Or is this kind of change backward incompatible?

@miss-islington
Copy link
Contributor Author

@vstinner: Status check is done, and it's a success ✅ .

1 similar comment
@miss-islington
Copy link
Contributor Author

@vstinner: Status check is done, and it's a success ✅ .

@serhiy-storchaka
Copy link
Member

Is not enough to add the suggestion in the documentation?

@vstinner
Copy link
Member

Is not enough to add the suggestion in the documentation?

I rarely read the documentation of a project when I use it :-)

Mentioning tracemalloc in the documentation shouldn't hurt, but I'm not sure where to put the info. ResourceWarning doc? Warnings doc? tracemalloc only helps when ResourceWarning is logged and source parameter of warnings.warn() is used.

@vstinner
Copy link
Member

Real world example: astropy/astropy#7913 (comment)

Someone asked how to fix ResourceWarning. The link to tracemalloc is little known.

@serhiy-storchaka
Copy link
Member

I think ResourceWarning or the warnings module docs are good places.

It may be worth to write also a how to about debugging in Python, with a section about searching memory and resource leaks.

@miss-islington
Copy link
Contributor Author

@vstinner: Status check is done, and it's a success ✅ .

@vstinner vstinner merged commit 0091f34 into python:3.7 Dec 4, 2018
@miss-islington miss-islington deleted the backport-2c07c49-3.7 branch December 4, 2018 20:26
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.

5 participants