From f731bc09fa70226f4fd641feb75801058b8bdd71 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 1 Oct 2015 11:08:50 +0300 Subject: Issue #25280: Import trace messages emitted in verbose (-v) mode are no longer formatted twice. --- Lib/importlib/_bootstrap.py | 8 +-- Misc/NEWS | 3 ++ Python/importlib.h | 115 ++++++++++++++++++++++---------------------- 3 files changed, 65 insertions(+), 61 deletions(-) diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 5b91c05..64bbb46 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -620,15 +620,15 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None): raw_size = data[8:12] if magic != MAGIC_NUMBER: message = 'bad magic number in {!r}: {!r}'.format(name, magic) - _verbose_message(message) + _verbose_message('{}', message) raise ImportError(message, **exc_details) elif len(raw_timestamp) != 4: message = 'reached EOF while reading timestamp in {!r}'.format(name) - _verbose_message(message) + _verbose_message('{}', message) raise EOFError(message) elif len(raw_size) != 4: message = 'reached EOF while reading size of source in {!r}'.format(name) - _verbose_message(message) + _verbose_message('{}', message) raise EOFError(message) if source_stats is not None: try: @@ -638,7 +638,7 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None): else: if _r_long(raw_timestamp) != source_mtime: message = 'bytecode is stale for {!r}'.format(name) - _verbose_message(message) + _verbose_message('{}', message) raise ImportError(message, **exc_details) try: source_size = source_stats['size'] & 0xFFFFFFFF diff --git a/Misc/NEWS b/Misc/NEWS index 2655222..14fa1c2 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Release date: tba Core and Builtins ----------------- +- Issue #25280: Import trace messages emitted in verbose (-v) mode are no + longer formatted twice. + - Issue #25003: os.urandom() doesn't use getentropy() on Solaris because getentropy() is blocking, whereas os.urandom() should not block. getentropy() is supported since Solaris 11.3. diff --git a/Python/importlib.h b/Python/importlib.h index ef8bf27..75bfca4 100644 --- a/Python/importlib.h +++ b/Python/importlib.h @@ -1062,7 +1062,7 @@ const unsigned char _Py_M__importlib[] = { 101,95,115,104,105,109,71,2,0,0,115,14,0,0,0,0, 6,15,1,12,1,15,1,13,1,13,1,11,2,114,181,0, 0,0,99,4,0,0,0,0,0,0,0,11,0,0,0,19, - 0,0,0,67,0,0,0,115,243,1,0,0,105,0,0,125, + 0,0,0,67,0,0,0,115,255,1,0,0,105,0,0,125, 4,0,124,2,0,100,1,0,107,9,0,114,31,0,124,2, 0,124,4,0,100,2,0,60,110,6,0,100,3,0,125,2, 0,124,3,0,100,1,0,107,9,0,114,62,0,124,3,0, @@ -1070,59 +1070,60 @@ const unsigned char _Py_M__importlib[] = { 100,5,0,133,2,0,25,125,5,0,124,0,0,100,5,0, 100,6,0,133,2,0,25,125,6,0,124,0,0,100,6,0, 100,7,0,133,2,0,25,125,7,0,124,5,0,116,0,0, - 107,3,0,114,168,0,100,8,0,106,1,0,124,2,0,124, - 5,0,131,2,0,125,8,0,116,2,0,124,8,0,131,1, - 0,1,116,3,0,124,8,0,124,4,0,141,1,0,130,1, - 0,110,116,0,116,4,0,124,6,0,131,1,0,100,5,0, - 107,3,0,114,226,0,100,9,0,106,1,0,124,2,0,131, - 1,0,125,8,0,116,2,0,124,8,0,131,1,0,1,116, - 5,0,124,8,0,131,1,0,130,1,0,110,58,0,116,4, - 0,124,7,0,131,1,0,100,5,0,107,3,0,114,28,1, - 100,10,0,106,1,0,124,2,0,131,1,0,125,8,0,116, - 2,0,124,8,0,131,1,0,1,116,5,0,124,8,0,131, - 1,0,130,1,0,110,0,0,124,1,0,100,1,0,107,9, - 0,114,229,1,121,20,0,116,6,0,124,1,0,100,11,0, - 25,131,1,0,125,9,0,87,110,18,0,4,116,7,0,107, - 10,0,114,80,1,1,1,1,89,110,62,0,88,116,8,0, - 124,6,0,131,1,0,124,9,0,107,3,0,114,142,1,100, - 12,0,106,1,0,124,2,0,131,1,0,125,8,0,116,2, - 0,124,8,0,131,1,0,1,116,3,0,124,8,0,124,4, - 0,141,1,0,130,1,0,110,0,0,121,18,0,124,1,0, - 100,13,0,25,100,14,0,64,125,10,0,87,110,18,0,4, - 116,7,0,107,10,0,114,180,1,1,1,1,89,113,229,1, - 88,116,8,0,124,7,0,131,1,0,124,10,0,107,3,0, - 114,229,1,116,3,0,100,12,0,106,1,0,124,2,0,131, - 1,0,124,4,0,141,1,0,130,1,0,113,229,1,110,0, - 0,124,0,0,100,7,0,100,1,0,133,2,0,25,83,41, - 15,97,122,1,0,0,86,97,108,105,100,97,116,101,32,116, - 104,101,32,104,101,97,100,101,114,32,111,102,32,116,104,101, - 32,112,97,115,115,101,100,45,105,110,32,98,121,116,101,99, - 111,100,101,32,97,103,97,105,110,115,116,32,115,111,117,114, - 99,101,95,115,116,97,116,115,32,40,105,102,10,32,32,32, - 32,103,105,118,101,110,41,32,97,110,100,32,114,101,116,117, - 114,110,105,110,103,32,116,104,101,32,98,121,116,101,99,111, - 100,101,32,116,104,97,116,32,99,97,110,32,98,101,32,99, - 111,109,112,105,108,101,100,32,98,121,32,99,111,109,112,105, - 108,101,40,41,46,10,10,32,32,32,32,65,108,108,32,111, - 116,104,101,114,32,97,114,103,117,109,101,110,116,115,32,97, - 114,101,32,117,115,101,100,32,116,111,32,101,110,104,97,110, - 99,101,32,101,114,114,111,114,32,114,101,112,111,114,116,105, - 110,103,46,10,10,32,32,32,32,73,109,112,111,114,116,69, - 114,114,111,114,32,105,115,32,114,97,105,115,101,100,32,119, - 104,101,110,32,116,104,101,32,109,97,103,105,99,32,110,117, - 109,98,101,114,32,105,115,32,105,110,99,111,114,114,101,99, - 116,32,111,114,32,116,104,101,32,98,121,116,101,99,111,100, - 101,32,105,115,10,32,32,32,32,102,111,117,110,100,32,116, - 111,32,98,101,32,115,116,97,108,101,46,32,69,79,70,69, - 114,114,111,114,32,105,115,32,114,97,105,115,101,100,32,119, - 104,101,110,32,116,104,101,32,100,97,116,97,32,105,115,32, - 102,111,117,110,100,32,116,111,32,98,101,10,32,32,32,32, - 116,114,117,110,99,97,116,101,100,46,10,10,32,32,32,32, - 78,114,67,0,0,0,122,10,60,98,121,116,101,99,111,100, - 101,62,114,35,0,0,0,114,12,0,0,0,233,8,0,0, - 0,233,12,0,0,0,122,30,98,97,100,32,109,97,103,105, - 99,32,110,117,109,98,101,114,32,105,110,32,123,33,114,125, - 58,32,123,33,114,125,122,43,114,101,97,99,104,101,100,32, + 107,3,0,114,171,0,100,8,0,106,1,0,124,2,0,124, + 5,0,131,2,0,125,8,0,116,2,0,100,9,0,124,8, + 0,131,2,0,1,116,3,0,124,8,0,124,4,0,141,1, + 0,130,1,0,110,122,0,116,4,0,124,6,0,131,1,0, + 100,5,0,107,3,0,114,232,0,100,10,0,106,1,0,124, + 2,0,131,1,0,125,8,0,116,2,0,100,9,0,124,8, + 0,131,2,0,1,116,5,0,124,8,0,131,1,0,130,1, + 0,110,61,0,116,4,0,124,7,0,131,1,0,100,5,0, + 107,3,0,114,37,1,100,11,0,106,1,0,124,2,0,131, + 1,0,125,8,0,116,2,0,100,9,0,124,8,0,131,2, + 0,1,116,5,0,124,8,0,131,1,0,130,1,0,110,0, + 0,124,1,0,100,1,0,107,9,0,114,241,1,121,20,0, + 116,6,0,124,1,0,100,12,0,25,131,1,0,125,9,0, + 87,110,18,0,4,116,7,0,107,10,0,114,89,1,1,1, + 1,89,110,65,0,88,116,8,0,124,6,0,131,1,0,124, + 9,0,107,3,0,114,154,1,100,13,0,106,1,0,124,2, + 0,131,1,0,125,8,0,116,2,0,100,9,0,124,8,0, + 131,2,0,1,116,3,0,124,8,0,124,4,0,141,1,0, + 130,1,0,110,0,0,121,18,0,124,1,0,100,14,0,25, + 100,15,0,64,125,10,0,87,110,18,0,4,116,7,0,107, + 10,0,114,192,1,1,1,1,89,113,241,1,88,116,8,0, + 124,7,0,131,1,0,124,10,0,107,3,0,114,241,1,116, + 3,0,100,13,0,106,1,0,124,2,0,131,1,0,124,4, + 0,141,1,0,130,1,0,113,241,1,110,0,0,124,0,0, + 100,7,0,100,1,0,133,2,0,25,83,41,16,97,122,1, + 0,0,86,97,108,105,100,97,116,101,32,116,104,101,32,104, + 101,97,100,101,114,32,111,102,32,116,104,101,32,112,97,115, + 115,101,100,45,105,110,32,98,121,116,101,99,111,100,101,32, + 97,103,97,105,110,115,116,32,115,111,117,114,99,101,95,115, + 116,97,116,115,32,40,105,102,10,32,32,32,32,103,105,118, + 101,110,41,32,97,110,100,32,114,101,116,117,114,110,105,110, + 103,32,116,104,101,32,98,121,116,101,99,111,100,101,32,116, + 104,97,116,32,99,97,110,32,98,101,32,99,111,109,112,105, + 108,101,100,32,98,121,32,99,111,109,112,105,108,101,40,41, + 46,10,10,32,32,32,32,65,108,108,32,111,116,104,101,114, + 32,97,114,103,117,109,101,110,116,115,32,97,114,101,32,117, + 115,101,100,32,116,111,32,101,110,104,97,110,99,101,32,101, + 114,114,111,114,32,114,101,112,111,114,116,105,110,103,46,10, + 10,32,32,32,32,73,109,112,111,114,116,69,114,114,111,114, + 32,105,115,32,114,97,105,115,101,100,32,119,104,101,110,32, + 116,104,101,32,109,97,103,105,99,32,110,117,109,98,101,114, + 32,105,115,32,105,110,99,111,114,114,101,99,116,32,111,114, + 32,116,104,101,32,98,121,116,101,99,111,100,101,32,105,115, + 10,32,32,32,32,102,111,117,110,100,32,116,111,32,98,101, + 32,115,116,97,108,101,46,32,69,79,70,69,114,114,111,114, + 32,105,115,32,114,97,105,115,101,100,32,119,104,101,110,32, + 116,104,101,32,100,97,116,97,32,105,115,32,102,111,117,110, + 100,32,116,111,32,98,101,10,32,32,32,32,116,114,117,110, + 99,97,116,101,100,46,10,10,32,32,32,32,78,114,67,0, + 0,0,122,10,60,98,121,116,101,99,111,100,101,62,114,35, + 0,0,0,114,12,0,0,0,233,8,0,0,0,233,12,0, + 0,0,122,30,98,97,100,32,109,97,103,105,99,32,110,117, + 109,98,101,114,32,105,110,32,123,33,114,125,58,32,123,33, + 114,125,122,2,123,125,122,43,114,101,97,99,104,101,100,32, 69,79,70,32,119,104,105,108,101,32,114,101,97,100,105,110, 103,32,116,105,109,101,115,116,97,109,112,32,105,110,32,123, 33,114,125,122,48,114,101,97,99,104,101,100,32,69,79,70, @@ -1146,9 +1147,9 @@ const unsigned char _Py_M__importlib[] = { 0,218,25,95,118,97,108,105,100,97,116,101,95,98,121,116, 101,99,111,100,101,95,104,101,97,100,101,114,87,2,0,0, 115,76,0,0,0,0,11,6,1,12,1,13,3,6,1,12, - 1,13,1,16,1,16,1,16,1,12,1,18,1,10,1,18, - 1,18,1,15,1,10,1,15,1,18,1,15,1,10,1,15, - 1,12,1,3,1,20,1,13,1,5,2,18,1,15,1,10, + 1,13,1,16,1,16,1,16,1,12,1,18,1,13,1,18, + 1,18,1,15,1,13,1,15,1,18,1,15,1,13,1,15, + 1,12,1,3,1,20,1,13,1,5,2,18,1,15,1,13, 1,18,1,3,1,18,1,13,1,5,2,18,1,15,1,15, 1,114,191,0,0,0,99,4,0,0,0,0,0,0,0,5, 0,0,0,6,0,0,0,67,0,0,0,115,115,0,0,0, -- cgit v0.12