public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pytest/, dev-python/pytest/files/
Date: Wed,  2 Jun 2021 19:46:30 +0000 (UTC)	[thread overview]
Message-ID: <1622663186.e0908b325e223a6a3e19d7e0c82472763ef8e879.mgorny@gentoo> (raw)

commit:     e0908b325e223a6a3e19d7e0c82472763ef8e879
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  2 17:31:01 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  2 19:46:26 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0908b32

dev-python/pytest: Backport additional py3.10 fix

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pytest/files/pytest-6.2.4-py310.patch   | 34 ++++++++++++++++++++++
 ...{pytest-6.2.4.ebuild => pytest-6.2.4-r1.ebuild} |  4 +++
 2 files changed, 38 insertions(+)

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 00000000000..88c8f703f08
--- /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
+

diff --git a/dev-python/pytest/pytest-6.2.4.ebuild b/dev-python/pytest/pytest-6.2.4-r1.ebuild
similarity index 97%
rename from dev-python/pytest/pytest-6.2.4.ebuild
rename to dev-python/pytest/pytest-6.2.4-r1.ebuild
index 267da87475f..ced1fbce5e5 100644
--- a/dev-python/pytest/pytest-6.2.4.ebuild
+++ b/dev-python/pytest/pytest-6.2.4-r1.ebuild
@@ -43,6 +43,10 @@ BDEPEND="
 		' python3_{7..9} pypy3)
 	)"
 
+PATCHES=(
+	"${FILESDIR}"/${P}-py310.patch
+)
+
 src_test() {
 	# workaround new readline defaults
 	echo "set enable-bracketed-paste off" > "${T}"/inputrc || die


             reply	other threads:[~2021-06-02 19:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 19:46 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-18 12:50 [gentoo-commits] repo/gentoo:master commit in: dev-python/pytest/, dev-python/pytest/files/ Michał Górny
2024-06-22 15:01 Michał Górny
2024-05-19 11:47 Michał Górny
2022-05-13 12:29 Michał Górny
2021-10-03 19:24 Michał Górny
2020-05-27  6:11 Michał Górny
2019-11-27 13:17 Michał Górny
2019-07-06  8:43 Tim Harder
2018-07-11 22:11 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1622663186.e0908b325e223a6a3e19d7e0c82472763ef8e879.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox