Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/bochscpu/_bochscpu/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ class Session:
Set the auxiliary variable array
"""
...
def set_auxiliary_variable(self, index: int, value: int) -> bool:
def set_auxiliary_variable(self, index: int, value: int) -> None:
"""
Set an auxiliary variable
"""
Expand All @@ -967,7 +967,7 @@ class Session:
Get an auxiliary variable
"""
...
def __setitem__(self, index: int, value: int) -> bool:
def __setitem__(self, index: int, value: int) -> None:
"""
Alias for `set_auxiliary_variable`
"""
Expand Down
14 changes: 8 additions & 6 deletions python/src/bochscpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <nanobind/stl/list.h>
#include <nanobind/stl/vector.h>

#include <string>


namespace nb = nanobind;
using namespace nb::literals;
Expand Down Expand Up @@ -344,10 +346,10 @@ NB_MODULE(_bochscpu, m)
"set_auxiliary_variable",
[](BochsCPU::Session& s, size_t idx, uint64_t val)
{
if ( idx > BochsCPU::Session::MaxAuxiliaryVariables )
return false;
if ( idx >= BochsCPU::Session::MaxAuxiliaryVariables )
throw std::out_of_range(
"Invalid range, maximum index is " + std::to_string(BochsCPU::Session::MaxAuxiliaryVariables));
s.auxiliaries[idx] = val;
return true;
})
.def(
"__getitem__",
Expand All @@ -359,10 +361,10 @@ NB_MODULE(_bochscpu, m)
"__setitem__",
[](BochsCPU::Session& s, size_t idx, uint64_t val)
{
if ( idx > BochsCPU::Session::MaxAuxiliaryVariables )
return false;
if ( idx >= BochsCPU::Session::MaxAuxiliaryVariables )
throw std::out_of_range(
"Invalid range, maximum index is " + std::to_string(BochsCPU::Session::MaxAuxiliaryVariables));
s.auxiliaries[idx] = val;
return true;
})
.def(
"run",
Expand Down