[pypy-svn] pypy default: merge heads

fijal commits-noreply at bitbucket.org
Sun Feb 13 16:25:05 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r41886:1ade308774ba
Date: 2011-02-13 17:24 +0200
http://bitbucket.org/pypy/pypy/changeset/1ade308774ba/

Log:	merge heads

diff --git a/pypy/module/readline/c_readline.py b/pypy/module/readline/c_readline.py
deleted file mode 100644
--- a/pypy/module/readline/c_readline.py
+++ /dev/null
@@ -1,77 +0,0 @@
-from pypy.rpython.tool import rffi_platform as platform
-from pypy.rpython.lltypesystem import lltype, rffi
-from pypy.interpreter.error import OperationError
-from pypy.interpreter.gateway import ObjSpace, interp2app
-from pypy.translator.tool.cbuild import ExternalCompilationInfo
-
-# On various platforms, linking only with libreadline is not enough;
-# we also need to link with some variant of curses or libtermcap.
-# We follow the logic of CPython below.
-def try_with_lib(extralibs, **kwds):
-    global most_recent_error
-    # at least on Gentoo Linux, readline.h doesn't compile if stdio.h is not
-    # included before
-    eci = ExternalCompilationInfo(
-        includes = ["stdio.h", "readline/readline.h", "readline/history.h"],
-        libraries = extralibs + ['readline'],
-        )
-    try:
-        platform.verify_eci(eci)
-        return eci
-    except platform.CompilationError, e:
-        most_recent_error = e
-        return None
-
-eci = (try_with_lib([]) or
-       try_with_lib(['ncursesw']) or
-       try_with_lib(['ncurses']) or
-       try_with_lib(['curses']) or
-       try_with_lib(['termcap'], library_dirs=['/usr/lib/termcap']))
-if eci is None:
-    raise most_recent_error
-
-# ____________________________________________________________
-
-def external(name, args, result):
-    return rffi.llexternal(name, args, result, compilation_info=eci)
-
-# get a binding to  c library functions and define their args and return types
-# char *readline(char *)
-c_readline = external('readline', [rffi.CCHARP], rffi.CCHARP)
-
-# void rl_initiliaze(void)
-c_rl_initialize = external('rl_initialize', [], lltype.Void)
-
-# void using_history(void)
-c_using_history = external('using_history', [], lltype.Void)
-
-# void add_history(const char *)
-c_add_history = external('add_history', [rffi.CCHARP], lltype.Void)
-
-#------------------------------------------------------------
-# special initialization of readline 
-
-class ReadlineState(object):
-    lastline = ""        # XXX possibly temporary hack
-readlinestate = ReadlineState()
-
-def setup_readline(space, w_module):
-    c_using_history()
-    # XXX CPython initializes more stuff here
-    c_rl_initialize()
-    # install sys.__raw_input__, a hook that will be used by raw_input()
-    space.setitem(space.sys.w_dict, space.wrap('__raw_input__'),
-                  space.wrap(app_readline_func))
-
-def readline_func(space, prompt):
-    ll_res = c_readline(prompt)
-    if not ll_res:
-        raise OperationError(space.w_EOFError, space.w_None)
-    res = rffi.charp2str(ll_res)
-    if res and res != readlinestate.lastline:
-        readlinestate.lastline = res
-        c_add_history(res)
-    return space.wrap(res)
-
-readline_func.unwrap_spec = [ObjSpace, str]
-app_readline_func = interp2app(readline_func)

diff --git a/pypy/module/readline/test/test_c_readline.py b/pypy/module/readline/test/test_c_readline.py
deleted file mode 100644
--- a/pypy/module/readline/test/test_c_readline.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-Directly test the basic ctypes wrappers.
-"""
-
-import py
-from pypy import conftest; conftest.translation_test_so_skip_if_appdirect()
-from pypy.rpython.tool import rffi_platform as platform
-
-try:
-    from pypy.module.readline import c_readline
-except platform.CompilationError, e:
-    py.test.skip(e)
-
-
-def test_basic_import():
-    c_readline.c_rl_initialize()

diff --git a/pypy/module/readline/app_stub.py b/pypy/module/readline/app_stub.py
deleted file mode 100644
--- a/pypy/module/readline/app_stub.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# NOT_RPYTHON
-
-def stub(*args, **kwds):
-    import warnings
-    warnings.warn("the 'readline' module is only a stub so far")
-
-def stub_str(*args, **kwds):
-    stub()
-    return ''
-
-def stub_int(*args, **kwds):
-    stub()
-    return 0

diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -20,7 +20,7 @@
 from pypy.rlib.rarithmetic import intmask
 from pypy.rlib.objectmodel import specialize
 from pypy.jit.codewriter.jitcode import JitCode, SwitchDictDescr, MissingLiveness
-from pypy.jit.codewriter import heaptracker
+from pypy.jit.codewriter import heaptracker, longlong
 from pypy.jit.metainterp.optimizeutil import RetraceLoop
 
 # ____________________________________________________________
@@ -1473,7 +1473,7 @@
             elif result_type == history.REF:
                 raise sd.DoneWithThisFrameRef(self.cpu, resultbox.getref_base())
             elif result_type == history.FLOAT:
-                raise sd.DoneWithThisFrameFloat(resultbox.getfloat())
+                raise sd.DoneWithThisFrameFloat(resultbox.getfloatstorage())
             else:
                 assert False
 

diff --git a/pypy/doc/config/objspace.usemodules.readline.txt b/pypy/doc/config/objspace.usemodules.readline.txt
deleted file mode 100644
--- a/pypy/doc/config/objspace.usemodules.readline.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-Use the 'readline' module. 

diff --git a/pypy/jit/metainterp/resume.py b/pypy/jit/metainterp/resume.py
--- a/pypy/jit/metainterp/resume.py
+++ b/pypy/jit/metainterp/resume.py
@@ -1157,7 +1157,7 @@
     def decode_float(self, tagged):
         num, tag = untag(tagged)
         if tag == TAGCONST:
-            return self.consts[num].getfloat()
+            return self.consts[num].getfloatstorage()
         else:
             assert tag == TAGBOX
             if num < 0:

diff --git a/pypy/module/readline/test/__init__.py b/pypy/module/readline/test/__init__.py
deleted file mode 100644
--- a/pypy/module/readline/test/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-#

diff --git a/pypy/module/readline/test/test_with_pypy.py b/pypy/module/readline/test/test_with_pypy.py
deleted file mode 100644
--- a/pypy/module/readline/test/test_with_pypy.py
+++ /dev/null
@@ -1,27 +0,0 @@
-"""
-Test the readline library on top of PyPy.  The following tests run
-in the PyPy interpreter, itself running on top of CPython
-"""
-
-import py
-from pypy.conftest import gettestobjspace
-from pypy.rpython.tool import rffi_platform as platform
-
-try:
-    from pypy.module.readline import c_readline
-except platform.CompilationError, e:
-    py.test.skip(e)
-
-
-class AppTestReadline:
-
-    def setup_class(cls):
-        # enable usage of the readline mixedmodule
-        space = gettestobjspace(usemodules=('readline',))
-        cls.space = space
-
-    def test_basic_import(self):
-        # this is interpreted by PyPy
-        import readline 
-        readline.readline
-        # XXX test more

diff --git a/pypy/module/readline/interp_readline.py b/pypy/module/readline/interp_readline.py
deleted file mode 100644
--- a/pypy/module/readline/interp_readline.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# this is a sketch of how one might one day be able to define a pretty simple
-# ctypes-using module, suitable for feeding to the ext-compiler
-
-from pypy.interpreter.baseobjspace import ObjSpace
-
-from pypy.module.readline import c_readline
-from pypy.rpython.lltypesystem import rffi
-
-#------------------------------------------------------------
-# exported API  (see interpleveldefs in __init__.py) 
-#
-def readline(space, prompt):
-    return space.wrap(rffi.charp2str(c_readline.c_readline(prompt)))
-readline.unwrap_spec = [ObjSpace, str]
-
-def setcompleter(space, w_callback):
-    """Set or remove the completer function.
-    The function is called as function(text, state),
-    for state in 0, 1, 2, ..., until it returns a non-string.
-    It should return the next possible completion starting with 'text'.
-    """ 
-    # XXX set internal completion function 
-    

diff --git a/pypy/module/readline/__init__.py b/pypy/module/readline/__init__.py
deleted file mode 100644
--- a/pypy/module/readline/__init__.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# this is a sketch of how one might one day be able to define a pretty simple
-# ctypes-using module, suitable for feeding to the ext-compiler
-
-from pypy.interpreter.mixedmodule import MixedModule
-
-# XXX raw_input needs to check for space.readline_func and use
-# it if its there 
-
-class Module(MixedModule):
-    """Importing this module enables command line editing using GNU readline."""
-    # the above line is the doc string of the translated module  
-
-    def setup_after_space_initialization(self):
-        from pypy.module.readline import c_readline 
-        c_readline.setup_readline(self.space, self)
-
-    interpleveldefs = {
-        'readline'    : 'interp_readline.readline',
-    }
-
-    appleveldefs = {
-        'parse_and_bind':     'app_stub.stub',
-        'get_line_buffer':    'app_stub.stub_str',
-        'insert_text':        'app_stub.stub',
-        'read_init_file':     'app_stub.stub',
-        'read_history_file':  'app_stub.stub',
-        'write_history_file': 'app_stub.stub',
-        'clear_history':      'app_stub.stub',
-        'get_history_length': 'app_stub.stub_int',
-        'set_history_length': 'app_stub.stub',
-        'get_current_history_length': 'app_stub.stub_int',
-        'get_history_item':           'app_stub.stub_str',
-        'remove_history_item':        'app_stub.stub',
-        'replace_history_item':       'app_stub.stub',
-        'redisplay':                  'app_stub.stub',
-        'set_startup_hook':           'app_stub.stub',
-        'set_pre_input_hook':         'app_stub.stub',
-        'set_completer':      'app_stub.stub',
-        'get_completer':      'app_stub.stub',
-        'get_begidx':         'app_stub.stub_int',
-        'get_endidx':         'app_stub.stub_int',
-        'set_completer_delims':       'app_stub.stub',
-        'get_completer_delims':       'app_stub.stub_str',
-        'add_history':        'app_stub.stub',
-    }


More information about the Pypy-commit mailing list