Commits

Anthony Tuininga  committed cce3404

Added support for replacing paths in Python 3.x.

  • Participants
  • Parent commits 11bd1eb

Comments (0)

Files changed (1)

File cx_Freeze/finder.py

         for i, value in enumerate(constants):
             if isinstance(value, type(co)):
                 constants[i] = self._ReplacePathsInCode(topLevelModule, value)
-        return types.CodeType(co.co_argcount, co.co_nlocals, co.co_stacksize,
-                co.co_flags, co.co_code, tuple(constants), co.co_names,
-                co.co_varnames, newFileName, co.co_name, co.co_firstlineno,
-                co.co_lnotab, co.co_freevars, co.co_cellvars)
+        if sys.version_info[0] < 3:
+            return types.CodeType(co.co_argcount, co.co_nlocals,
+                    co.co_stacksize, co.co_flags, co.co_code, tuple(constants),
+                    co.co_names, co.co_varnames, newFileName, co.co_name,
+                    co.co_firstlineno, co.co_lnotab, co.co_freevars,
+                    co.co_cellvars)
+        return types.CodeType(co.co_argcount, co.co_kwonlyargcount,
+                co.co_nlocals, co.co_stacksize, co.co_flags, co.co_code,
+                tuple(constants), co.co_names, co.co_varnames, newFileName,
+                co.co_name, co.co_firstlineno, co.co_lnotab, co.co_freevars,
+                co.co_cellvars)
 
     def _RunHook(self, hookName, moduleName, *args):
         """Run hook for the given module if one is present."""