uqfoundation/dill

dill.source.findsource fails when in asyncio REPL

Opened this issue · 0 comments

Minimal repro in python -m asyncio:

import dill

def f(x):
  return x*x

dill.source.findsource(f) # prints out `asyncio.__main__`

This commit demonstrates a hotfix: jarmitage@e611d8b

But this also does not work for other derivative REPLs based on Asyncio, for example Sardine: https://github.com/Bubobubobubobubo/sardine/blob/main/sardine/console.py

So it could also be is_module_main = (module and module.__name__ == '__main__' and not file) or file=='<console>'