churchyard / rpms / python3

Forked from rpms/python3 6 years ago
Clone
Blob Blame History Raw
--- Lib/importlib/_bootstrap.py.fix-handling-of-readonly-pyc-files	2009-10-22 15:24:57.575015046 -0400
+++ Lib/importlib/_bootstrap.py	2009-10-22 15:25:24.024016069 -0400
@@ -522,8 +522,8 @@ class _PyPycFileLoader(PyPycLoader, _PyF
         bytecode_path = self.bytecode_path(name)
         if not bytecode_path:
             bytecode_path = self._base_path + _suffix_list(imp.PY_COMPILED)[0]
-        file = _io.FileIO(bytecode_path, 'w')  # Assuming bytes.
         try:
+            file = _io.FileIO(bytecode_path, 'w')  # Assuming bytes.
             with _closing(file) as bytecode_file:
                 bytecode_file.write(data)
                 return True