microsoft/debugpy

debugpy.listen() doesn't return endpoint if "in_process_debug_adapter=True" is passed

wombatzus opened this issue · 0 comments

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.8.5
  • OS and version: Linux 6.8.0-40-generic #40~22.04.3-Ubuntu
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.19
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Calling debugpy.listen(0, in_process_debug_adapter=True) returns None.

Expected behavior

The API reference says debugpy.listen should return a (host, port) tuple, and indeed it does do that when calling debugpy.listen(0) or debugpy.listen(0, in_process_debug_adapter=False).

Makes it a little inconvenient when passing 0 as the port since I have no way to know what port is actually being listened on.

Steps to reproduce:

import debugpy
try:
  host, port = debugpy.listen(5678, in_process_debug_adapter=True)
  print(host, port)
except Exception as e:
  print(f"Exception: {type(e)}: {e}")

Outputs: "Exception: <class 'TypeError'>: cannot unpack non-iterable NoneType object"