summaryrefslogtreecommitdiffstats
path: root/Lib/warnings.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2017-06-04 15:34:16 (GMT)
committerDonald Stufft <donald@stufft.io>2017-06-04 15:34:16 (GMT)
commit5de3a64179bafcd440b32849b1129ed1fea47b85 (patch)
tree24b2ecee4cd200ab94a686756a1ce3082d157c48 /Lib/warnings.py
parent9f396b605ec03fc5af100222f1b0a9063ac02a0b (diff)
downloadcpython-5de3a64179bafcd440b32849b1129ed1fea47b85.zip
cpython-5de3a64179bafcd440b32849b1129ed1fea47b85.tar.gz
cpython-5de3a64179bafcd440b32849b1129ed1fea47b85.tar.bz2
Simplify code in warnings modules (#1935)
Metaprogramming a list of attributes was excessive, and made the code less readable and slower.
Diffstat (limited to 'Lib/warnings.py')
-rw-r--r--Lib/warnings.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py
index d7d88d3..a1f7746 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -397,9 +397,13 @@ class WarningMessage(object):
def __init__(self, message, category, filename, lineno, file=None,
line=None, source=None):
- local_values = locals()
- for attr in self._WARNING_DETAILS:
- setattr(self, attr, local_values[attr])
+ self.message = message
+ self.category = category
+ self.filename = filename
+ self.lineno = lineno
+ self.file = file
+ self.line = line
+ self.source = source
self._category_name = category.__name__ if category else None
def __str__(self):