[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

/ cpython Public

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.7] bpo-31478: Prevent unwanted behavior in _random.Random.seed() in case the arg has a bad __abs__() method (GH-3596) #3845

Merged
merged 5 commits into from Oct 2, 2017

Conversation

Copy link
Contributor

orenmn commented Oct 1, 2017

  • In case the argument of _random.Random.seed() is a long/int subclass, ignore its __abs__() method.
  • Add a test to test_random to verify that such __abs__() methods are indeed ignored.

https://bugs.python.org/issue31478

Copy link
Member

serhiy-storchaka left a comment

Add a NEWS entry.

expected_value = self.gen.random()
for seed_arg in [42L, BadInt(42), BadLong(42)]:
self.gen.seed(seed_arg)
self.assertEqual(expected_value, self.gen.random())
Copy link
Member

serhiy-storchaka Oct 1, 2017

Choose a reason for hiding this comment

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

Use the actual value at left and the expected value at right.

serhiy-storchaka merged commit 13da1a6 into python:2.7 Oct 2, 2017
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants