Skip to content

Commit

Permalink
revvert read_memory return type back to bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Oct 23, 2023
1 parent 6ba5b6d commit b61ca83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions spinnman/processes/read_memory_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def __handle_response(self, offset: int, response: Response):
self._view[offset:offset + response.length] = response.data[
response.offset:response.offset + response.length]

def read_memory(
self, coordinates: XYP, base_address: int, length: int) -> bytes:
def read_memory(self, coordinates: XYP, base_address: int,
length: int) -> bytearray:
"""
Read some memory from a core.
Expand All @@ -56,7 +56,7 @@ def read_memory(
functools.partial(ReadMemory, coordinates))

def read_link_memory(self, coordinates: XYP, link: int,
base_address: int, length: int) -> bytes:
base_address: int, length: int) -> bytearray:
"""
Read some memory from the neighbour of a core.
Expand All @@ -73,7 +73,7 @@ def read_link_memory(self, coordinates: XYP, link: int,
def _read_memory(
self, base_address: int, length: int,
packet_class: Callable[
[int, int], AbstractSCPRequest[Response]]) -> bytes:
[int, int], AbstractSCPRequest[Response]]) -> bytearray:
data = bytearray(length)
self._view = memoryview(data)
n_bytes = length
Expand All @@ -88,4 +88,4 @@ def _read_memory(
n_bytes -= bytes_to_get
offset += bytes_to_get

return bytes(data)
return data
2 changes: 1 addition & 1 deletion spinnman/transceiver/base_transceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ def write_user(
@overrides(Transceiver.read_memory)
def read_memory(
self, x: int, y: int, base_address: int, length: int,
cpu: int = 0) -> bytes:
cpu: int = 0) -> bytearray:
try:
process = ReadMemoryProcess(self._scamp_connection_selector)
return process.read_memory((x, y, cpu), base_address, length)
Expand Down

0 comments on commit b61ca83

Please sign in to comment.