unused imports, pep8

This commit is contained in:
Philip Jenvey 2012-02-24 21:48:17 -08:00
parent 6f73874edd
commit 4b42ff609d
2 changed files with 12 additions and 12 deletions

View File

@ -406,14 +406,16 @@ class _LoaderBasics:
pass
else:
if _r_long(raw_timestamp) != source_mtime:
raise ImportError("bytecode is stale for {}".format(fullname))
raise ImportError(
"bytecode is stale for {}".format(fullname))
try:
source_size = source_stats['size'] & 0xFFFFFFFF
except KeyError:
pass
else:
if _r_long(raw_size) != source_size:
raise ImportError("bytecode is stale for {}".format(fullname))
raise ImportError(
"bytecode is stale for {}".format(fullname))
# Can't return the code object as errors from marshal loading need to
# propagate even when source is available.
return data[12:]

View File

@ -1,15 +1,11 @@
"""Abstract base classes related to import."""
from . import _bootstrap
from . import machinery
from . import util
import abc
import imp
import io
import marshal
import os.path
import sys
import tokenize
import types
import warnings
@ -256,7 +252,8 @@ class PyPycLoader(PyLoader):
try:
magic = data[:4]
if len(magic) < 4:
raise ImportError("bad magic number in {}".format(fullname))
raise ImportError(
"bad magic number in {}".format(fullname))
raw_timestamp = data[4:8]
if len(raw_timestamp) < 4:
raise EOFError("bad timestamp in {}".format(fullname))
@ -264,7 +261,8 @@ class PyPycLoader(PyLoader):
bytecode = data[8:]
# Verify that the magic number is valid.
if imp.get_magic() != magic:
raise ImportError("bad magic number in {}".format(fullname))
raise ImportError(
"bad magic number in {}".format(fullname))
# Verify that the bytecode is not stale (only matters when
# there is source to fall back on.
if source_timestamp: