Skip to content

Commit 9cd411e

Browse files
committed
BLD: silence warnings from using deprecated NumPy C API
This cannot be easily replaced - the code uses `->data = `, and the normal replacement for that (`PyArray_DATA`) cannot be used as an lvalue.
1 parent 2751aee commit 9cd411e

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

pandas/_libs/meson.build

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,6 @@ libs_sources = {
129129
'parsers': {'sources': [cython_sources['parsers.pyx'], 'src/parser/tokenizer.c', 'src/parser/io.c'],
130130
'include_dirs': [klib_include, 'src'],
131131
'deps': _khash_primitive_helper_dep},
132-
'json': {'sources': ['src/ujson/python/ujson.c',
133-
'src/ujson/python/objToJSON.c',
134-
'src/ujson/python/date_conversions.c',
135-
'src/ujson/python/JSONtoObj.c',
136-
'src/ujson/lib/ultrajsonenc.c',
137-
'src/ujson/lib/ultrajsondec.c',
138-
'tslibs/src/datetime/np_datetime.c',
139-
'tslibs/src/datetime/np_datetime_strings.c'],
140-
'include_dirs': [inc_datetime, 'src/ujson/lib', 'src/ujson/python']},
141132
'reduction': {'sources': ['reduction.pyx']},
142133
'ops': {'sources': ['ops.pyx']},
143134
'ops_dispatch': {'sources': ['ops_dispatch.pyx']},
@@ -162,6 +153,32 @@ foreach ext_name, ext_dict : libs_sources
162153
)
163154
endforeach
164155

156+
# Some deprecated NumPy API usage in ujson cannot easily be replaced
157+
# (to try, use: `c_args: '-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION'`),
158+
# so silence the build warnings for the time being.
159+
cc = meson.get_compiler('c')
160+
_cflag_Wno_cpp = cc.get_supported_arguments('-Wno-cpp')
161+
162+
py.extension_module(
163+
'json',
164+
['src/ujson/python/ujson.c',
165+
'src/ujson/python/objToJSON.c',
166+
'src/ujson/python/date_conversions.c',
167+
'src/ujson/python/JSONtoObj.c',
168+
'src/ujson/lib/ultrajsonenc.c',
169+
'src/ujson/lib/ultrajsondec.c',
170+
'tslibs/src/datetime/np_datetime.c',
171+
'tslibs/src/datetime/np_datetime_strings.c'
172+
],
173+
c_args: _cflag_Wno_cpp,
174+
include_directories: [
175+
inc_np, inc_datetime, 'src/ujson/lib', 'src/ujson/python'
176+
],
177+
dependencies: ext_dict.get('deps', ''),
178+
subdir: 'pandas/_libs',
179+
install: true
180+
)
181+
165182
py.install_sources('__init__.py',
166183
pure: false,
167184
subdir: 'pandas/_libs')

0 commit comments

Comments
 (0)