-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
[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
Conversation
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>
@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? |
@vstinner: Status check is done, and it's a success ✅ . |
1 similar comment
@vstinner: Status check is done, and it's a success ✅ . |
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. |
Real world example: astropy/astropy#7913 (comment) Someone asked how to fix ResourceWarning. The link to tracemalloc is little known. |
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. |
@vstinner: Status check is done, and it's a success ✅ . |
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