Skip to content

Commit bfadd79

Browse files
Joe Jevnikllllllllll
Joe Jevnik
authored andcommittedApr 16, 2019
MAINT: rename LIBPY_MAIN to LIBPY_TEST_MAIN
1 parent 1e8690e commit bfadd79

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed
 

‎include/libpy/numpy_utils.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
// (`LIBPY_COMPILING_FOR_TESTS`) which will control the `NO_IMPORT_ARRAY` flag. This flag
2424
// tells numpy to declare the `PyArray_API` flag as an `extern "C" void** PyArray_API`,
2525
// meaning we expect to have this symbol defined by another object we are to be linked
26-
// with. In `main.cc` we also set `LIBPY_MAIN` to disable this feature, but instead define
27-
// `PY_ARRAY_UNIQUE_SYMBOL` which causes changes the declaration of `PyArray_API` to
28-
// change to: `#define PyArray_API PY_ARRAY_UNIQUE_SYMBOL` and then `void**
26+
// with. In `main.cc` we also set `LIBPY_TEST_MAIN` to disable this feature, but instead
27+
// define `PY_ARRAY_UNIQUE_SYMBOL` which causes changes the declaration of `PyArray_API`
28+
// to change to: `#define PyArray_API PY_ARRAY_UNIQUE_SYMBOL` and then `void**
2929
// PyArray_API`. Importantly, this removes the `static` causing the symbol to have
3030
// external linkage. Then, because the tests are declaring the same symbol as extern, they
3131
// will all resolve to the same `PyArray_API` instance and we only need to call
3232
// `import_array` once in `main.cc`.
33-
#if defined(LIBPY_COMPILING_FOR_TESTS) && !defined(LIBPY_MAIN)
33+
#if defined(LIBPY_COMPILING_FOR_TESTS) && !defined(LIBPY_TEST_MAIN)
3434
#define NO_IMPORT_ARRAY
3535
#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_libpy
3636
#endif

‎testleaks.supp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ leak:_ctypes.cpython
55
leak:_ctypes.x86_64-linux-gnu.so
66
leak:numpy/core/src/multiarray/arraytypes.c.src
77
leak:numpy/core/src/multiarray/alloc.c
8-
leak:numpy/core/src/multiarray/ctors.c
8+
leak:numpy/core/src/multiarray/ctors.c

‎tests/main.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "gtest/gtest.h"
22
#include <Python.h>
33

4-
#define LIBPY_MAIN
4+
#define LIBPY_TEST_MAIN
55
#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_libpy
66
#include "libpy/numpy_utils.h"
77

0 commit comments

Comments
 (0)
Please sign in to comment.