Author: Maciej Fijalkowski <[email protected]>
Branch: jitframe-on-heap
Changeset: r61595:28dc8f51844f
Date: 2013-02-22 12:47 +0200
http://bitbucket.org/pypy/pypy/changeset/28dc8f51844f/

Log:    merge default

diff --git a/pypy/doc/_ref.txt b/pypy/doc/_ref.txt
--- a/pypy/doc/_ref.txt
+++ b/pypy/doc/_ref.txt
@@ -1,24 +1,19 @@
 .. _`ctypes_configure/doc/sample.py`: 
https://bitbucket.org/pypy/pypy/src/default/ctypes_configure/doc/sample.py
-.. _`demo/`: https://bitbucket.org/pypy/pypy/src/default/demo/
+.. _`dotviewer/`: https://bitbucket.org/pypy/pypy/src/default/dotviewer/
 .. _`lib-python/`: https://bitbucket.org/pypy/pypy/src/default/lib-python/
 .. _`lib-python/2.7/dis.py`: 
https://bitbucket.org/pypy/pypy/src/default/lib-python/2.7/dis.py
 .. _`lib_pypy/`: https://bitbucket.org/pypy/pypy/src/default/lib_pypy/
 .. _`lib_pypy/greenlet.py`: 
https://bitbucket.org/pypy/pypy/src/default/lib_pypy/greenlet.py
 .. _`lib_pypy/pypy_test/`: 
https://bitbucket.org/pypy/pypy/src/default/lib_pypy/pypy_test/
 .. _`lib_pypy/tputil.py`: 
https://bitbucket.org/pypy/pypy/src/default/lib_pypy/tputil.py
-.. _`pypy/annotation`:
-.. _`pypy/annotation/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/annotation/
-.. _`pypy/annotation/annrpython.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/annotation/annrpython.py
-.. _`pypy/annotation/binaryop.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/annotation/binaryop.py
-.. _`pypy/annotation/builtin.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/annotation/builtin.py
 .. _`pypy/bin/`: https://bitbucket.org/pypy/pypy/src/default/pypy/bin/
-.. _`pypy/bin/translatorshell.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/bin/translatorshell.py
+.. _`pypy/bin/pyinteractive.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/bin/pyinteractive.py
 .. _`pypy/config/`: https://bitbucket.org/pypy/pypy/src/default/pypy/config/
 .. _`pypy/config/pypyoption.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/config/pypyoption.py
-.. _`pypy/config/translationoption.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/config/translationoption.py
 .. _`pypy/doc/`: https://bitbucket.org/pypy/pypy/src/default/pypy/doc/
 .. _`pypy/doc/config/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/doc/config/
 .. _`pypy/doc/discussion/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/doc/discussion/
+.. _`pypy/goal/`: https://bitbucket.org/pypy/pypy/src/default/pypy/goal/
 .. _`pypy/interpreter`:
 .. _`pypy/interpreter/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/interpreter/
 .. _`pypy/interpreter/argument.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/interpreter/argument.py
@@ -54,11 +49,8 @@
 .. _`pypy/module`:
 .. _`pypy/module/`: https://bitbucket.org/pypy/pypy/src/default/pypy/module/
 .. _`pypy/module/__builtin__/__init__.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/module/__builtin__/__init__.py
-.. _`pypy/objspace`:
 .. _`pypy/objspace/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/
-.. _`pypy/objspace/flow`:
 .. _`pypy/objspace/flow/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/flow/
-.. _`pypy/objspace/flow/model.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/flow/model.py
 .. _`pypy/objspace/std`:
 .. _`pypy/objspace/std/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/std/
 .. _`pypy/objspace/std/listtype.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/std/listtype.py
@@ -70,49 +62,55 @@
 .. _`pypy/objspace/std/transparent.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/std/transparent.py
 .. _`pypy/objspace/std/tupleobject.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/std/tupleobject.py
 .. _`pypy/objspace/std/tupletype.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/objspace/std/tupletype.py
-.. _`pypy/rlib`:
-.. _`pypy/rlib/`: https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/
-.. _`pypy/rlib/listsort.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/listsort.py
-.. _`pypy/rlib/nonconst.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/nonconst.py
-.. _`pypy/rlib/objectmodel.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/objectmodel.py
-.. _`pypy/rlib/parsing/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/parsing/
-.. _`pypy/rlib/parsing/tree.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/parsing/tree.py
-.. _`pypy/rlib/rarithmetic.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/rarithmetic.py
-.. _`pypy/rlib/rbigint.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/rbigint.py
-.. _`pypy/rlib/rrandom.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/rrandom.py
-.. _`pypy/rlib/rsocket.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/rsocket.py
-.. _`pypy/rlib/streamio.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/streamio.py
-.. _`pypy/rlib/test`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/test/
-.. _`pypy/rlib/unroll.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/unroll.py
-.. _`pypy/rpython`:
-.. _`pypy/rpython/`: https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/
-.. _`pypy/rpython/lltypesystem/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/lltypesystem/
-.. _`pypy/rpython/lltypesystem/lltype.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/lltypesystem/lltype.py
-.. _`pypy/rpython/memory/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/memory/
-.. _`pypy/rpython/memory/gc/generation.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/memory/gc/generation.py
-.. _`pypy/rpython/memory/gc/hybrid.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/memory/gc/hybrid.py
-.. _`pypy/rpython/memory/gc/markcompact.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/memory/gc/markcompact.py
-.. _`pypy/rpython/memory/gc/marksweep.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/memory/gc/marksweep.py
-.. _`pypy/rpython/memory/gc/minimarkpage.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/memory/gc/minimarkpage.py
-.. _`pypy/rpython/memory/gc/semispace.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/memory/gc/semispace.py
-.. _`pypy/rpython/ootypesystem/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/ootypesystem/
-.. _`pypy/rpython/ootypesystem/ootype.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/ootypesystem/ootype.py
-.. _`pypy/rpython/rint.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/rint.py
-.. _`pypy/rpython/rlist.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/rlist.py
-.. _`pypy/rpython/rmodel.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/rmodel.py
-.. _`pypy/rpython/rtyper.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/rtyper.py
-.. _`pypy/rpython/test/test_llinterp.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/rpython/test/test_llinterp.py
 .. _`pypy/tool/`: https://bitbucket.org/pypy/pypy/src/default/pypy/tool/
 .. _`pypy/tool/algo/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/tool/algo/
 .. _`pypy/tool/pytest/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/tool/pytest/
-.. _`pypy/tool/traceconfig.py`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/tool/traceconfig.py
-.. _`pypy/translator`:
-.. _`pypy/translator/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/
-.. _`pypy/translator/backendopt/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/backendopt/
-.. _`pypy/translator/c/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/c/
-.. _`pypy/translator/c/src/stacklet/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/c/src/stacklet/
-.. _`pypy/translator/c/src/stacklet/stacklet.h`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/c/src/stacklet/stacklet.h
-.. _`pypy/translator/cli/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/cli/
-.. _`pypy/translator/goal/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/goal/
-.. _`pypy/translator/jvm/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/jvm/
-.. _`pypy/translator/tool/`: 
https://bitbucket.org/pypy/pypy/src/default/pypy/translator/tool/
+.. _`rpython/annotator`:
+.. _`rpython/annotator/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/annotator/
+.. _`rpython/annotator/annrpython.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/annotator/annrpython.py
+.. _`rpython/annotator/binaryop.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/annotator/binaryop.py
+.. _`rpython/annotator/builtin.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/annotator/builtin.py
+.. _`rpython/bin/translatorshell.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/bin/translatorshell.py
+.. _`rpython/config/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/config/
+.. _`rpython/config/translationoption.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/config/translationoption.py
+.. _`rpython/flowspace/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/flowspace/
+.. _`rpython/flowspace/model.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/flowspace/model.py
+.. _`rpython/rlib`:
+.. _`rpython/rlib/`: https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/
+.. _`rpython/rlib/listsort.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/listsort.py
+.. _`rpython/rlib/nonconst.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/nonconst.py
+.. _`rpython/rlib/objectmodel.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/objectmodel.py
+.. _`rpython/rlib/parsing/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/parsing/
+.. _`rpython/rlib/parsing/tree.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/parsing/tree.py
+.. _`rpython/rlib/rarithmetic.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/rarithmetic.py
+.. _`rpython/rlib/rbigint.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/rbigint.py
+.. _`rpython/rlib/rrandom.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/rrandom.py
+.. _`rpython/rlib/rsocket.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/rsocket.py
+.. _`rpython/rlib/streamio.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/streamio.py
+.. _`rpython/rlib/test`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/test/
+.. _`rpython/rlib/unroll.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rlib/unroll.py
+.. _`rpython/rtyper`:
+.. _`rpython/rtyper/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/
+.. _`rpython/rtyper/lltypesystem/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/lltypesystem/
+.. _`rpython/rtyper/lltypesystem/lltype.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/lltypesystem/lltype.py
+.. _`rpython/rtyper/memory/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/memory/
+.. _`rpython/rtyper/memory/gc/generation.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/memory/gc/generation.py
+.. _`rpython/rtyper/memory/gc/hybrid.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/memory/gc/hybrid.py
+.. _`rpython/rtyper/memory/gc/minimarkpage.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/memory/gc/minimarkpage.py
+.. _`rpython/rtyper/memory/gc/semispace.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/memory/gc/semispace.py
+.. _`rpython/rtyper/ootypesystem/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/ootypesystem/
+.. _`rpython/rtyper/ootypesystem/ootype.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/ootypesystem/ootype.py
+.. _`rpython/rtyper/rint.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/rint.py
+.. _`rpython/rtyper/rlist.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/rlist.py
+.. _`rpython/rtyper/rmodel.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/rmodel.py
+.. _`rpython/rtyper/rtyper.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/rtyper.py
+.. _`rpython/rtyper/test/test_llinterp.py`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/rtyper/test/test_llinterp.py
+.. _`rpython/translator`:
+.. _`rpython/translator/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/
+.. _`rpython/translator/backendopt/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/backendopt/
+.. _`rpython/translator/c/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/c/
+.. _`rpython/translator/c/src/stacklet/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/c/src/stacklet/
+.. _`rpython/translator/c/src/stacklet/stacklet.h`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/c/src/stacklet/stacklet.h
+.. _`rpython/translator/cli/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/cli/
+.. _`rpython/translator/jvm/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/jvm/
+.. _`rpython/translator/tool/`: 
https://bitbucket.org/pypy/pypy/src/default/rpython/translator/tool/
diff --git a/pypy/doc/coding-guide.rst b/pypy/doc/coding-guide.rst
--- a/pypy/doc/coding-guide.rst
+++ b/pypy/doc/coding-guide.rst
@@ -328,7 +328,7 @@
 **builtin functions**
 
   A number of builtin functions can be used.  The precise set can be
-  found in `pypy/annotation/builtin.py`_ (see ``def builtin_xxx()``).
+  found in `rpython/annotator/builtin.py`_ (see ``def builtin_xxx()``).
   Some builtin functions may be limited in what they support, though.
 
   ``int, float, str, ord, chr``... are available as simple conversion
diff --git a/pypy/doc/configuration.rst b/pypy/doc/configuration.rst
--- a/pypy/doc/configuration.rst
+++ b/pypy/doc/configuration.rst
@@ -188,7 +188,7 @@
 toolchain`_ 
 toolchain, have two separate sets of options. The translation toolchain options
 can be found on the ``config`` attribute of all ``TranslationContext``
-instances and are described in `pypy/config/translationoption.py`_. The 
interpreter options
+instances and are described in `rpython/config/translationoption.py`_. The 
interpreter options
 are attached to the object space, also under the name ``config`` and are
 described in `pypy/config/pypyoption.py`_.
 
diff --git a/pypy/doc/ctypes-implementation.rst 
b/pypy/doc/ctypes-implementation.rst
--- a/pypy/doc/ctypes-implementation.rst
+++ b/pypy/doc/ctypes-implementation.rst
@@ -38,7 +38,7 @@
 in dynamic libraries through libffi. Freeing objects in most cases and making
 sure that objects referring to each other are kept alive is responsibility of 
the higher levels.
 
-This module uses bindings to libffi which are defined in 
``pypy/rlib/libffi.py``.
+This module uses bindings to libffi which are defined in 
``rpython/rlib/libffi.py``.
 
 We tried to keep this module as small as possible. It is conceivable
 that other implementations (e.g. Jython) could use our ctypes
diff --git a/pypy/doc/discussion/improve-rpython.rst 
b/pypy/doc/discussion/improve-rpython.rst
--- a/pypy/doc/discussion/improve-rpython.rst
+++ b/pypy/doc/discussion/improve-rpython.rst
@@ -39,7 +39,7 @@
 
 - Allocate variables on the stack, and pass their address ("by reference") to
   llexternal functions. For a typical usage, see
-  `pypy.rlib.rsocket.RSocket.getsockopt_int`.
+  `rpython.rlib.rsocket.RSocket.getsockopt_int`.
 
 Extensible type system for llexternal
 -------------------------------------
diff --git a/pypy/doc/garbage_collection.rst b/pypy/doc/garbage_collection.rst
--- a/pypy/doc/garbage_collection.rst
+++ b/pypy/doc/garbage_collection.rst
@@ -42,7 +42,7 @@
 Two arenas of equal size, with only one arena in use and getting filled
 with new objects.  When the arena is full, the live objects are copied
 into the other arena using Cheney's algorithm.  The old arena is then
-cleared.  See `pypy/rpython/memory/gc/semispace.py`_.
+cleared.  See `rpython/rtyper/memory/gc/semispace.py`_.
 
 On Unix the clearing is done by reading ``/dev/zero`` into the arena,
 which is extremely memory efficient at least on Linux: it lets the
@@ -55,7 +55,7 @@
 Generational GC
 ---------------
 
-This is a two-generations GC.  See `pypy/rpython/memory/gc/generation.py`_.
+This is a two-generations GC.  See `rpython/rtyper/memory/gc/generation.py`_.
 
 It is implemented as a subclass of the Semispace copying collector.  It
 adds a nursery, which is a chunk of the current semispace.  Its size is
@@ -86,7 +86,7 @@
 Each generation is collected much less often than the previous one.  The
 division of the generations is slightly more complicated than just
 nursery / semispace / external; see the diagram at the start of the
-source code, in `pypy/rpython/memory/gc/hybrid.py`_.
+source code, in `rpython/rtyper/memory/gc/hybrid.py`_.
 
 Mark & Compact GC
 -----------------
@@ -161,7 +161,7 @@
   to the old stage. The dying case 2 objects are immediately freed.
 
 - The old stage is an area of memory containing old (small) objects.  It
-  is handled by `pypy/rpython/memory/gc/minimarkpage.py`_.  It is organized
+  is handled by `rpython/rtyper/memory/gc/minimarkpage.py`_.  It is organized
   as "arenas" of 256KB or 512KB, subdivided into "pages" of 4KB or 8KB.
   Each page can either be free, or contain small objects of all the same
   size.  Furthermore at any point in time each object location can be
diff --git a/pypy/doc/getting-started-dev.rst b/pypy/doc/getting-started-dev.rst
--- a/pypy/doc/getting-started-dev.rst
+++ b/pypy/doc/getting-started-dev.rst
@@ -172,23 +172,23 @@
    ``xxxobject.py`` contain respectively the definition of the type and its
    (default) implementation.
 
-*  `pypy/translator`_ contains the code analysis and generation stuff.
+*  `rpython/translator`_ contains the code analysis and generation stuff.
    Start reading from translator.py, from which it should be easy to follow
    the pieces of code involved in the various translation phases.
 
-*  `pypy/annotation`_ contains the data model for the type annotation that
+*  `rpython/annotator`_ contains the data model for the type annotation that
    can be inferred about a graph.  The graph "walker" that uses this is in
-   `pypy/annotation/annrpython.py`_.
+   `rpython/annotator/annrpython.py`_.
 
-*  `pypy/rpython`_ contains the code of the RPython typer. The typer transforms
+*  `rpython/rtyper`_ contains the code of the RPython typer. The typer 
transforms
    annotated flow graphs in a way that makes them very similar to C code so
    that they can be easy translated. The graph transformations are controlled
-   by the code in `pypy/rpython/rtyper.py`_. The object model that is used can
-   be found in `pypy/rpython/lltypesystem/lltype.py`_. For each RPython type
+   by the code in `rpython/rtyper/rtyper.py`_. The object model that is used 
can
+   be found in `rpython/rtyper/lltypesystem/lltype.py`_. For each RPython type
    there is a file rxxxx.py that contains the low level functions needed for
    this type.
 
-*  `pypy/rlib`_ contains the `RPython standard library`_, things that you can
+*  `rpython/rlib`_ contains the `RPython standard library`_, things that you 
can
    use from rpython.
 
 .. _`RPython standard library`: rlib.html
@@ -319,10 +319,10 @@
 Demos
 -------
 
-The `demo/`_ directory contains examples of various aspects of PyPy,
-ranging from running regular Python programs (that we used as compliance 
goals) 
-over experimental distribution mechanisms to examples translating 
-sufficiently static programs into low level code. 
+The `example-interpreter`_ repository contains an example interpreter
+written using the RPython translation toolchain.
+
+.. _`example-interpreter`: https://bitbucket.org/pypy/example-interpreter
 
 Additional Tools for running (and hacking) PyPy 
 -----------------------------------------------
diff --git a/pypy/doc/index.rst b/pypy/doc/index.rst
--- a/pypy/doc/index.rst
+++ b/pypy/doc/index.rst
@@ -217,17 +217,20 @@
 Here is a fully referenced alphabetical two-level deep 
 directory overview of PyPy: 
 
-================================   =========================================== 
+=================================  ============================================
 Directory                          explanation/links
-================================   =========================================== 
+=================================  ============================================
+`pypy/bin/`_                       command-line scripts, mainly
+                                   `pypy/bin/pyinteractive.py`_
 
-`pypy/bin/`_                       command-line scripts, mainly 
`pyinteractive.py`_
+`pypy/config/`_                    handles the numerous options for building
+                                   and running PyPy
 
-`pypy/config/`_                    handles the numerous options for building 
and running PyPy
+`pypy/doc/`_                       text versions of PyPy developer
+                                   documentation
 
-`pypy/doc/`_                       text versions of PyPy developer 
documentation
-
-`pypy/doc/config/`_                documentation for the numerous translation 
options
+`pypy/doc/config/`_                documentation for the numerous translation
+                                   options
 
 `pypy/doc/discussion/`_            drafts of ideas and documentation
 
@@ -238,19 +241,24 @@
 
 `pypy/interpreter/pyparser/`_      interpreter-level Python source parser
 
-`pypy/interpreter/astcompiler/`_   interpreter-level bytecode compiler, via an 
AST
-                                   representation
+`pypy/interpreter/astcompiler/`_   interpreter-level bytecode compiler,
+                                   via an AST representation
 
-`pypy/module/`_                    contains `mixed modules`_ implementing core 
modules with 
+`pypy/module/`_                    contains `mixed modules`_
+                                   implementing core modules with 
                                    both application and interpreter level code.
-                                   Not all are finished and working.  Use the 
``--withmod-xxx``
-                                   or ``--allworkingmodules`` translation 
options.
+                                   Not all are finished and working.  Use
+                                   the ``--withmod-xxx``
+                                   or ``--allworkingmodules`` translation
+                                   options.
 
 `pypy/objspace/`_                  `object space`_ implementations
 
-`pypy/objspace/std/`_              the StdObjSpace_ implementing CPython's 
objects and types
+`pypy/objspace/std/`_              the StdObjSpace_ implementing CPython's
+                                   objects and types
 
-`pypy/tool/`_                      various utilities and hacks used from 
various places 
+`pypy/tool/`_                      various utilities and hacks used
+                                   from various places 
 
 `pypy/tool/algo/`_                 general-purpose algorithmic and mathematic
                                    tools
@@ -258,49 +266,58 @@
 `pypy/tool/pytest/`_               support code for our `testing methods`_
 
 
-`rpython/annotator/`_              `type inferencing code`_ for `RPython`_ 
programs 
+`rpython/annotator/`_              `type inferencing code`_ for
+                                   `RPython`_ programs 
 
 `rpython/config/`_                 handles the numerous options for RPython
 
 
-`rpython/flowspace/`_              the FlowObjSpace_ implementing `abstract 
interpretation`_
+`rpython/flowspace/`_              the FlowObjSpace_ implementing
+                                   `abstract interpretation`_
 
-
-`rpython/rlib/`_                   a `"standard library"`_ for RPython_ 
programs
+`rpython/rlib/`_                   a `"standard library"`_ for RPython_
+                                   programs
 
 `rpython/rtyper/`_                 the `RPython Typer`_ 
 
-`rpython/rtyper/lltypesystem/`_    the `low-level type system`_ for C-like 
backends
+`rpython/rtyper/lltypesystem/`_    the `low-level type system`_ for
+                                   C-like backends
 
-`rpython/rtyper/ootypesystem/`_    the `object-oriented type system`_ for OO 
backends
+`rpython/rtyper/ootypesystem/`_    the `object-oriented type system`_
+                                   for OO backends
 
-`rpython/rtyper/memory/`_          the `garbage collector`_ construction 
framework
+`rpython/rtyper/memory/`_          the `garbage collector`_ construction
+                                   framework
 
 `rpython/translator/`_             translation_ backends and support code
 
-`rpython/translator/backendopt/`_  general optimizations that run before a 
backend generates code
+`rpython/translator/backendopt/`_  general optimizations that run before a 
+                                   backend generates code
 
-`rpython/translator/c/`_           the `GenC backend`_, producing C code from 
an
+`rpython/translator/c/`_           the `GenC backend`_, producing C code
+                                   from an
                                    RPython program (generally via the rtyper_)
 
-`rpython/translator/cli/`_         the `CLI backend`_ for `.NET`_ (Microsoft 
CLR or Mono_)
+`rpython/translator/cli/`_         the `CLI backend`_ for `.NET`_
+                                   (Microsoft CLR or Mono_)
 
-`pypy/goal/`_                      our `main PyPy-translation scripts`_ live 
here
+`pypy/goal/`_                      our `main PyPy-translation scripts`_
+                                   live here
 
 `rpython/translator/jvm/`_         the Java backend
 
-`rpython/translator/tool/`_        helper tools for translation, including the 
Pygame
-                                   `graph viewer`_
+`rpython/translator/tool/`_        helper tools for translation
 
-``*/test/``                        many directories have a test subdirectory 
containing test 
+`dotviewer/`_                      `graph viewer`_
+
+``*/test/``                        many directories have a test subdirectory
+                                   containing test 
                                    modules (see `Testing in PyPy`_) 
 
-``_cache/``                        holds cache files from internally 
`translating application 
-                                   level to interpreterlevel`_ code.   
-================================   =========================================== 
+``_cache/``                        holds cache files from various purposes
+=================================  ============================================
 
 .. _`bytecode interpreter`: interpreter.html
-.. _`translating application level to interpreterlevel`: geninterp.html
 .. _`Testing in PyPy`: coding-guide.html#testing-in-pypy 
 .. _`mixed modules`: coding-guide.html#mixed-modules 
 .. _`modules`: coding-guide.html#modules 
diff --git a/pypy/doc/rtyper.rst b/pypy/doc/rtyper.rst
--- a/pypy/doc/rtyper.rst
+++ b/pypy/doc/rtyper.rst
@@ -4,7 +4,7 @@
 .. contents::
 
 
-The RPython Typer lives in the directory `pypy/rpython/`_.
+The RPython Typer lives in the directory `rpython/rtyper/`_.
 
 
 Overview
@@ -52,7 +52,7 @@
 where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``.
 This is done by attaching an attribute ``concretetype`` to v1, v2 and v3
 (which might be instances of Variable or possibly Constant).  In our model,
-this ``concretetype`` is ``pypy.rpython.lltypesystem.lltype.Signed``.  Of
+this ``concretetype`` is ``rpython.rtyper.lltypesystem.lltype.Signed``.  Of
 course, the purpose of replacing the operation called ``add`` with
 ``int_add`` is that code generators no longer have to worry about what kind
 of addition (or concatenation maybe?) it means.
@@ -66,7 +66,7 @@
 each operation.  In both cases the analysis of an operation depends on the
 annotations of its input arguments.  This is reflected in the usage of the same
 ``__extend__`` syntax in the source files (compare e.g.
-`pypy/annotation/binaryop.py`_ and `pypy/rpython/rint.py`_).
+`rpython/annotator/binaryop.py`_ and `rpython/rtyper/rint.py`_).
 
 The analogy stops here, though: while it runs, the Annotator is in the middle
 of computing the annotations, so it might need to reflow and generalize until
@@ -104,7 +104,7 @@
 implementations for the same high-level operations.  This is the reason for
 turning representations into explicit objects.
 
-The base Repr class is defined in `pypy/rpython/rmodel.py`_.  Most of the
+The base Repr class is defined in `rpython/rtyper/rmodel.py`_.  Most of the
 ``rpython/r*.py`` files define one or a few subclasses of Repr.  The method
 getrepr() of the RTyper will build and cache a single Repr instance per
 SomeXxx() instance; moreover, two SomeXxx() instances that are equal get the
@@ -131,9 +131,9 @@
 The RPython Typer uses a standard low-level model which we believe can
 correspond rather directly to various target languages such as C.
 This model is implemented in the first part of
-`pypy/rpython/lltypesystem/lltype.py`_.
+`rpython/rtyper/lltypesystem/lltype.py`_.
 
-The second part of `pypy/rpython/lltypesystem/lltype.py`_ is a runnable
+The second part of `rpython/rtyper/lltypesystem/lltype.py`_ is a runnable
 implementation of these types, for testing purposes.  It allows us to write
 and test plain Python code using a malloc() function to obtain and manipulate
 structures and arrays.  This is useful for example to implement and test
@@ -147,7 +147,7 @@
 
 Here is a quick tour:
 
-    >>> from pypy.rpython.lltypesystem.lltype import *
+    >>> from rpython.rtyper.lltypesystem.lltype import *
 
 Here are a few primitive low-level types, and the typeOf() function to figure
 them out:
@@ -191,7 +191,7 @@
 types like list in this elementary world.  The ``malloc()`` function is a kind
 of placeholder, which must eventually be provided by the code generator for the
 target platform; but as we have just seen its Python implementation in
-`pypy/rpython/lltypesystem/lltype.py`_ works too, which is primarily useful for
+`rpython/rtyper/lltypesystem/lltype.py`_ works too, which is primarily useful 
for
 testing, interactive exploring, etc.
 
 The argument to ``malloc()`` is the structure type directly, but it returns a
@@ -245,7 +245,7 @@
 +++++++++++++++
 
 Structure types are built as instances of 
-``pypy.rpython.lltypesystem.lltype.Struct``::
+``rpython.rtyper.lltypesystem.lltype.Struct``::
 
     MyStructType = Struct('somename',  ('field1', Type1), ('field2', Type2)...)
     MyStructType = GcStruct('somename',  ('field1', Type1), ('field2', 
Type2)...)
@@ -277,7 +277,7 @@
 +++++++++++
 
 An array type is built as an instance of 
-``pypy.rpython.lltypesystem.lltype.Array``::
+``rpython.rtyper.lltypesystem.lltype.Array``::
 
     MyIntArray = Array(Signed)
     MyOtherArray = Array(MyItemType)
@@ -316,7 +316,7 @@
 with care: the bigger structure of which they are part of could be freed while
 the Ptr to the substructure is still in use.  In general, it is a good idea to
 avoid passing around pointers to inlined substructures of malloc()ed 
structures.
-(The testing implementation of `pypy/rpython/lltypesystem/lltype.py`_ checks 
to some
+(The testing implementation of `rpython/rtyper/lltypesystem/lltype.py`_ checks 
to some
 extent that you are not trying to use a pointer to a structure after its
 container has been freed, using weak references.  But pointers to non-GC
 structures are not officially meant to be weak references: using them after 
what
@@ -429,7 +429,7 @@
 change needed to the Annotator to allow it to perform type inference of our
 very-low-level snippets of code.
 
-See for example `pypy/rpython/rlist.py`_.
+See for example `rpython/rtyper/rlist.py`_.
 
 
 .. _`oo type`:
@@ -441,10 +441,10 @@
 targeting low level backends such as C, but it is not good
 enough for targeting higher level backends such as .NET CLI or Java
 JVM, so a new object oriented model has been introduced. This model is
-implemented in the first part of `pypy/rpython/ootypesystem/ootype.py`_.
+implemented in the first part of `rpython/rtyper/ootypesystem/ootype.py`_.
 
 As for the low-level typesystem, the second part of
-`pypy/rpython/ootypesystem/ootype.py`_ is a runnable implementation of
+`rpython/rtyper/ootypesystem/ootype.py`_ is a runnable implementation of
 these types, for testing purposes.
 
 
@@ -751,7 +751,7 @@
 The LLInterpreter is a simple piece of code that is able to interpret flow
 graphs. This is very useful for testing purposes, especially if you work on
 the RPython Typer. The most useful interface for it is the ``interpret``
-function in the file `pypy/rpython/test/test_llinterp.py`_. It takes as
+function in the file `rpython/rtyper/test/test_llinterp.py`_. It takes as
 arguments a function and a list of arguments with which the function is
 supposed to be called. Then it generates the flow graph, annotates it
 according to the types of the arguments you passed to it and runs the
diff --git a/pypy/doc/stackless.rst b/pypy/doc/stackless.rst
--- a/pypy/doc/stackless.rst
+++ b/pypy/doc/stackless.rst
@@ -29,7 +29,7 @@
 on 32-bit or a complete megabyte on 64-bit.  Moreover, the feature is
 only available (so far) on x86 and x86-64 CPUs; for other CPUs you need
 to add a short page of custom assembler to
-`pypy/translator/c/src/stacklet/`_.
+`rpython/translator/c/src/stacklet/`_.
 
 
 Theory
@@ -271,9 +271,9 @@
 Continulets are internally implemented using stacklets, which is the
 generic RPython-level building block for "one-shot continuations".  For
 more information about them please see the documentation in the C source
-at `pypy/translator/c/src/stacklet/stacklet.h`_.
+at `rpython/translator/c/src/stacklet/stacklet.h`_.
 
-The module ``pypy.rlib.rstacklet`` is a thin wrapper around the above
+The module ``rpython.rlib.rstacklet`` is a thin wrapper around the above
 functions.  The key point is that new() and switch() always return a
 fresh stacklet handle (or an empty one), and switch() additionally
 consumes one.  It makes no sense to have code in which the returned
diff --git a/pypy/doc/tool/makeref.py b/pypy/doc/tool/makeref.py
--- a/pypy/doc/tool/makeref.py
+++ b/pypy/doc/tool/makeref.py
@@ -1,10 +1,9 @@
 
 import py
-py.path.local(__file__)
 import pypy
-pypydir = py.path.local(pypy.__file__).dirpath()
-distdir = pypydir.dirpath() 
-issue_url = 'http://codespeak.net/issue/pypy-dev/' 
+pypydir = py.path.local(pypy.__file__).join('..')
+distdir = pypydir.dirpath()
+issue_url = 'http://bugs.pypy.org/issue/pypy-dev/' 
 bitbucket_url = 'https://bitbucket.org/pypy/pypy/src/default/'
 
 import urllib2, posixpath
diff --git a/pypy/doc/translation.rst b/pypy/doc/translation.rst
--- a/pypy/doc/translation.rst
+++ b/pypy/doc/translation.rst
@@ -90,7 +90,7 @@
 (although these steps are not quite as distinct as you might think from
 this presentation).
 
-There is an `interactive interface`_ called `pypy/bin/translatorshell.py`_ to 
the
+There is an `interactive interface`_ called `rpython/bin/translatorshell.py`_ 
to the
 translation process which allows you to interactively work through these
 stages.
 
@@ -116,7 +116,7 @@
 which are the basic data structures of the translation
 process.
 
-All these types are defined in `pypy/objspace/flow/model.py`_ (which is a 
rather
+All these types are defined in `rpython/flowspace/model.py`_ (which is a rather
 important module in the PyPy source base, to reinforce the point).
 
 The flow graph of a function is represented by the class ``FunctionGraph``.
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -65,3 +65,6 @@
 .. branch: signal-and-thread
 Add "__pypy__.thread.signals_enabled", a context manager. Can be used in a
 non-main thread to enable the processing of signal handlers in that thread.
+
+.. branch: coding-guide-update-rlib-refs
+.. branch: rlib-doc-rpython-refs
diff --git a/pypy/module/_io/interp_bytesio.py 
b/pypy/module/_io/interp_bytesio.py
--- a/pypy/module/_io/interp_bytesio.py
+++ b/pypy/module/_io/interp_bytesio.py
@@ -52,6 +52,25 @@
         self.pos += size
         return space.wrap(output)
 
+    def readline_w(self, space, w_limit=None):
+        self._check_closed(space)
+        limit = convert_size(space, w_limit)
+
+        cur_pos = self.pos
+        if limit < 0:
+            end_pos = self.string_size
+        else:
+            end_pos = min(cur_pos + limit, self.string_size)
+        while cur_pos != end_pos:
+            if self.buf[cur_pos] == '\n':
+                cur_pos += 1
+                break
+            cur_pos += 1
+
+        output = buffer2string(self.buf, self.pos, cur_pos)
+        self.pos = cur_pos
+        return space.wrap(output)
+
     def read1_w(self, space, w_size):
         return self.read_w(space, w_size)
 
@@ -209,6 +228,7 @@
 
     read = interp2app(W_BytesIO.read_w),
     read1 = interp2app(W_BytesIO.read1_w),
+    readline = interp2app(W_BytesIO.readline_w),
     readinto = interp2app(W_BytesIO.readinto_w),
     write = interp2app(W_BytesIO.write_w),
     truncate = interp2app(W_BytesIO.truncate_w),
diff --git a/pypy/module/_io/test/test_bytesio.py 
b/pypy/module/_io/test/test_bytesio.py
--- a/pypy/module/_io/test/test_bytesio.py
+++ b/pypy/module/_io/test/test_bytesio.py
@@ -75,3 +75,19 @@
         b = _io.BytesIO("hello")
         b.close()
         raises(ValueError, b.readinto, bytearray("hello"))
+
+    def test_readline(self):
+        import _io
+        f = _io.BytesIO(b'abc\ndef\nxyzzy\nfoo\x00bar\nanother line')
+        assert f.readline() == b'abc\n'
+        assert f.readline(10) == b'def\n'
+        assert f.readline(2) == b'xy'
+        assert f.readline(4) == b'zzy\n'
+        assert f.readline() == b'foo\x00bar\n'
+        assert f.readline(None) == b'another line'
+        raises(TypeError, f.readline, 5.3)
+
+    def test_overread(self):
+        import _io
+        f = _io.BytesIO(b'abc')
+        assert f.readline(10) == b'abc'
diff --git a/rpython/jit/metainterp/pyjitpl.py 
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -1082,7 +1082,7 @@
     def opimpl_debug_fatalerror(self, box):
         from rpython.rtyper.lltypesystem import rstr, lloperation
         msg = box.getref(lltype.Ptr(rstr.STR))
-        lloperation.llop.debug_fatalerror(msg)
+        lloperation.llop.debug_fatalerror(lltype.Void, msg)
 
     @arguments("box", "box", "box", "box", "box")
     def opimpl_jit_debug(self, stringbox, arg1box, arg2box, arg3box, arg4box):
diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -153,7 +153,8 @@
             else:
                 return type(arg)
         def typecheck(*args):
-            from rpython.annotator.model import SomeList, SomeDict, SomeChar
+            from rpython.annotator.model import SomeList, SomeDict, SomeChar,\
+                 SomeInteger
             for i, (expected_type, arg) in enumerate(zip(types, args)):
                 if expected_type is None:
                     continue
@@ -167,6 +168,9 @@
                 if isinstance(s_expected, SomeChar) and (
                         isinstance(arg, str) and len(arg) == 1):   # a char
                     continue
+                if (isinstance(s_expected, SomeInteger) and
+                    isinstance(arg, s_expected.knowntype)):
+                    continue
                 #
                 s_argtype = get_annotation(get_type_descr_of_argument(arg))
                 if not s_expected.contains(s_argtype):
diff --git a/rpython/rtyper/lltypesystem/rdict.py 
b/rpython/rtyper/lltypesystem/rdict.py
--- a/rpython/rtyper/lltypesystem/rdict.py
+++ b/rpython/rtyper/lltypesystem/rdict.py
@@ -8,6 +8,7 @@
 from rpython.rlib.rarithmetic import r_uint, intmask, LONG_BIT
 from rpython.rtyper import rmodel
 from rpython.rtyper.error import TyperError
+from rpython.annotator.model import SomeInteger
 
 
 HIGHEST_BIT = intmask(1 << (LONG_BIT - 1))
@@ -385,48 +386,60 @@
 #  be direct_call'ed from rtyped flow graphs, which means that they will
 #  get flowed and annotated, mostly with SomePtr.
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_everused_from_flag(entries, i):
     return entries[i].f_everused
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_everused_from_key(entries, i):
     return bool(entries[i].key)
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_everused_from_value(entries, i):
     return bool(entries[i].value)
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_valid_from_flag(entries, i):
     return entries[i].f_valid
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_mark_deleted_in_flag(entries, i):
     entries[i].f_valid = False
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_valid_from_key(entries, i):
     ENTRIES = lltype.typeOf(entries).TO
     dummy = ENTRIES.dummy_obj.ll_dummy_value
     return entries.everused(i) and entries[i].key != dummy
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_mark_deleted_in_key(entries, i):
     ENTRIES = lltype.typeOf(entries).TO
     dummy = ENTRIES.dummy_obj.ll_dummy_value
     entries[i].key = dummy
 
[email protected](None, SomeInteger(nonneg=True))
 def ll_valid_from_value(entries, i):
     ENTRIES = lltype.typeOf(entries).TO
     dummy = ENTRIES.dummy_obj.ll_dummy_value
     return entries.everused(i) and entries[i].value != dummy
 
[email protected](None, int)
 def ll_mark_deleted_in_value(entries, i):
     ENTRIES = lltype.typeOf(entries).TO
     dummy = ENTRIES.dummy_obj.ll_dummy_value
     entries[i].value = dummy
 
[email protected](None, int)
 def ll_hash_from_cache(entries, i):
     return entries[i].f_hash
 
[email protected](None, int)
 def ll_hash_recomputed(entries, i):
     ENTRIES = lltype.typeOf(entries).TO
     return ENTRIES.fasthashfn(entries[i].key)
 
[email protected](None, int)
 def ll_get_value(d, i):
     return d.entries[i].value
 
@@ -513,6 +526,7 @@
 
 @jit.look_inside_iff(lambda d, i: jit.isvirtual(d) and jit.isconstant(i))
 def _ll_dict_del(d, i):
+    assert i >= 0
     d.entries.mark_deleted(i)
     d.num_items -= 1
     # clear the key and the value if they are GC pointers
@@ -573,6 +587,7 @@
     direct_compare = not hasattr(ENTRIES, 'no_direct_compare')
     mask = len(entries) - 1
     i = hash & mask
+    assert i >= 0
     # do the first try before any looping
     if entries.valid(i):
         checkingkey = entries[i].key
@@ -603,6 +618,7 @@
         i = r_uint(i)
         i = (i << 2) + i + perturb + 1
         i = intmask(i) & mask
+        assert i >= 0
         # keep 'i' as a signed number here, to consistently pass signed
         # arguments to the small helper methods.
         if not entries.everused(i):
@@ -636,11 +652,13 @@
     entries = d.entries
     mask = len(entries) - 1
     i = hash & mask
+    assert i >= 0
     perturb = r_uint(hash)
     while entries.everused(i):
         i = r_uint(i)
         i = (i << 2) + i + perturb + 1
         i = intmask(i) & mask
+        assert i >= 0
         perturb >>= PERTURB_SHIFT
     return i
 
@@ -733,6 +751,7 @@
         if dict:
             entries = dict.entries
             index = iter.index
+            assert index >= 0
             entries_len = len(entries)
             while index < entries_len:
                 entry = entries[index]
diff --git a/rpython/rtyper/lltypesystem/rlist.py 
b/rpython/rtyper/lltypesystem/rlist.py
--- a/rpython/rtyper/lltypesystem/rlist.py
+++ b/rpython/rtyper/lltypesystem/rlist.py
@@ -419,6 +419,7 @@
 
     def __init__(self, r_list):
         self.r_list = r_list
+        self.external_item_repr = r_list.external_item_repr
         self.lowleveltype = Ptr(GcStruct('listiter',
                                          ('list', r_list.lowleveltype),
                                          ('index', Signed)))
diff --git a/rpython/rtyper/lltypesystem/rstr.py 
b/rpython/rtyper/lltypesystem/rstr.py
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -1054,15 +1054,18 @@
     def __init__(self):
         self.ll_striter = ll_striter
         self.ll_strnext = ll_strnext
+        self.ll_getnextindex = ll_getnextindex
 
 class StringIteratorRepr(BaseStringIteratorRepr):
 
+    external_item_repr = char_repr
     lowleveltype = Ptr(GcStruct('stringiter',
                                 ('string', string_repr.lowleveltype),
                                 ('index', Signed)))
 
 class UnicodeIteratorRepr(BaseStringIteratorRepr):
 
+    external_item_repr = unichar_repr
     lowleveltype = Ptr(GcStruct('unicodeiter',
                                 ('string', unicode_repr.lowleveltype),
                                 ('index', Signed)))
@@ -1087,6 +1090,9 @@
     iter.index = index + 1
     return chars[index]
 
+def ll_getnextindex(iter):
+    return iter.index
+
 string_repr.iterator_repr = StringIteratorRepr()
 unicode_repr.iterator_repr = UnicodeIteratorRepr()
 
diff --git a/rpython/rtyper/ootypesystem/rstr.py 
b/rpython/rtyper/ootypesystem/rstr.py
--- a/rpython/rtyper/ootypesystem/rstr.py
+++ b/rpython/rtyper/ootypesystem/rstr.py
@@ -428,14 +428,17 @@
 
 
 class StringIteratorRepr(AbstractStringIteratorRepr):
+    external_item_repr = char_repr
     lowleveltype = ootype.Record({'string': string_repr.lowleveltype,
                                   'index': ootype.Signed})
 
     def __init__(self):
         self.ll_striter = ll_striter
         self.ll_strnext = ll_strnext
+        self.ll_getnextindex = ll_getnextindex
 
 class UnicodeIteratorRepr(AbstractStringIteratorRepr):
+    external_item_repr = unichar_repr
     lowleveltype = ootype.Record({'string': unicode_repr.lowleveltype,
                                   'index': ootype.Signed})
 
@@ -463,6 +466,9 @@
     iter.index = index + 1
     return string.ll_stritem_nonneg(index)
 
+def ll_getnextindex(iter):
+    return iter.index
+
 
 StringRepr.string_iterator_repr = StringIteratorRepr()
 UnicodeRepr.string_iterator_repr = UnicodeIteratorRepr()
diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py
--- a/rpython/rtyper/rclass.py
+++ b/rpython/rtyper/rclass.py
@@ -395,7 +395,7 @@
         assert not s_attr.is_constant()
         if '__iter__' in self.allinstancefields:
             raise Exception("__iter__ on instance disallowed")
-        r_method = self.rtyper.makerepr(s_attr)
+        r_method = self.rtyper.getrepr(s_attr)
         r_method.get_method_from_instance(self, vinst, hop.llops)
         hop2 = hop.copy()
         hop2.spaceop.opname = 'simple_call'
diff --git a/rpython/rtyper/rptr.py b/rpython/rtyper/rptr.py
--- a/rpython/rtyper/rptr.py
+++ b/rpython/rtyper/rptr.py
@@ -347,3 +347,10 @@
         if r_from.lowleveltype == r_to.lowleveltype:
             return v
         return NotImplemented
+
+class __extend__(pairtype(InteriorPtrRepr, InteriorPtrRepr)):
+
+    def convert_from_to((r_from, r_to), v, llops):
+        if r_from.__dict__ == r_to.__dict__:
+            return v
+        return NotImplemented
diff --git a/rpython/rtyper/rrange.py b/rpython/rtyper/rrange.py
--- a/rpython/rtyper/rrange.py
+++ b/rpython/rtyper/rrange.py
@@ -207,7 +207,7 @@
         v_index = hop.gendirectcall(self.ll_getnextindex, v_enumerate)
         hop2 = hop.copy()
         hop2.args_r = [self.r_baseiter]
-        r_item_src = self.r_baseiter.r_list.external_item_repr
+        r_item_src = self.r_baseiter.external_item_repr
         r_item_dst = hop.r_result.items_r[1]
         v_item = self.r_baseiter.rtype_next(hop2)
         v_item = hop.llops.convertvar(v_item, r_item_src, r_item_dst)
diff --git a/rpython/rtyper/test/test_rstr.py b/rpython/rtyper/test/test_rstr.py
--- a/rpython/rtyper/test/test_rstr.py
+++ b/rpython/rtyper/test/test_rstr.py
@@ -1035,6 +1035,17 @@
         got = self.interpret(f, [7])
         assert self.ll_to_string(got) == 'None'
 
+    def test_enumerate(self):
+        const = self.const
+        def fn(n):
+            s = const('abcde')
+            for i, x in enumerate(s):
+                if i == n:
+                    return x
+            return 'x'
+        res = self.interpret(fn, [2])
+        assert res == 'c'
+
 
 def FIXME_test_str_to_pystringobj():
     def f(n):
diff --git a/rpython/translator/c/src/mem.h b/rpython/translator/c/src/mem.h
--- a/rpython/translator/c/src/mem.h
+++ b/rpython/translator/c/src/mem.h
@@ -4,7 +4,7 @@
 
 #include <string.h>
 
-/* used by pypy.rlib.rstack, but also by asmgcc */
+/* used by rpython.rlib.rstack, but also by asmgcc */
 #define OP_STACK_CURRENT(r)  r = (Signed)&r
 
 
diff --git a/rpython/translator/c/src/stack.h b/rpython/translator/c/src/stack.h
--- a/rpython/translator/c/src/stack.h
+++ b/rpython/translator/c/src/stack.h
@@ -18,7 +18,7 @@
 char LL_stack_too_big_slowpath(long);    /* returns 0 (ok) or 1 (too big) */
 void LL_stack_set_length_fraction(double);
 
-/* some macros referenced from pypy.rlib.rstack */
+/* some macros referenced from rpython.rlib.rstack */
 #define LL_stack_get_end() ((long)_LLstacktoobig_stack_end)
 #define LL_stack_get_length() _LLstacktoobig_stack_length
 #define LL_stack_get_end_adr()    ((long)&_LLstacktoobig_stack_end)   /* JIT */
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to