Skip to content

Commit 2d0a738

Browse files
committed
lpython.py: Support @ pythoncall() decorator
1 parent be4b110 commit 2d0a738

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/runtime/lpython/lpython.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,14 @@ def ccall(f):
457457
return f
458458
return CTypes(f)
459459

460+
def pythoncall(*args, **kwargs):
461+
def inner(fn):
462+
import importlib
463+
module = importlib.import_module(kwargs["module"])
464+
fn_new = getattr(module, fn.__name__)
465+
return fn_new
466+
return inner
467+
460468
def union(f):
461469
fields = []
462470
for name in f.__annotations__:

0 commit comments

Comments
 (0)