Skip to content

Conversation

@donbarbos
Copy link
Contributor

@donbarbosdonbarbos commented Mar 12, 2025

We have one doctest in Modules/itertoolsmodule.c and none in test_itertolls.py so this is definitely a bug like issue #131069

@donbarbos
Copy link
ContributorAuthor

I found tests.addTest(doctest.DocTestSuite patterns in unittests and only these two tests loaded incorrect modules (modules without doctests)
cc @vstinner

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner
Copy link
Member

I modified the doctest with the change below, ran make clinic && make, and then ./python -m test test_itertools -v. I confirm that test_itertools catchs the typo (fails).

diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 3e425ee5f92..092316cf255 100644 --- a/Modules/itertoolsmodule.c+++ b/Modules/itertoolsmodule.c@@ -124,7 +124,7 @@ or when the input iterable is exhausted. >>> for batch in batched('ABCDEFG', 3): ... print(batch) ... - ('A', 'B', 'C')+ ('Aa', 'B', 'C') ('D', 'E', 'F') ('G',) 

@vstinnervstinner merged commit 15a8412 into python:mainMar 12, 2025
52 checks passed
@miss-islington-app
Copy link

Thanks @donbarbos for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 12, 2025
(cherry picked from commit 15a8412) Co-authored-by: donBarbos <donbarbos@proton.me>
@bedevere-app
Copy link

GH-131136 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Mar 12, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 12, 2025
(cherry picked from commit 15a8412) Co-authored-by: donBarbos <donbarbos@proton.me>
@bedevere-app
Copy link

GH-131137 is a backport of this pull request to the 3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12 only security fixes label Mar 12, 2025
vstinner pushed a commit that referenced this pull request Mar 12, 2025
gh-93096: Load doctests in `test_itertools` (GH-131133) (cherry picked from commit 15a8412) Co-authored-by: donBarbos <donbarbos@proton.me>
vstinner pushed a commit that referenced this pull request Mar 12, 2025
gh-93096: Load doctests in `test_itertools` (GH-131133) (cherry picked from commit 15a8412) Co-authored-by: donBarbos <donbarbos@proton.me>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@donbarbos@vstinner