This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Don't import linecache at warnings toplevel
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, christian.heimes, pitrou, python-dev
Priority: normal Keywords: patch

Created on 2013-10-24 20:09 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
warnings_lazy.patch pitrou, 2013-10-24 20:09 review
Messages (4)
msg201174 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-24 20:09
Importing warnings pulls linecache at the top-level, while it's only necessary when printing warnings. The reason why it wasn't done lazily is obsolete, since Python now has per-module import locks. Attached patch makes the linecache imports lazy.

This is desirable for issue #19375.
msg201178 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-24 20:15
LGTM

Good catch! :)
msg201179 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-10-24 20:15
LGTM
msg201182 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-24 20:24
New changeset 8939c0196990 by Antoine Pitrou in branch 'default':
Close #19379: Lazily import linecache in the warnings module, to make startup with warnings faster until a warning gets printed.
http://hg.python.org/cpython/rev/8939c0196990
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63578
2013-10-24 20:24:49python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg201182

resolution: fixed
stage: patch review -> resolved
2013-10-24 20:15:26brett.cannonsetmessages: + msg201179
2013-10-24 20:15:14christian.heimessetmessages: + msg201178
2013-10-24 20:09:10pitroucreate