summaryrefslogtreecommitdiff
path: root/coverage/execfile.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-12-31 12:57:11 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-12-31 13:07:02 -0500
commit3d8526412e90f645ecc4b3ae9b567cb2c73fe3aa (patch)
tree32292a12338347b5d8a64b49dcc2d33f4801dd30 /coverage/execfile.py
parent39f8f3ed43cf82cdf30b57d7f9624addcbd9e372 (diff)
downloadpython-coveragepy-git-3d8526412e90f645ecc4b3ae9b567cb2c73fe3aa.tar.gz
refactor: remove code that was only needed for Python 3.6
Diffstat (limited to 'coverage/execfile.py')
-rw-r--r--coverage/execfile.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/coverage/execfile.py b/coverage/execfile.py
index 01ddd0cd..b5d3a65f 100644
--- a/coverage/execfile.py
+++ b/coverage/execfile.py
@@ -80,10 +80,7 @@ class PyRunner:
This needs to happen before any importing, and without importing anything.
"""
if self.as_module:
- if env.PYBEHAVIOR.actual_syspath0_dash_m:
- path0 = os.getcwd()
- else:
- path0 = ""
+ path0 = os.getcwd()
elif os.path.isdir(self.arg0):
# Running a directory means running the __main__.py file in that
# directory.
@@ -295,18 +292,14 @@ def make_code_from_pyc(filename):
if magic != PYC_MAGIC_NUMBER:
raise NoCode(f"Bad magic number in .pyc file: {magic!r} != {PYC_MAGIC_NUMBER!r}")
- date_based = True
- if env.PYBEHAVIOR.hashed_pyc_pep552:
- flags = struct.unpack('<L', fpyc.read(4))[0]
- hash_based = flags & 0x01
- if hash_based:
- fpyc.read(8) # Skip the hash.
- date_based = False
- if date_based:
+ flags = struct.unpack('<L', fpyc.read(4))[0]
+ hash_based = flags & 0x01
+ if hash_based:
+ fpyc.read(8) # Skip the hash.
+ else:
# Skip the junk in the header that we don't need.
- fpyc.read(4) # Skip the moddate.
- # 3.3 added another long to the header (size), skip it.
- fpyc.read(4)
+ fpyc.read(4) # Skip the moddate.
+ fpyc.read(4) # Skip the size.
# The rest of the file is the code object we want.
code = marshal.load(fpyc)