Skip to content

Commit f9c517e

Browse files
authored
Fix edit magic payload type (#1171)
1 parent a09892e commit f9c517e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ipykernel/zmqshell.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def edit(self, parameter_s="", last_call=None):
302302

303303
# Make sure we send to the client an absolute path, in case the working
304304
# directory of client and kernel don't match
305-
filename = Path(filename).resolve()
305+
filename = str(Path(filename).resolve())
306306

307307
payload = {"source": "edit_magic", "filename": filename, "line_number": lineno}
308308
assert self.shell is not None

tests/test_zmq_shell.py

+3
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ def test_magics(tmp_path):
220220
tmp_file = tmp_path / "test.txt"
221221
tmp_file.write_text("hi", "utf8")
222222
magics.edit(str(tmp_file))
223+
payload = shell.payload_manager.read_payload()[0]
224+
assert payload["filename"] == str(tmp_file)
225+
223226
magics.clear([])
224227
magics.less(str(tmp_file))
225228
if os.name == "posix":

0 commit comments

Comments
 (0)