diff --git a/Lib/warnings.py b/Lib/warnings.py index ec835b18cee..a81aab3fe56 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -357,10 +357,10 @@ class catch_warnings(object): # If either if the compiled regexs are None, match anything. _warnings_defaults = False try: - from _warnings import (filters, default_action, once_registry, + from _warnings import (filters, _defaultaction, _onceregistry, warn, warn_explicit) - defaultaction = default_action - onceregistry = once_registry + defaultaction = _defaultaction + onceregistry = _onceregistry _warnings_defaults = True except ImportError: filters = [] diff --git a/Misc/NEWS b/Misc/NEWS index 4673e028b29..d7976bc062e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ What's New in Python 3.2 Alpha 2? Core and Builtins ----------------- +- Issue #9766: Rename poorly named variables exposed by _warnings to prevent + confusion with the proper variables names from 'warnings' itself. + - Issue #9212: dict_keys and dict_items now provide the isdisjoint() method, to conform to the Set ABC. Patch by Daniel Urban. diff --git a/Python/_warnings.c b/Python/_warnings.c index 63bcbffea9f..a4e9d48e8ec 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -945,13 +945,13 @@ _PyWarnings_Init(void) if (_once_registry == NULL) return NULL; Py_INCREF(_once_registry); - if (PyModule_AddObject(m, "once_registry", _once_registry) < 0) + if (PyModule_AddObject(m, "_onceregistry", _once_registry) < 0) return NULL; _default_action = PyUnicode_FromString("default"); if (_default_action == NULL) return NULL; - if (PyModule_AddObject(m, "default_action", _default_action) < 0) + if (PyModule_AddObject(m, "_defaultaction", _default_action) < 0) return NULL; return m; }