[Python-Dev] [Python-checkins] cpython: Close #19379: Lazily import linecache in the warnings module, to make startup (original) (raw)

Brett Cannon brett at python.org
Thu Oct 24 22:40:46 CEST 2013


The diff doesn't show an addition to BENCH_GROUPS. Maybe apps?

On Thu, Oct 24, 2013 at 4:24 PM, antoine.pitrou <python-checkins at python.org>wrote:

http://hg.python.org/cpython/rev/8939c0196990 changeset: 86603:8939c0196990 user: Antoine Pitrou <solipsis at pitrou.net> date: Thu Oct 24 22:23:42 2013 +0200 summary: Close #19379: Lazily import linecache in the warnings module, to make startup with warnings faster until a warning gets printed.

files: Lib/warnings.py | 6 ++---- Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Lib/warnings.py b/Lib/warnings.py --- 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 formatwarning(message, category, filename, lineno, line=None):_ _"""Function to format a warning the standard way."""_ _+ import linecache_ _s = "%s:%s: %s: %s\n" % (filename, lineno, category._name_,_ _message)_ _line = linecache.getline(filename, lineno) if line is None else line_ _if line:_ _@@ -233,6 +230,7 @@_ _# Prime the linecache for formatting, in case the_ _# "file" is actually in a zipfile or something._ _+ import linecache_ _linecache.getlines(filename, moduleglobals)_ _if action == "error":_ _diff --git a/Misc/NEWS b/Misc/NEWS_ _--- a/Misc/NEWS_ _+++ b/Misc/NEWS_ _@@ -21,6 +21,9 @@_ _Library_ _-------_ _+- Issue #19379: Lazily import linecache in the warnings module, to make_ _+ startup with warnings faster until a warning gets printed._ _+_ _- Issue #19327: Fixed the working of regular expressions with too big_ _charset._ _- Issue #17400: New 'isglobal' attribute for ipaddress to tell if an_ _address_ _--_ _Repository URL: http://hg.python.org/cpython


Python-checkins mailing list Python-checkins at python.org https://mail.python.org/mailman/listinfo/python-checkins -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20131024/9315acfc/attachment.html>



More information about the Python-Dev mailing list