Skip to content

Commit

Permalink
Use allocator.OutOfMemory (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
delta003 authored Sep 5, 2023
1 parent 669d5d3 commit 51dc3dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pydust/src/errors.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const std = @import("std");

pub const PyError = error{
// Propagate an error raised from another Python function call.
// This is the equivalent of returning PyNULL and allowing the already set error info to remain.
Propagate,
OOM,
Raised,
};
} || std.mem.Allocator.Error;
2 changes: 1 addition & 1 deletion pydust/src/trampoline.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn setErr(err: PyError) void {
return switch (err) {
error.Propagate => {},
error.Raised => {},
error.OOM => py.MemoryError.raise("OOM") catch return,
error.OutOfMemory => py.MemoryError.raise("OOM") catch return,
};
}

Expand Down

0 comments on commit 51dc3dd

Please sign in to comment.