SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

72153 0 0 Python

gh-71765: Fix inspect.getsource() on empty file (GH-20809)

* bpo-27578: Fix inspect.getsource() on empty file

For modules from empty files, `inspect.getsource()` now
returns an empty string, and `inspect.getsourcelines()` returns
a list of one empty string, fixing the expected invariant.

As indicated by `exec('')`, empty strings are valid Python
source code.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
K
kernc committed
52ef4430a9b3e212fe9200675cddede77b90785b
Parent: f6cdc6b
Committed by GitHub <noreply@github.com> on 3/18/2024, 3:13:02 PM