Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a786d2a

Browse filesBrowse files
committed
Inline convert_voidptr to tkagg.
It's only used in this file, and pulling in the whole `py_converters.h` causes this extension to unnecessarily require compiling against NumPy.
1 parent 4155d91 commit a786d2a
Copy full SHA for a786d2a

File tree

Expand file treeCollapse file tree

4 files changed

+7
-13
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+7
-13
lines changed

‎setupext.py

Copy file name to clipboardExpand all lines: setupext.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ def get_extensions(self):
447447
ext = Extension(
448448
"matplotlib.backends._tkagg", [
449449
"src/_tkagg.cpp",
450-
"src/py_converters.cpp",
451450
],
452451
include_dirs=["src"],
453452
# psapi library needed for finding Tcl/Tk at run time.

‎src/_tkagg.cpp

Copy file name to clipboardExpand all lines: src/_tkagg.cpp
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@
3333
#define dlsym GetProcAddress
3434
#else
3535
#include <dlfcn.h>
36-
// Suppress -Wunused-function on POSIX, but not on Windows where that would
37-
// lead to PY_ARRAY_UNIQUE_SYMBOL being an unresolved external.
38-
#define NO_IMPORT_ARRAY
3936
#endif
4037

4138
// Include our own excerpts from the Tcl / Tk headers
4239
#include "_tkmini.h"
43-
#include "py_converters.h"
40+
41+
static int convert_voidptr(PyObject *obj, void *p)
42+
{
43+
void **val = (void **)p;
44+
*val = PyLong_AsVoidPtr(obj);
45+
return *val != NULL ? 1 : !PyErr_Occurred();
46+
}
4447

4548
// Global vars for Tk functions. We load these symbols from the tkinter
4649
// extension module or loaded Tk libraries at run-time.

‎src/py_converters.cpp

Copy file name to clipboardExpand all lines: src/py_converters.cpp
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,6 @@ int convert_from_attr(PyObject *obj, const char *name, converter func, void *p)
9494
return 1;
9595
}
9696

97-
int convert_voidptr(PyObject *obj, void *p)
98-
{
99-
void **val = (void **)p;
100-
*val = PyLong_AsVoidPtr(obj);
101-
return *val != NULL ? 1 : !PyErr_Occurred();
102-
}
103-
10497
int convert_double(PyObject *obj, void *p)
10598
{
10699
double *val = (double *)p;

‎src/py_converters.h

Copy file name to clipboardExpand all lines: src/py_converters.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ typedef int (*converter)(PyObject *, void *);
2222
int convert_from_attr(PyObject *obj, const char *name, converter func, void *p);
2323
int convert_from_method(PyObject *obj, const char *name, converter func, void *p);
2424

25-
int convert_voidptr(PyObject *obj, void *p);
2625
int convert_double(PyObject *obj, void *p);
2726
int convert_bool(PyObject *obj, void *p);
2827
int convert_cap(PyObject *capobj, void *capp);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.