Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-128051: fix tests if sys.float_repr_style is 'legacy'#135908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 7 commits intopython:mainfromskirpichev:fix-legacy-repr-tests
Jun 27, 2025

Conversation

skirpichev
Copy link
Contributor

@skirpichevskirpichev commentedJun 25, 2025
edited by bedevere-appbot
Loading

@skirpichev
Copy link
ContributorAuthor

CC@vstinner

Second commit contains more controversial changes, i.e. where short and legacy repr - agree (but this tested on IEEE box!)

@@ -240,7 +240,6 @@ def test_parameter_repr(self):
self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$")
self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>")
Copy link
Member

Choose a reason for hiding this comment

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

Please don't remove tests. Maybe skip it ifif getattr(sys, 'float_repr_style', '') == 'short':.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Any idea why this was added, given we have otherc_double test?

Copy link
Member

Choose a reason for hiding this comment

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

The test was added by commit916610e.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, I know. As well, as other tests in this function, but why? This value fits in double? We have only one test for float/longdouble.

@vstinnervstinner added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsJun 25, 2025
@vstinner
Copy link
Member

We usually backport tests changes to stable branches to reduce the risk of merge conflicts for following tests changes.

@@ -224,6 +225,8 @@ def __dict__(self):
with self.assertRaises(ZeroDivisionError):
WorseStruct().__setstate__({}, b'foo')

@unittest.skipUnless(sys.float_repr_style == 'short',
"applies only when using short float repr style")
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to only skip 1e300 test, rather than skipping the whole test method.

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

@vstinnervstinner merged commitf3aec60 intopython:mainJun 27, 2025
43 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJun 27, 2025
…nGH-135908)(cherry picked from commitf3aec60)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>Co-authored-by: Victor Stinner <vstinner@python.org>
@miss-islington-app
Copy link

Sorry,@skirpichev and@vstinner, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker f3aec60d7a01c5f085a3ef2d6670d46b42b8ddd3 3.13

@bedevere-app
Copy link

GH-136025 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelJun 27, 2025
@bedevere-app
Copy link

GH-136026 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelJun 27, 2025
vstinner added a commit to vstinner/cpython that referenced this pull requestJun 27, 2025
…n#135908)Co-authored-by: Victor Stinner <vstinner@python.org>(cherry picked from commitf3aec60)
vstinner added a commit that referenced this pull requestJun 27, 2025
…35908) (#136025)gh-128051: Fix tests if sys.float_repr_style is 'legacy' (GH-135908)(cherry picked from commitf3aec60)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>Co-authored-by: Victor Stinner <vstinner@python.org>
@skirpichevskirpichev deleted the fix-legacy-repr-tests branchJune 27, 2025 11:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner approved these changes

@jaracojaracoAwaiting requested review from jaracojaraco is a code owner

@ethanfurmanethanfurmanAwaiting requested review from ethanfurmanethanfurman is a code owner

Assignees

@vstinnervstinner

Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@skirpichev@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp