[pypy-commit] pypy default: Don't use magical api object in pypy.module.cpyext.test.test_number

2017-06-29 Thread rlamy
Author: Ronan Lamy 
Branch: 
Changeset: r91659:5a8f2cdedcd0
Date: 2017-06-29 19:25 +0100
http://bitbucket.org/pypy/pypy/changeset/5a8f2cdedcd0/

Log:Don't use magical api object in pypy.module.cpyext.test.test_number

diff --git a/pypy/module/cpyext/number.py b/pypy/module/cpyext/number.py
--- a/pypy/module/cpyext/number.py
+++ b/pypy/module/cpyext/number.py
@@ -95,53 +95,58 @@
 def func_rename(newname):
 return lambda func: func_with_new_name(func, newname)
 
-def make_numbermethod(name, spacemeth):
+def make_numbermethod(cname, spacemeth):
 @cpython_api([PyObject, PyObject], PyObject)
-@func_rename('PyNumber_%s' % (name,))
+@func_rename(cname)
 def PyNumber_Method(space, w_o1, w_o2):
 meth = getattr(space, spacemeth)
 return meth(w_o1, w_o2)
+return PyNumber_Method
 
 def make_unary_numbermethod(name, spacemeth):
 @cpython_api([PyObject], PyObject)
-@func_rename('PyNumber_%s' % (name,))
+@func_rename(cname)
 def PyNumber_Method(space, w_o1):
 meth = getattr(space, spacemeth)
 return meth(w_o1)
+return PyNumber_Method
 
-def make_inplace_numbermethod(name, spacemeth):
+def make_inplace_numbermethod(cname, spacemeth):
 spacemeth = 'inplace_' + spacemeth.rstrip('_')
 @cpython_api([PyObject, PyObject], PyObject)
-@func_rename('PyNumber_InPlace%s' % (name,))
+@func_rename(cname)
 def PyNumber_Method(space, w_o1, w_o2):
 meth = getattr(space, spacemeth)
 return meth(w_o1, w_o2)
+return PyNumber_Method
 
 for name, spacemeth in [
-('Add', 'add'),
-('Subtract', 'sub'),
-('Multiply', 'mul'),
-('Divide', 'div'),
-('FloorDivide', 'floordiv'),
-('TrueDivide', 'truediv'),
-('Remainder', 'mod'),
-('Lshift', 'lshift'),
-('Rshift', 'rshift'),
-('And', 'and_'),
-('Xor', 'xor'),
-('Or', 'or_'),
-('Divmod', 'divmod'),
-]:
-make_numbermethod(name, spacemeth)
+('Add', 'add'),
+('Subtract', 'sub'),
+('Multiply', 'mul'),
+('Divide', 'div'),
+('FloorDivide', 'floordiv'),
+('TrueDivide', 'truediv'),
+('Remainder', 'mod'),
+('Lshift', 'lshift'),
+('Rshift', 'rshift'),
+('And', 'and_'),
+('Xor', 'xor'),
+('Or', 'or_'),
+('Divmod', 'divmod')]:
+cname = 'PyNumber_%s' % (name,)
+globals()[cname] = make_numbermethod(cname, spacemeth)
 if name != 'Divmod':
-make_inplace_numbermethod(name, spacemeth)
+cname = 'PyNumber_InPlace%s' % (name,)
+globals()[cname] = make_inplace_numbermethod(cname, spacemeth)
 
 for name, spacemeth in [
-('Negative', 'neg'),
-('Positive', 'pos'),
-('Absolute', 'abs'),
-('Invert', 'invert')]:
-make_unary_numbermethod(name, spacemeth)
+('Negative', 'neg'),
+('Positive', 'pos'),
+('Absolute', 'abs'),
+('Invert', 'invert')]:
+cname = 'PyNumber_%s' % (name,)
+globals()[cname] = make_unary_numbermethod(cname, spacemeth)
 
 @cpython_api([PyObject, PyObject, PyObject], PyObject)
 def PyNumber_Power(space, w_o1, w_o2, w_o3):
diff --git a/pypy/module/cpyext/test/test_number.py 
b/pypy/module/cpyext/test/test_number.py
--- a/pypy/module/cpyext/test/test_number.py
+++ b/pypy/module/cpyext/test/test_number.py
@@ -1,53 +1,64 @@
 import py
+import pytest
 from rpython.rtyper.lltypesystem import lltype
+from pypy.interpreter.error import OperationError
 from pypy.module.cpyext.test.test_api import BaseApiTest
-from pypy.module.cpyext.pyobject import PyObjectP, from_ref, make_ref, 
Py_DecRef
+from pypy.module.cpyext.pyobject import (
+PyObjectP, from_ref, make_ref, Py_DecRef)
 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
+from pypy.module.cpyext.number import (
+PyIndex_Check, PyNumber_Check, PyNumber_Long, PyNumber_Int,
+PyNumber_Index, PyNumber_Coerce, PyNumber_CoerceEx, PyNumber_Add,
+PyNumber_Multiply, PyNumber_InPlaceMultiply, PyNumber_Absolute,
+PyNumber_Power, PyNumber_InPlacePower)
+from pypy.module.cpyext.floatobject import PyFloat_Check
+from pypy.module.cpyext.intobject import PyInt_CheckExact
+from pypy.module.cpyext.longobject import PyLong_CheckExact
+from pypy.module.cpyext.object import PyObject_Size
 
 class TestIterator(BaseApiTest):
-def test_check(self, space, api):
-assert api.PyIndex_Check(space.wrap(12))
-assert api.PyIndex_Check(space.wraplong(-12L))
-assert not api.PyIndex_Check(space.wrap(12.1))
-assert not api.PyIndex_Check(space.wrap('12'))
+def test_check(self, space):
+assert PyIndex_Check(space, space.wrap(12))
+assert PyIndex_Check(space, space.wraplong(-12L))
+assert not PyIndex_Check(space, space.wrap(12.1))
+assert not PyIndex_Check(space, space.wrap('12'))
 
-assert api.PyNumber_Check(space.wrap(12))
-assert api.PyNumber_Check(space.wraplong(-12L))
-

[pypy-commit] pypy.org extradoc: update the values

2017-06-29 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r894:7f0b7f8ad4a6
Date: 2017-06-29 11:05 +0200
http://bitbucket.org/pypy/pypy.org/changeset/7f0b7f8ad4a6/

Log:update the values

diff --git a/don1.html b/don1.html
--- a/don1.html
+++ b/don1.html
@@ -9,13 +9,13 @@
 
   $(function() {
 $("#progressbar").progressbar({
-  value: 63.8
+  value: 63.9
});
   });
 
 

-   $67020 of $105000 (63.8%)
+   $67077 of $105000 (63.9%)


 
@@ -23,7 +23,7 @@
   
   This donation goes towards supporting Python 3 in 
PyPy.
   Current status:
-we have $2804 left
+we have $2856 left
   in the account. Read proposal
   
   
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit