# Buggy code
def __init__(self):
    # type: () -> None
    self._registry = cast("DefaultDict[int, Set[str]]", defaultdict(set))
    self._lock = threading.RLock()
    self._getpid = os.getpid
    self._exists = os.path.exists
    self._rmtree = shutil.rmtree
    atexit.register(self.teardown)


# Traceback (FileNotFoundError)
Engine traceback:
in select
in pants.core.goals.typecheck.typecheck
in pants.backend.python.typecheck.mypy.rules.mypy_typecheck
in pants.backend.python.typecheck.mypy.rules.mypy_typecheck_partition
in pants.backend.python.util_rules.pex.create_pex
in pants.backend.python.util_rules.pex.find_interpreter (CPython<3.9,<4,>=3.7,>=3.8)
in pants.engine.process.fallible_to_exec_result_or_raise
Traceback (most recent call last):
File "/home/toolchain/.*****/pants/setup/bootstrap-Linux-x86_64/2.1.0.dev0_py38/lib/python3.8/site-packages/pants/engine/process.py", line 241, in fallible_to_exec_result_or_raise
raise ProcessExecutionFailure(
pants.engine.process.ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython<3.9,<4,>=3.7,>=3.8' failed with exit code 1.
stdout:

stderr:
Traceback (most recent call last):
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.bootstrap/pex/pex.py", line 443, in execute
exit_code = self._wrap_coverage(self._wrap_profiling, self._execute)
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.bootstrap/pex/pex.py", line 375, in _wrap_coverage
return runner(*args)
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.bootstrap/pex/pex.py", line 406, in _wrap_profiling
return runner(*args)
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.bootstrap/pex/pex.py", line 494, in _execute
return self.execute_entry(self._pex_info.entry_point)
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.bootstrap/pex/pex.py", line 596, in execute_entry
return runner(entry_point)
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.bootstrap/pex/pex.py", line 612, in execute_pkg_resources
return runner()
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.deps/pex-2.1.20-py2.py3-none-any.whl/pex/bin/pex.py", line 994, in main
pex_builder.freeze(bytecode_compile=options.compile)
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.deps/pex-2.1.20-py2.py3-none-any.whl/pex/pex_builder.py", line 505, in freeze
self._prepare_bootstrap()
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.deps/pex-2.1.20-py2.py3-none-any.whl/pex/pex_builder.py", line 463, in _prepare_bootstrap
vendor.vendor_runtime(
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.deps/pex-2.1.20-py2.py3-none-any.whl/pex/vendor/__init__.py", line 166, in vendor_runtime
chroot.copy(src, dest, label)
File "/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.deps/pex-2.1.20-py2.py3-none-any.whl/pex/common.py", line 512, in copy
shutil.copy(src, os.path.join(self.chroot, dst))
File "/usr/local/lib/python3.8/shutil.py", line 415, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/local/lib/python3.8/shutil.py", line 261, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/toolchain/.*****/pants/named_*****s/pex_root/unzipped_pexes/d7ed954089c1232b9c1a001845a5a384366d3669/.deps/pex-2.1.20-py2.py3-none-any.whl/pex/vendor/_vendored/setuptools/pkg_resources/_vendor/__py*****__/pyparsing.cpython-37.pyc.140210639452464'

# Fixed code
def __init__(self):
    # type: () -> None
    self._registry = defaultdict(set)  # type: DefaultDict[int, Set[str]]
    self._lock = threading.RLock()
    self._getpid = os.getpid
    self._exists = os.path.exists
    self._rmtree = shutil.rmtree
    atexit.register(self.teardown)