for excname in PYTHON3_IMPORTERROR_EXCEPTIONS:
REVERSE_NAME_MAPPING[('builtins', excname)] = ('exceptions', 'ImportError')
+del excname
return msg.get_payload(decode=True)
for maintype in 'audio image video application'.split():
raw_data_manager.add_get_handler(maintype, get_non_text_content)
+del maintype
def get_message_content(msg):
return msg.get_payload(0)
for subtype in 'rfc822 external-body'.split():
raw_data_manager.add_get_handler('message/'+subtype, get_message_content)
+del subtype
def get_and_fixup_unknown_message_content(msg):
_finalize_set(msg, disposition, filename, cid, params)
for typ in (bytes, bytearray, memoryview):
raw_data_manager.add_set_handler(typ, set_bytes_content)
+del typ
_QUOPRI_BODY_ENCODE_MAP = _QUOPRI_BODY_MAP[:]
for c in b'\r\n':
_QUOPRI_BODY_ENCODE_MAP[c] = chr(c)
+del c
def body_encode(body, maxlinelen=76, eol=NL):
"""Encode with quoted-printable, wrapping at maxlinelen characters.
DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
-MONTHS_LOWER = []
-for month in MONTHS: MONTHS_LOWER.append(month.lower())
+MONTHS_LOWER = [month.lower() for month in MONTHS]
def time2isoz(t=None):
"""Return a string representing time in seconds since epoch, t.
mod_dict = globals()
for k, v in dis.COMPILER_FLAG_NAMES.items():
mod_dict["CO_" + v] = k
+del k, v, mod_dict
# See Include/object.h
TPFLAGS_IS_ABSTRACT = 1 << 20
for i in range(0x20):
ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
#ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
+del i
INFINITY = float('inf')
if line:
op, name = line.split()
opmap[op] = getattr(token, name)
+del line, op, name
for k, v in sorted(locale_encoding_alias.items()):
k = k.replace('_', '')
locale_encoding_alias.setdefault(k, v)
+del k, v
#
# The locale_alias table maps lowercase alias names to C locale names
reduction.register(array.array, reduce_array)
view_types = [type(getattr({}, name)()) for name in ('items','keys','values')]
-if view_types[0] is not list: # only needed in Py3.0
- def rebuild_as_list(obj):
- return list, (list(obj),)
- for view_type in view_types:
- reduction.register(view_type, rebuild_as_list)
+def rebuild_as_list(obj):
+ return list, (list(obj),)
+for view_type in view_types:
+ reduction.register(view_type, rebuild_as_list)
+del view_type, view_types
#
# Type for identifying shared objects
for name, signum in list(signal.__dict__.items()):
if name[:3]=='SIG' and '_' not in name:
_exitcode_to_name[-signum] = f'-{name}'
+del name, signum
# For debug and leak testing
_dangling = WeakSet()
scheme['headers'] = scheme['include']
scheme['include'] = '{srcdir}/Include'
scheme['platinclude'] = '{projectbase}/.'
+ del scheme
def _subst_vars(s, local_vars):
self.assertFalse(other(obj), 'not %s(%s)' % (other.__name__, exp))
def test__all__(self):
- support.check__all__(self, inspect, not_exported=("k", "v", "mod_dict", "modulesbyfile"))
+ support.check__all__(self, inspect, not_exported=("modulesbyfile",))
def generator_function_example(self):
for i in range(2):
endpats[_prefix + '"'] = Double
endpats[_prefix + "'''"] = Single3
endpats[_prefix + '"""'] = Double3
+del _prefix
# A set of all of the single and triple quoted string prefixes,
# including the opening quotes.
single_quoted.add(u)
for u in (t + '"""', t + "'''"):
triple_quoted.add(u)
+del t, u
tabsize = 8
--- /dev/null
+Remove loop variables that are leaking into modules' namespaces.