From c6083ab970e436b14987cbc7074fc3a894943fcc Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 1 Jul 2020 20:20:08 +0300 Subject: [PATCH] code/source: remove old IndentationError workaround in getsource() This has been there since as far as the git history goes (2007), is not covered by any test, and says "Buggy python version consider upgrading". Hopefully everyone have upgraded... --- src/_pytest/_code/source.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/_pytest/_code/source.py b/src/_pytest/_code/source.py index 0bc2e243e..eb4c4df78 100644 --- a/src/_pytest/_code/source.py +++ b/src/_pytest/_code/source.py @@ -308,10 +308,7 @@ def getrawcode(obj, trycall: bool = True): def getsource(obj) -> Source: obj = getrawcode(obj) - try: - strsrc = inspect.getsource(obj) - except IndentationError: - strsrc = '"Buggy python version consider upgrading, cannot get source"' + strsrc = inspect.getsource(obj) assert isinstance(strsrc, str) return Source(strsrc)