Author: Brian Kearns <[email protected]>
Branch: stdlib-2.7.4
Changeset: r60742:6b92769a66d3
Date: 2013-01-30 08:01 -0500
http://bitbucket.org/pypy/pypy/changeset/6b92769a66d3/
Log: merge default
diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst
--- a/pypy/doc/faq.rst
+++ b/pypy/doc/faq.rst
@@ -300,12 +300,26 @@
Do I have to rewrite my programs in RPython?
--------------------------------------------
-No. And you shouldn't try. PyPy always runs your code in its own
interpreter, which is a
-full and compliant Python 2.7 interpreter. RPython is only the
-language in which parts of PyPy itself are written and extension
-modules for it. Not only is it not necessary for you to rewrite your
-code in RPython, it probably won't give you any speed improvements if you
-try.
+No. And you shouldn't try. First and foremost, RPython is a language
+that is designed to write interpreters in. It is a restricted subset of
+Python. If you program is not an interpreter but tries to do "real
+things", like use *any* part of the standard Python library or *any*
+3rd-party library, then it is not RPython to start with. You should
+only look at RPython if you try to `write your own interpreter`__.
+
+.. __: `how do I compile my own interpreters`_
+
+If your goal is to speed up Python code, then look at the regular PyPy,
+which is a full and compliant Python 2.7 interpreter (which happens to
+be written in RPython). Not only is it not necessary for you to rewrite
+your code in RPython, it might not give you any speed improvements even
+if you manage to.
+
+Yes, it is possible with enough effort to compile small self-contained
+pieces of RPython code doing a few performance-sensitive things. But
+this case is not interesting for us. If you needed to rewrite the code
+in RPython, you could as well have rewritten it in C for example. The
+latter is a much more supported, much more documented language `:-)`
---------------------------------------------------
Which backends are there for the RPython toolchain?
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1482,9 +1482,10 @@
)
raise
w_fd = self.call_function(w_fileno)
- if not self.isinstance_w(w_fd, self.w_int):
+ if (not self.isinstance_w(w_fd, self.w_int) and
+ not self.isinstance_w(w_fd, self.w_long)):
raise OperationError(self.w_TypeError,
- self.wrap("fileno() must return an integer")
+ self.wrap("fileno() returned a non-integer")
)
fd = self.c_int_w(w_fd)
if fd < 0:
diff --git a/pypy/module/fcntl/test/test_fcntl.py
b/pypy/module/fcntl/test/test_fcntl.py
--- a/pypy/module/fcntl/test/test_fcntl.py
+++ b/pypy/module/fcntl/test/test_fcntl.py
@@ -22,13 +22,23 @@
import sys
import struct
+ class F:
+ def __init__(self, fn):
+ self.fn = fn
+ def fileno(self):
+ return self.fn
+
f = open(self.tmp + "b", "w+")
fcntl.fcntl(f, 1, 0)
fcntl.fcntl(f, 1)
+ fcntl.fcntl(F(long(f.fileno())), 1)
raises(TypeError, fcntl.fcntl, "foo")
raises(TypeError, fcntl.fcntl, f, "foo")
- raises((IOError, ValueError), fcntl.fcntl, -1, 1, 0)
+ raises(TypeError, fcntl.fcntl, F("foo"), 1)
+ raises(ValueError, fcntl.fcntl, -1, 1, 0)
+ raises(ValueError, fcntl.fcntl, F(-1), 1, 0)
+ raises(ValueError, fcntl.fcntl, F(long(-1)), 1, 0)
assert fcntl.fcntl(f, 1, 0) == 0
assert fcntl.fcntl(f, 2, "foo") == "foo"
assert fcntl.fcntl(f, 2, buffer("foo")) == "foo"
diff --git a/rpython/jit/metainterp/test/test_ajit.py
b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -1694,14 +1694,13 @@
assert res == -2
def test_guard_always_changing_value(self):
- myjitdriver = JitDriver(greens = [], reds = ['x'])
- class A:
- pass
+ myjitdriver = JitDriver(greens = [], reds = ['x', 'a'])
def f(x):
+ a = 0
while x > 0:
- myjitdriver.can_enter_jit(x=x)
- myjitdriver.jit_merge_point(x=x)
- a = A()
+ myjitdriver.can_enter_jit(x=x, a=a)
+ myjitdriver.jit_merge_point(x=x, a=a)
+ a += 1
promote(a)
x -= 1
self.meta_interp(f, [50])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit