Add a new warning gategory, ResourceWarning, as discussed on python-dev. It is silent by default,

except when configured --with-pydebug.

Emit this warning from the GC shutdown procedure, rather than just printing to stderr.
This commit is contained in:
Georg Brandl 2010-10-24 15:11:22 +00:00
parent 872a702bbd
commit 08be72d0aa
12 changed files with 80 additions and 30 deletions

View file

@ -383,4 +383,11 @@ if not _warnings_defaults:
else:
bytes_action = "ignore"
simplefilter(bytes_action, category=BytesWarning, append=1)
# resource usage warnings are enabled by default in pydebug mode
if hasattr(sys, 'gettotalrefcount'):
resource_action = "always"
else:
resource_action = "ignore"
simplefilter(resource_action, category=ResourceWarning, append=1)
del _warnings_defaults