diff --git a/py/_code/code.py b/py/_code/code.py index b40ef28c4..62c0466ad 100644 --- a/py/_code/code.py +++ b/py/_code/code.py @@ -157,7 +157,8 @@ class TracebackEntry(object): return self.exprinfo def getfirstlinesource(self): - return self.frame.code.firstlineno + # on Jython this firstlineno can be -1 apparently + return max(self.frame.code.firstlineno, 0) def getsource(self): """ return failing source code. """ diff --git a/testing/plugin/test_pytest_terminal.py b/testing/plugin/test_pytest_terminal.py index bbb2a0ab7..02a40188f 100644 --- a/testing/plugin/test_pytest_terminal.py +++ b/testing/plugin/test_pytest_terminal.py @@ -610,7 +610,7 @@ def pytest_report_header(config): "*hello: info*", ]) -needsosdup = py.test.mark.xfail("not hasattr(os, 'dup')") +@py.test.mark.xfail("not hasattr(os, 'dup')") def test_fdopen_kept_alive_issue124(testdir): testdir.makepyfile(""" import os, sys