torsava / rpms / python3

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