[mpmath] r1229 committed - ensure that classes are new-style (critical for PyPy performance)

3 views
Skip to first unread message

mpm...@googlecode.com

unread,
Feb 3, 2011, 8:09:05 AM2/3/11
to mpmath-...@googlegroups.com
Revision: 1229
Author: fredrik.johansson
Date: Thu Feb 3 05:08:12 2011
Log: ensure that classes are new-style (critical for PyPy performance)
http://code.google.com/p/mpmath/source/detail?r=1229

Modified:
/trunk/mpmath/__init__.py
/trunk/mpmath/calculus/quadrature.py
/trunk/mpmath/ctx_mp_python.py
/trunk/mpmath/functions/rszeta.py
/trunk/mpmath/matrices/calculus.py
/trunk/mpmath/tests/test_mpmath.py

=======================================
--- /trunk/mpmath/__init__.py Tue Feb 1 12:03:50 2011
+++ /trunk/mpmath/__init__.py Thu Feb 3 05:08:12 2011
@@ -1,4 +1,4 @@
-__version__ = '0.17'
+__version__ = '0.18-svn'

from .usertools import monitor, timing

=======================================
--- /trunk/mpmath/calculus/quadrature.py Fri Jan 28 12:37:56 2011
+++ /trunk/mpmath/calculus/quadrature.py Thu Feb 3 05:08:12 2011
@@ -453,7 +453,7 @@
ctx.prec = orig
return nodes

-class QuadratureMethods:
+class QuadratureMethods(object):

def __init__(ctx, *args, **kwargs):
ctx._gauss_legendre = GaussLegendre(ctx)
=======================================
--- /trunk/mpmath/ctx_mp_python.py Fri Jan 28 12:37:56 2011
+++ /trunk/mpmath/ctx_mp_python.py Thu Feb 3 05:08:12 2011
@@ -578,7 +578,7 @@
complex_types = (complex, _mpc)


-class PythonMPContext:
+class PythonMPContext(object):

def __init__(ctx):
ctx._prec_rounding = [53, round_nearest]
=======================================
--- /trunk/mpmath/functions/rszeta.py Sat Jan 8 14:15:29 2011
+++ /trunk/mpmath/functions/rszeta.py Thu Feb 3 05:08:12 2011
@@ -50,7 +50,7 @@

import math

-class RSCache:
+class RSCache(object):
def __init__(ctx):
ctx._rs_cache = [0, 10, {}, {}]

=======================================
--- /trunk/mpmath/matrices/calculus.py Sat Jan 8 14:54:03 2011
+++ /trunk/mpmath/matrices/calculus.py Thu Feb 3 05:08:12 2011
@@ -2,7 +2,7 @@

# TODO: should use diagonalization-based algorithms

-class MatrixCalculusMethods:
+class MatrixCalculusMethods(object):

def _exp_pade(ctx, a):
"""
=======================================
--- /trunk/mpmath/tests/test_mpmath.py Wed Jul 28 13:09:06 2010
+++ /trunk/mpmath/tests/test_mpmath.py Thu Feb 3 05:08:12 2011
@@ -1,3 +1,7 @@
from mpmath.libmp import *
from mpmath import *
-import random
+
+def test_newstyle_classes():
+ for cls in [mp, fp, iv, mpf, mpc]:
+ for s in cls.__class__.__mro__:
+ assert isinstance(s, type)

Reply all
Reply to author
Forward
0 new messages