reloadware / reloadium

Hot Reloading and Profiling for Python
https://reloadium.io
Apache License 2.0
2.74k stars 56 forks source link

Debugger strips some docstrings #146

Closed Grainus closed 1 year ago

Grainus commented 1 year ago

Describe the bug*

The Reloadium debugger seems to remove docstring information from functions when it ends with a return statement.

To Reproduce

Steps to reproduce the behavior (done on a fresh project):

  1. Write a function or method with a docstring and that ends with a return statement
  2. Try to programmatically get the docstring (with help(func) or func.__doc__ or inspect.getdoc(func))
  3. Click Debug with Reloadium
  4. The doc will be None

Example program:

def func():
    """Does something cool"""
    return

assert func.__doc__ is not None

Expected behavior

The doc attribute on the function should have the function's docstring as usual. The example program should not throw an AssertionError, and behave as it does with normal debug/run.

Desktop or remote (please complete the following information):**

Additional context

Both of these versions behave as expected:

def func():
    """Does something cool"""
    if True:
        return

def func():
    """Does something cool"""
    return
    pass
dkrystki commented 1 year ago

Fixed in Reloadium 1.1.1 and PyCharm plugin 1.1.1