diff --git a/3rd/numpy/tests/test_numpy.py b/3rd/numpy/tests/test_numpy.py index e361d78b..6377ae63 100644 --- a/3rd/numpy/tests/test_numpy.py +++ b/3rd/numpy/tests/test_numpy.py @@ -1,12 +1,10 @@ -import sys import math +from typing import TYPE_CHECKING -is_pkpy = not hasattr(sys, 'getrefcount') - -if is_pkpy: - import numpy_bindings as np -else: +if TYPE_CHECKING: import numpy as np +else: + np = __import__('E:/pocketpy/3rd/numpy/build/Release/numpy.dll') def assert_equal(a, b): assert (a == b).all() @@ -888,3 +886,5 @@ assert_equal(arr1[-2:3:1], np.array([[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]], [[11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]])) + +print("ALL TESTS PASSED") \ No newline at end of file diff --git a/include/pocketpy/export.h b/include/pocketpy/export.h index 972a8bc9..b7baee80 100644 --- a/include/pocketpy/export.h +++ b/include/pocketpy/export.h @@ -3,7 +3,6 @@ // clang-format off #if defined(_WIN32) || defined(_WIN64) - // define something for Windows (32-bit and 64-bit, this part is common) #ifdef PY_DYNAMIC_MODULE #define PK_API __declspec(dllimport) #else diff --git a/include/pybind11/internal/module.h b/include/pybind11/internal/module.h index 41fabc47..0072de7f 100644 --- a/include/pybind11/internal/module.h +++ b/include/pybind11/internal/module.h @@ -55,6 +55,7 @@ using module_ = module; extern "C" PK_EXPORT bool py_module_initialize() { \ auto m = ::pkbind::module::create(#name); \ _pkbind_register_##name(m); \ + py_assign(py_retval(), m.ptr()); \ return true; \ } \ static void _pkbind_register_##name(::pkbind::module& variable)