Skip to content
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

bpo-20499: Rounding error in statistics.pvariance #28230

Merged
merged 12 commits into from Sep 9, 2021

Conversation

@rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Sep 8, 2021

Make the _ss() function exact.

Also improve the speed:

$ python -m timeit -r 11 -s 'from statistics import variance' -s 'from random import random, seed' -s 'seed(8564399)' -s 'data = [random() for i in range(1_000)]' 'variance(data)'

100 loops, best of 11: 2.16 msec per loop   # Baseline
200 loops, best of 11: 1.71 msec per loop   # Patched

https://bugs.python.org/issue20499

@rhettinger rhettinger changed the title Stats exact ss bpo-20499: Rounding error in statistics.pvariance Sep 8, 2021
@rhettinger rhettinger merged commit 4a5cccb into python:main Sep 9, 2021
12 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 9, 2021

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒🤖

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 9, 2021

Sorry @rhettinger, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 4a5cccb02bb2254634c0fbb2cbb14e2e7f45e2d5 3.10

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 9, 2021

Sorry, @rhettinger, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 4a5cccb02bb2254634c0fbb2cbb14e2e7f45e2d5 3.9

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 9, 2021

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒🤖

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 9, 2021

Sorry @rhettinger, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 4a5cccb02bb2254634c0fbb2cbb14e2e7f45e2d5 3.10

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 9, 2021

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒🤖

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 9, 2021

Sorry, @rhettinger, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 4a5cccb02bb2254634c0fbb2cbb14e2e7f45e2d5 3.10

rhettinger added a commit to rhettinger/cpython that referenced this issue Sep 9, 2021
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Sep 9, 2021

GH-28248 is a backport of this pull request to the 3.10 branch.

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Sep 9, 2021

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 RHEL8 3.10 has failed when building commit 3c30805.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/612/builds/302) and take a look at the build logs.
  4. Check if the failure is related to this commit (3c30805) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/612/builds/302

Failed tests:

  • test_readline

Failed subtests:

  • test_nonascii - test.test_readline.TestReadline

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

413 tests OK.

10 slowest tests:

  • test_concurrent_futures: 2 min 54 sec
  • test_multiprocessing_spawn: 2 min 13 sec
  • test_peg_generator: 1 min 38 sec
  • test_asyncio: 1 min 27 sec
  • test_multiprocessing_forkserver: 1 min 26 sec
  • test_unparse: 1 min 15 sec
  • test_multiprocessing_fork: 1 min 13 sec
  • test_capi: 1 min 6 sec
  • test_gdb: 55.9 sec
  • test_tokenize: 53.3 sec

1 test failed:
test_readline

13 tests skipped:
test_devpoll test_ioctl test_kqueue test_msilib test_ossaudiodev
test_startfile test_tix test_tk test_ttk_guionly test_winconsoleio
test_winreg test_winsound test_zipfile64

1 re-run test:
test_readline

Total duration: 3 min 4 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.10.cstratak-RHEL8-aarch64/build/Lib/test/test_readline.py", line 258, in test_nonascii
    self.assertIn(b"history " + expected + b"\r\n", output)
AssertionError: b"history '[\\xefnserted]|t\\xebxt[after]'\r\n" not found in bytearray(b"^A^B^B^B^B^B^B^B\t\tx\t\r\n[\xc3\xafnserted]|t\xc3\xab[after]\x08\x08\x08\x08\x08\x08\x08text \'t\\xeb\'\r\nline \'[\\xefnserted]|t\\xeb[after]\'\r\nindexes 11 13\r\n\x07text \'t\\xeb\'\r\nline \'[\\xefnserted]|t\\xeb[after]\'\r\nindexes 11 13\r\nsubstitution \'t\\xeb\'\r\nmatches [\'t\\xebnt\', \'t\\xebxt\']\r\nx[after]\x08\x08\x08\x08\x08\x08\x08t[after]\x08\x08\x08\x08\x08\x08\x08\r\nresult \'[\\xefnserted]|t\\xebxt[after]\'\r\nhistory \'[\\xefnserted]|t\\xebxt[after]\'")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants