summaryrefslogtreecommitdiffstats
path: root/Lib/warnings.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r--Lib/warnings.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py
index a81aab3..5b5821b 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -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