Thanks for the report! On Wed, Jul 25, 2012 at 12:02 PM, Yaroslav Halchenko <li...@onerussian.com> wrote: > So I wonder, wouldn't it be reasonable (i.e. more robust) in cython_inline to > instantiate first build_extension and seek full name for the resultant > extension from it? That should eliminate any possibility to get different > names. > > e.g. smth like: > > > $> quilt diff > --- a/Cython/Build/Inline.py > +++ b/Cython/Build/Inline.py > @@ -139,8 +139,15 @@ def cython_inline(code, > key = orig_code, arg_sigs, sys.version_info, sys.executable, > Cython.__version__ > module_name = "_cython_inline_" + > hashlib.md5(str(key).encode('utf-8')).hexdigest() > > - so_ext = [ ext for ext,_,mod_type in imp.get_suffixes() if mod_type == > imp.C_EXTENSION ][0] > - module_path = os.path.join(lib_dir, module_name+so_ext) > + dist = Distribution() > + # Ensure the build respects distutils configuration by parsing > + # the configuration files > + config_files = dist.find_config_files() > + dist.parse_config_files(config_files) > + build_extension = build_ext(dist) > + build_extension.finalize_options() > + > + module_path = os.path.join(lib_dir, > build_extension.get_ext_filename(module_name)) > > if not os.path.exists(lib_dir): > os.makedirs(lib_dir) > @@ -178,13 +185,6 @@ def __invoke(%(params)s): > sources = [pyx_file], > include_dirs = c_include_dirs, > extra_compile_args = cflags) > - dist = Distribution() > - # Ensure the build respects distutils configuration by parsing > - # the configuration files > - config_files = dist.find_config_files() > - dist.parse_config_files(config_files) > - build_extension = build_ext(dist) > - build_extension.finalize_options() > build_extension.extensions = cythonize([extension], ctx=ctx, > quiet=quiet) > build_extension.build_temp = os.path.dirname(pyx_file) > build_extension.build_lib = lib_dir
One essential feature of cython.inline(...) is that if the code has already been compiled (and loaded) it should return very fast. This would seem to add significant overhead. Is the extension relatively consistant? Perhaps it could be cached at module load time. - Robert _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel