Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 658397b

Browse files
authored
Merge pull request #26175 from meeseeksmachine/auto-backport-of-pr-26165-on-v3.7.x
Backport PR #26165 on branch v3.7.x (Avoid Py_VerboseFlag deprecation from Python 3.12)
2 parents 0df4ec0 + 918ccf7 commit 658397b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

lib/matplotlib/tri/_triangulation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
import numpy as np
24

35
from matplotlib import _api
@@ -55,7 +57,7 @@ def __init__(self, x, y, triangles=None, mask=None):
5557
if triangles is None:
5658
# No triangulation specified, so use matplotlib._qhull to obtain
5759
# Delaunay triangulation.
58-
self.triangles, self._neighbors = _qhull.delaunay(x, y)
60+
self.triangles, self._neighbors = _qhull.delaunay(x, y, sys.flags.verbose)
5961
self.is_delaunay = True
6062
else:
6163
# Triangulation specified. Copy, since we may correct triangle

src/_qhull_wrapper.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,12 @@ delaunay(PyObject *self, PyObject *args)
258258
npy_intp npoints;
259259
const double* x;
260260
const double* y;
261+
int verbose = 0;
261262

262-
if (!PyArg_ParseTuple(args, "O&O&",
263+
if (!PyArg_ParseTuple(args, "O&O&i:delaunay",
263264
&xarray.converter_contiguous, &xarray,
264-
&yarray.converter_contiguous, &yarray)) {
265+
&yarray.converter_contiguous, &yarray,
266+
&verbose)) {
265267
return NULL;
266268
}
267269

@@ -288,7 +290,7 @@ delaunay(PyObject *self, PyObject *args)
288290
}
289291

290292
CALL_CPP("qhull.delaunay",
291-
(ret = delaunay_impl(npoints, x, y, Py_VerboseFlag == 0)));
293+
(ret = delaunay_impl(npoints, x, y, verbose == 0)));
292294

293295
return ret;
294296
}
@@ -302,7 +304,7 @@ version(PyObject *self, PyObject *arg)
302304

303305
static PyMethodDef qhull_methods[] = {
304306
{"delaunay", delaunay, METH_VARARGS,
305-
"delaunay(x, y, /)\n"
307+
"delaunay(x, y, verbose, /)\n"
306308
"--\n\n"
307309
"Compute a Delaunay triangulation.\n"
308310
"\n"
@@ -311,6 +313,8 @@ static PyMethodDef qhull_methods[] = {
311313
"x, y : 1d arrays\n"
312314
" The coordinates of the point set, which must consist of at least\n"
313315
" three unique points.\n"
316+
"verbose : int\n"
317+
" Python's verbosity level.\n"
314318
"\n"
315319
"Returns\n"
316320
"-------\n"

0 commit comments

Comments
 (0)