diff --git a/src/cffi/api.py b/src/cffi/api.py index edeb7928..5a474f3d 100644 --- a/src/cffi/api.py +++ b/src/cffi/api.py @@ -693,7 +693,8 @@ def emit_c_code(self, filename): raise TypeError("emit_c_code() is only for C extension modules, " "not for dlopen()-style pure Python modules") recompile(self, module_name, source, - c_file=filename, call_c_compiler=False, **kwds) + c_file=filename, call_c_compiler=False, + uses_ffiplatform=False, **kwds) def emit_python_code(self, filename): from .recompiler import recompile @@ -705,7 +706,8 @@ def emit_python_code(self, filename): raise TypeError("emit_python_code() is only for dlopen()-style " "pure Python modules, not for C extension modules") recompile(self, module_name, source, - c_file=filename, call_c_compiler=False, **kwds) + c_file=filename, call_c_compiler=False, + uses_ffiplatform=False, **kwds) def compile(self, tmpdir='.', verbose=0, target=None, debug=None): """The 'target' argument gives the final file name of the diff --git a/src/cffi/recompiler.py b/src/cffi/recompiler.py index 3c427754..57781a3c 100644 --- a/src/cffi/recompiler.py +++ b/src/cffi/recompiler.py @@ -1529,7 +1529,8 @@ def _patch_for_target(patchlist, target): def recompile(ffi, module_name, preamble, tmpdir='.', call_c_compiler=True, c_file=None, source_extension='.c', extradir=None, - compiler_verbose=1, target=None, debug=None, **kwds): + compiler_verbose=1, target=None, debug=None, + uses_ffiplatform=True, **kwds): if not isinstance(module_name, str): module_name = module_name.encode('ascii') if ffi._windows_unicode: @@ -1556,7 +1557,10 @@ def recompile(ffi, module_name, preamble, tmpdir='.', call_c_compiler=True, else: target = '*' # - ext = ffiplatform.get_extension(ext_c_file, module_name, **kwds) + if uses_ffiplatform: + ext = ffiplatform.get_extension(ext_c_file, module_name, **kwds) + else: + ext = None updated = make_c_source(ffi, module_name, preamble, c_file, verbose=compiler_verbose) if call_c_compiler: