blob: cfd7704cd7cf400145c14fd624feb64e88da8db9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
const std = @import("std");
const Io = std.Io;
const zpy = @import("zpy");
pub fn main() !void {
var py: zpy.Interpreter = try .init();
defer py.deinit();
_ = try py.run("def hello(a, b): return a + b", .{ });
var test_fn = py.globals.get(.{ .string = "hello" }) orelse unreachable;
defer test_fn.decref();
var result = try test_fn.call(try .pack(&.{
(try zpy.Int.from(42)).object,
(try zpy.Int.from(20)).object,
}), null);
defer result.decref();
std.debug.print("hello() = {f}\n", .{result});
}
|