diff --git a/meson.build b/meson.build index 06623a305ab54..d038e4996251f 100644 --- a/meson.build +++ b/meson.build @@ -27,6 +27,7 @@ add_project_arguments('-DNPY_NO_DEPRECATED_API=0', language : 'cpp') add_project_arguments('-DNPY_TARGET_VERSION=NPY_1_21_API_VERSION', language : 'c') add_project_arguments('-DNPY_TARGET_VERSION=NPY_1_21_API_VERSION', language : 'cpp') +cython_coverage = get_option('CYTHON_COVERAGE') if fs.exists('_version_meson.py') py.install_sources('_version_meson.py', subdir: 'pandas') diff --git a/meson.options b/meson.options new file mode 100644 index 0000000000000..092b2e736c541 --- /dev/null +++ b/meson.options @@ -0,0 +1 @@ +option('CYTHON_COVERAGE', type: 'boolean', value: false) diff --git a/pandas/_libs/meson.build b/pandas/_libs/meson.build index c27386743c6e9..b354354ae1e7a 100644 --- a/pandas/_libs/meson.build +++ b/pandas/_libs/meson.build @@ -56,8 +56,6 @@ _intervaltree_helper = custom_target('intervaltree_helper_pxi', ) _khash_primitive_helper_dep = declare_dependency(sources: _khash_primitive_helper) -subdir('tslibs') - libs_sources = { # Dict of extension name -> dict of {sources, include_dirs, and deps} # numpy include dir is implicitly included @@ -109,6 +107,17 @@ cython_args = [ if get_option('buildtype') == 'debug' cython_args += ['--gdb'] endif +if cython_coverage + cython_args += ['-X linetrace=true'] + # Linetrace is not enough to ensure coverage is turned on + add_project_arguments('-DCYTHON_TRACE=1', language : 'c') + add_project_arguments('-DCYTHON_TRACE=1', language : 'cpp') + + add_project_arguments('-DCYTHON_TRACE_NOGIL=1', language : 'c') + add_project_arguments('-DCYTHON_TRACE_NOGIL=1', language : 'cpp') +endif + +subdir('tslibs') foreach ext_name, ext_dict : libs_sources py.extension_module( diff --git a/pandas/_libs/parsers.pyx b/pandas/_libs/parsers.pyx index 82e9812094af2..3498c4226e34a 100644 --- a/pandas/_libs/parsers.pyx +++ b/pandas/_libs/parsers.pyx @@ -320,7 +320,7 @@ cdef double round_trip_wrapper(const char *p, char **q, char decimal, cdef char* buffer_rd_bytes_wrapper(void *source, size_t nbytes, size_t *bytes_read, int *status, - const char *encoding_errors) noexcept: + const char *encoding_errors) noexcept nogil: return buffer_rd_bytes(source, nbytes, bytes_read, status, encoding_errors) cdef void del_rd_source_wrapper(void *src) noexcept: diff --git a/pandas/_libs/window/meson.build b/pandas/_libs/window/meson.build index ad15644f73a0c..1e28dcaee9a88 100644 --- a/pandas/_libs/window/meson.build +++ b/pandas/_libs/window/meson.build @@ -1,7 +1,7 @@ py.extension_module( 'aggregations', ['aggregations.pyx'], - cython_args: ['-X always_allow_keywords=true'], + cython_args: cython_args, include_directories: [inc_np, inc_pd], subdir: 'pandas/_libs/window', override_options : ['cython_language=cpp'], @@ -11,7 +11,7 @@ py.extension_module( py.extension_module( 'indexers', ['indexers.pyx'], - cython_args: ['-X always_allow_keywords=true'], + cython_args: cython_args, #['-X always_allow_keywords=true'], include_directories: [inc_np, inc_pd], subdir: 'pandas/_libs/window', install: true