Skip to content

Commit a2ae96e

Browse files
xusheng6claude
andcommitted
[emulator] Fix docs stdout example and Python-bindings cmake fallback path
- docs/guide/emulator.md: the stdout callback example used sys.stdout without importing sys; use print(..., end='') so the snippet runs as shown. - api/python/CMakeLists.txt: the non-BN_API_PATH include fell back to ${CMAKE_SOURCE_DIR}/api/cmake/..., which does not exist for an out-of-tree build; point it at the api root via a correct relative path (matching warp). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5234b60 commit a2ae96e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

docs/guide/emulator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ emu.set_pre_instruction_hook(lambda emu, index: True)
242242
emu.set_intrinsic_hook(lambda emu, intrinsic, params: None)
243243

244244
# stdout from emulated printf/puts/putchar; data is bytes.
245-
emu.set_stdout_callback(lambda emu, data: sys.stdout.write(data.decode('latin1')))
245+
emu.set_stdout_callback(lambda emu, data: print(data.decode('latin1'), end=''))
246246

247247
# stdin for emulated getchar/fgets/fread; return up to max_len bytes, b'' for EOF.
248248
emu.set_stdin_callback(lambda emu, max_len: b'')

plugins/emulator/api/python/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ project(emulator-python-api)
55
if(BN_API_PATH)
66
include(${BN_API_PATH}/cmake/PythonBindings.cmake)
77
else()
8-
include(${CMAKE_SOURCE_DIR}/api/cmake/PythonBindings.cmake)
8+
# api/plugins/emulator/api/python -> api root is four levels up
9+
include(${PROJECT_SOURCE_DIR}/../../../../cmake/PythonBindings.cmake)
910
endif()
1011

1112
file(GLOB PYTHON_SOURCES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/*.py)

0 commit comments

Comments
 (0)