cpython: 8939c0196990 (original) (raw)

Mercurial > cpython

changeset 86603:8939c0196990

Close #19379: Lazily import linecache in the warnings module, to make startup with warnings faster until a warning gets printed. [#19379]

Antoine Pitrou solipsis@pitrou.net
date Thu, 24 Oct 2013 22:23:42 +0200
parents bffb49efc383
children cb82b4efa67b
files Lib/warnings.py Misc/NEWS
diffstat 2 files changed, 5 insertions(+), 4 deletions(-)[+] [-] Lib/warnings.py 6 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -1,9 +1,5 @@ """Python part of the warnings subsystem.""" -# Note: function level imports should not be used -# in this module as it may cause import lock deadlock. -# See bug 683658. -import linecache import sys all = ["warn", "showwarning", "formatwarning", "filterwarnings", @@ -21,6 +17,7 @@ def showwarning(message, category, filen def formatwarning(message, category, filename, lineno, line=None): """Function to format a warning the standard way."""

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,9 @@ Core and Builtins Library ------- +- Issue #19379: Lazily import linecache in the warnings module, to make