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
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ jobs:
-D CMAKE_INSTALL_LIBDIR=lib \
-D PYTHON_EXECUTABLE=`which python` \
-D XPYT_BUILD_TESTS=ON \
-D CMAKE_C_COMPILER=$CC \
-D CMAKE_CXX_COMPILER=$CXX \
${{ env.CMAKE_EXTRA_ARGS }}
working-directory: build

Expand Down
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
# of a spurious bug in debugpy
- python <3.13
- pip
- xeus-python-shell>=0.7.0,<0.8
- xeus-python-shell>=0.8.0,<0.9
- debugpy>=1.6.5
- ipython
# Test dependencies
Expand Down
2 changes: 1 addition & 1 deletion environment-wasm-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- pyjs >=4,<5
- libpython
- zstd
- openssl
- openssl <4
- xz
- ipywidgets
- xeus-python-shell>=0.7.0,<0.8
Expand Down
23 changes: 22 additions & 1 deletion src/xdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,30 @@ namespace xpyt

std::string src_var_name = message["arguments"]["srcVariableName"].get<std::string>();
std::string dst_var_name = message["arguments"]["dstVariableName"].get<std::string>();
int src_frame_id = message["arguments"]["srcFrameId"].get<int>();
bool valid = false;
{
py::gil_scoped_acquire acquire;
py::str py_src_var_name = py::str(src_var_name);
py::str py_dst_var_name = py::str(dst_var_name);
bool valid_src_name = PyUnicode_IsIdentifier(py_src_var_name.ptr()) == 1;
bool valid_dst_name = PyUnicode_IsIdentifier(py_dst_var_name.ptr()) == 1;
valid = valid_src_name && valid_dst_name;
}

if (!valid)
{
nl::json reply = {
{"type", "response"},
{"request_seq", message["seq"]},
{"success", false},
{"command", message["command"]},
{"message", "dstVariableName and srcVariableName must be valid identifiers"}
};
return reply;
}

// It basically runs a setExpression in the globals dictionary of Python.
int src_frame_id = message["arguments"]["srcFrameId"].get<int>();
int seq = message["seq"].get<int>();
std::string expression = "globals()['" + dst_var_name + "']";
nl::json request = {
Expand Down
Loading