[pypy-commit] pypy stdlib-2.7.12: audioop fixes: cpython issues 24456, 24457, weightA/B gcd from 16686

pjenvey pypy.commits at gmail.com
Sat Oct 8 19:48:42 EDT 2016


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: stdlib-2.7.12
Changeset: r87641:13b5d7b6fcfb
Date: 2016-10-08 16:47 -0700
http://bitbucket.org/pypy/pypy/changeset/13b5d7b6fcfb/

Log:	audioop fixes: cpython issues 24456, 24457, weightA/B gcd from 16686

diff --git a/lib_pypy/audioop.py b/lib_pypy/audioop.py
--- a/lib_pypy/audioop.py
+++ b/lib_pypy/audioop.py
@@ -29,8 +29,7 @@
         index = 0
     else:
         valpred, index = state
-        # XXX: len(stepsizeTable) = 89
-        if valpred >= 0x8000 or valpred < -0x8000 or index >= 89:
+        if not (-0x8000 <= valpred < 0x8000 and 0 <= index < 89):
             raise ValueError("bad state")
     return (valpred, index)
 
@@ -466,6 +465,9 @@
     d = gcd(inrate, outrate)
     inrate //= d
     outrate //= d
+    d = gcd(weightA, weightB)
+    weightA //= d
+    weightB //= d
 
     if state is None:
         d = -outrate


More information about the pypy-commit mailing list