summaryrefslogtreecommitdiff
path: root/src/Interpreter.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-08-31 23:05:16 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-08-31 23:05:16 +0200
commit804204db7cf1e8a28defd359d17fa72949e13eff (patch)
tree3536d961838d1a6640d1295d808768736bf2317b /src/Interpreter.zig
parent956cd84ca545f1d93e2218cbbdbb39c81a46bec8 (diff)
Implement with ptrCast to make it more transparent.
Diffstat (limited to 'src/Interpreter.zig')
-rw-r--r--src/Interpreter.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Interpreter.zig b/src/Interpreter.zig
index 6862706..6768659 100644
--- a/src/Interpreter.zig
+++ b/src/Interpreter.zig
@@ -4,7 +4,7 @@ const zpy = @import("root.zig");
const Self = @This();
-globals: zpy.Dict,
+globals: *zpy.Dict,
pub fn init() !Self {
c.Py_Initialize();
@@ -20,14 +20,14 @@ pub const RunOptions = struct {
locals: ?*zpy.Dict = null,
};
-pub fn run(self: *Self, str: [*c]const u8, options: RunOptions) zpy.Error!zpy.Object {
+pub fn run(self: *Self, str: [*c]const u8, options: RunOptions) !*zpy.Object {
if (c.PyRun_String(
str,
c.Py_file_input,
- self.globals.object.ptr,
- if (options.locals) |loc| loc.object.ptr else null,
+ @ptrCast(self.globals),
+ @ptrCast(options.locals),
)) |object| {
- return .fromPtr(object);
+ return @ptrCast(object);
}
return error.Exception;