mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-05 03:00:17 +00:00
...
This commit is contained in:
parent
c55dcd9ab8
commit
59ec34b2a1
@ -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")
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user