diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2021-06-15 14:57:03 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2021-06-15 14:57:03 +0100 |
commit | d18bf1e01b65ee4bf0c804e2843b282d3d4e5d7c (patch) | |
tree | 4a95cbc6ffdf13bad6ecbc7f8d5af99631984123 /dev-python/pytest/files | |
parent | e748ba9741f6540f4675c23e3e37b73e822c13a4 (diff) |
gentoo resync : 15.06.2021
Diffstat (limited to 'dev-python/pytest/files')
-rw-r--r-- | dev-python/pytest/files/pytest-6.2.4-py310.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dev-python/pytest/files/pytest-6.2.4-py310.patch b/dev-python/pytest/files/pytest-6.2.4-py310.patch new file mode 100644 index 000000000000..88c8f703f08a --- /dev/null +++ b/dev-python/pytest/files/pytest-6.2.4-py310.patch @@ -0,0 +1,34 @@ +From 78fb97105f38dc286353bbc331a243b6e753fe3c Mon Sep 17 00:00:00 2001 +From: Petr Viktorin <encukou@gmail.com> +Date: Wed, 6 Jan 2021 13:33:33 +0100 +Subject: [PATCH] Make code.FormattedExcinfo.get_source more defensive + +When line_index was a large negative number, get_source failed +on `source.lines[line_index]`. +Use the same dummy Source as with a large positive line_index. +--- + src/_pytest/_code/code.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py +index b85217560..af3bdf056 100644 +--- a/src/_pytest/_code/code.py ++++ b/src/_pytest/_code/code.py +@@ -721,11 +721,11 @@ class FormattedExcinfo: + ) -> List[str]: + """Return formatted and marked up source lines.""" + lines = [] +- if source is None or line_index >= len(source.lines): ++ if source is not None and line_index < 0: ++ line_index += len(source.lines) ++ if source is None or line_index >= len(source.lines) or line_index < 0: + source = Source("???") + line_index = 0 +- if line_index < 0: +- line_index += len(source) + space_prefix = " " + if short: + lines.append(space_prefix + source.lines[line_index].strip()) +-- +2.31.1 + |