Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When evaluating to None in repl provide empty string instead of null. Fixes #985 #1063

Merged
merged 1 commit into from
Sep 26, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ def __create_frame():
if context == 'repl' and eval_result is None:
# We don't want "None" to appear when typing in the repl.
body = pydevd_schema.EvaluateResponseBody(
result=None,
result='',
variablesReference=0,
)

Expand Down
26 changes: 26 additions & 0 deletions src/debugpy/_vendored/pydevd/tests_python/test_debugger_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -1879,6 +1879,32 @@ def additional_output_checks(writer, stdout, stderr):
writer.finished_ok = True


def test_evaluate_none(case_setup, pyfile):

@pyfile
def eval_none():
print('TEST SUCEEDED') # break here

with case_setup.test_file(eval_none) as writer:
json_facade = JsonFacade(writer)

json_facade.write_launch(justMyCode=False)

json_facade.write_set_breakpoints(writer.get_line_index_with_content('break here'))
json_facade.write_make_initial_run()

json_hit = json_facade.wait_for_thread_stopped()
json_hit = json_facade.get_stack_as_json_hit(json_hit.thread_id)

evaluate_response = json_facade.evaluate('None', json_hit.frame_id, context='repl')
assert evaluate_response.body.result is not None
assert evaluate_response.body.result == ''

json_facade.write_continue()

writer.finished_ok = True


def test_evaluate_numpy(case_setup, pyfile):
try:
import numpy
Expand Down