Author: Timo Paulssen <[email protected]>
Branch: separate-applevel-numpy
Changeset: r47824:73824d8b6491
Date: 2011-10-05 02:43 +0200
http://bitbucket.org/pypy/pypy/changeset/73824d8b6491/
Log: merge in default
diff --git a/lib_pypy/numpy/__init__.py b/lib_pypy/numpy/__init__.py
--- a/lib_pypy/numpy/__init__.py
+++ b/lib_pypy/numpy/__init__.py
@@ -39,6 +39,8 @@
tan,
)
+from math import e
+
inf = float("inf")
def average(a):
diff --git a/lib_pypy/pypy_test/test_numpy.py b/lib_pypy/pypy_test/test_numpy.py
--- a/lib_pypy/pypy_test/test_numpy.py
+++ b/lib_pypy/pypy_test/test_numpy.py
@@ -74,3 +74,11 @@
raises(ValueError, "bincount(c, w)")
raises(ValueError, "bincount([])")
+ def test_constants(self):
+ import math
+ from numpy import inf, e
+ assert type(inf) is float
+ assert inf == float("inf")
+ assert e == math.e
+ assert type(e) is float
+
diff --git a/pypy/interpreter/executioncontext.py
b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -350,6 +350,7 @@
elif interval > MAX:
interval = MAX
self.checkinterval_scaled = interval * TICK_COUNTER_STEP
+ self.reset_ticker(-1)
def _rebuild_action_dispatcher(self):
periodic_actions = unrolling_iterable(self._periodic_actions)
diff --git a/pypy/interpreter/test/test_executioncontext.py
b/pypy/interpreter/test/test_executioncontext.py
--- a/pypy/interpreter/test/test_executioncontext.py
+++ b/pypy/interpreter/test/test_executioncontext.py
@@ -42,6 +42,7 @@
assert i == 9
def test_periodic_action(self):
+ from pypy.interpreter.executioncontext import ActionFlag
class DemoAction(executioncontext.PeriodicAsyncAction):
counter = 0
@@ -53,17 +54,20 @@
space = self.space
a2 = DemoAction(space)
- space.actionflag.register_periodic_action(a2, True)
try:
- for i in range(500):
- space.appexec([], """():
- n = 5
- return n + 2
- """)
- except Finished:
- pass
- checkinterval = space.actionflag.getcheckinterval()
- assert checkinterval / 10 < i < checkinterval * 1.1
+ space.actionflag.setcheckinterval(100)
+ space.actionflag.register_periodic_action(a2, True)
+ try:
+ for i in range(500):
+ space.appexec([], """():
+ n = 5
+ return n + 2
+ """)
+ except Finished:
+ pass
+ finally:
+ space.actionflag = ActionFlag() # reset to default
+ assert 10 < i < 110
def test_llprofile(self):
l = []
diff --git a/pypy/rlib/jit.py b/pypy/rlib/jit.py
--- a/pypy/rlib/jit.py
+++ b/pypy/rlib/jit.py
@@ -158,7 +158,7 @@
return decorator
@oopspec("jit.isconstant(value)")
[email protected](0)
[email protected]()
def isconstant(value):
"""
While tracing, returns whether or not the value is currently known to be
@@ -178,9 +178,7 @@
This is for advanced usage only.
"""
- if NonConstant(False):
- return True
- return False
+ return NonConstant(False)
class Entry(ExtRegistryEntry):
_about_ = hint
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit