[3.7] bpo-29564: warnings suggests to enable tracemalloc (GH-10486) by miss-islington · Pull Request #10509 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation8 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

miss-islington

@vstinner @miss-islington

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

@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

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

1 similar comment

@miss-islington

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

@serhiy-storchaka

Is not enough to add the suggestion in the documentation?

@vstinner

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

@serhiy-storchaka

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

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