[pypy-svn] pypy pytest2: merge default
hpk42
commits-noreply at bitbucket.org
Sun Mar 6 09:26:29 CET 2011
Author: holger krekel <holger at merlinux.eu>
Branch: pytest2
Changeset: r42443:34ac0158319a
Date: 2011-03-06 09:20 +0100
http://bitbucket.org/pypy/pypy/changeset/34ac0158319a/
Log: merge default
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/__builtin__/app_file_stub.py b/pypy/module/__builtin__/app_file_stub.py
deleted file mode 100644
--- a/pypy/module/__builtin__/app_file_stub.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# NOT_RPYTHON
-
-class file(object):
- """file(name[, mode[, buffering]]) -> file object
-
-Open a file. The mode can be 'r', 'w' or 'a' for reading (default),
-writing or appending. The file will be created if it doesn't exist
-when opened for writing or appending; it will be truncated when
-opened for writing. Add a 'b' to the mode for binary files.
-Add a '+' to the mode to allow simultaneous reading and writing.
-If the buffering argument is given, 0 means unbuffered, 1 means line
-buffered, and larger numbers specify the buffer size.
-Add a 'U' to mode to open the file for input with universal newline
-support. Any line ending in the input file will be seen as a '\n'
-in Python. Also, a file so opened gains the attribute 'newlines';
-the value for this attribute is one of None (no newline read yet),
-'\r', '\n', '\r\n' or a tuple containing all the newline types seen.
-
-Note: open() is an alias for file().
-"""
diff --git a/pypy/module/_rawffi/error.py b/pypy/module/_rawffi/error.py
deleted file mode 100644
--- a/pypy/module/_rawffi/error.py
+++ /dev/null
@@ -1,2 +0,0 @@
-class SegfaultException(Exception):
- pass
diff --git a/pypy/module/_socket/app_socket.py b/pypy/module/_socket/app_socket.py
deleted file mode 100644
--- a/pypy/module/_socket/app_socket.py
+++ /dev/null
@@ -1,15 +0,0 @@
-"""Implementation module for socket operations.
-
-See the socket module for documentation."""
-
-class error(IOError):
- pass
-
-class herror(error):
- pass
-
-class gaierror(error):
- pass
-
-class timeout(error):
- pass
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',
- }
diff --git a/pypy/module/thread/app_thread.py b/pypy/module/thread/app_thread.py
deleted file mode 100644
--- a/pypy/module/thread/app_thread.py
+++ /dev/null
@@ -1,7 +0,0 @@
-class error(Exception):
- pass
-
-def exit():
- """This is synonymous to ``raise SystemExit''. It will cause the current
-thread to exit silently unless the exception is caught."""
- raise SystemExit
diff --git a/pypy/translator/c/test/test_dtoa.py b/pypy/translator/c/test/test_dtoa.py
deleted file mode 100644
--- a/pypy/translator/c/test/test_dtoa.py
+++ /dev/null
@@ -1,92 +0,0 @@
-from __future__ import with_statement
-from pypy.translator.tool.cbuild import ExternalCompilationInfo
-from pypy.tool.autopath import pypydir
-from pypy.rpython.lltypesystem import lltype, rffi
-from pypy.rlib.rstring import StringBuilder
-import py
-
-includes = []
-libraries = []
-
-cdir = py.path.local(pypydir) / 'translator' / 'c'
-files = [cdir / 'src' / 'dtoa.c']
-include_dirs = [cdir]
-
-eci = ExternalCompilationInfo(
- include_dirs = include_dirs,
- libraries = libraries,
- separate_module_files = files,
- separate_module_sources = ['''
- #include <stdlib.h>
- #include <assert.h>
- #define WITH_PYMALLOC
- #include "src/obmalloc.c"
- '''],
- export_symbols = ['_Py_dg_strtod',
- '_Py_dg_dtoa',
- '_Py_dg_freedtoa',
- ],
-)
-
-dg_strtod = rffi.llexternal(
- '_Py_dg_strtod', [rffi.CCHARP, rffi.CCHARPP], rffi.DOUBLE,
- compilation_info=eci)
-
-dg_dtoa = rffi.llexternal(
- '_Py_dg_dtoa', [rffi.DOUBLE, rffi.INT, rffi.INT,
- rffi.INTP, rffi.INTP, rffi.CCHARPP], rffi.CCHARP,
- compilation_info=eci)
-
-dg_freedtoa = rffi.llexternal(
- '_Py_dg_freedtoa', [rffi.CCHARP], lltype.Void,
- compilation_info=eci)
-
-def strtod(input):
- with lltype.scoped_alloc(rffi.CCHARPP.TO, 1) as end_ptr:
- with rffi.scoped_str2charp(input) as ll_input:
- result = dg_strtod(ll_input, end_ptr)
- if end_ptr[0] and ord(end_ptr[0][0]):
- offset = (rffi.cast(rffi.LONG, end_ptr[0]) -
- rffi.cast(rffi.LONG, ll_input))
- raise ValueError("invalid input at position %d" % (offset,))
- return result
-
-def dtoa(value, mode=0, precision=0):
- builder = StringBuilder(20)
- with lltype.scoped_alloc(rffi.INTP.TO, 1) as decpt_ptr:
- with lltype.scoped_alloc(rffi.INTP.TO, 1) as sign_ptr:
- with lltype.scoped_alloc(rffi.CCHARPP.TO, 1) as end_ptr:
- output_ptr = dg_dtoa(value, mode, precision,
- decpt_ptr, sign_ptr, end_ptr)
- try:
- buflen = (rffi.cast(rffi.LONG, end_ptr[0]) -
- rffi.cast(rffi.LONG, output_ptr))
- intpart = rffi.cast(lltype.Signed, decpt_ptr[0])
- if intpart <= buflen:
- builder.append(rffi.charpsize2str(output_ptr, intpart))
- else:
- builder.append(rffi.charpsize2str(output_ptr, buflen))
- while buflen < intpart:
- builder.append('0')
- intpart -= 1
- builder.append('.')
- fracpart = buflen - intpart
- if fracpart > 0:
- ptr = rffi.ptradd(output_ptr, intpart)
- builder.append(rffi.charpsize2str(ptr, fracpart))
- finally:
- dg_freedtoa(output_ptr)
- return builder.build()
-
-def test_strtod():
- assert strtod("12345") == 12345.0
- assert strtod("1.1") == 1.1
- assert strtod("3.47") == 3.47
- raises(ValueError, strtod, "123A")
-
-def test_dtoa():
- assert dtoa(3.47) == "3.47"
- assert dtoa(1.1) == "1.1"
- assert dtoa(12.3577) == "12.3577"
- assert dtoa(10) == "10."
- assert dtoa(1e100) == "1" + "0" * 100 + "."
diff --git a/lib_pypy/cmath.py b/lib_pypy/cmath.py
deleted file mode 100644
--- a/lib_pypy/cmath.py
+++ /dev/null
@@ -1,288 +0,0 @@
-"""This module is always available. It provides access to mathematical
-functions for complex numbers."""
-
-# Complex math module
-
-# much code borrowed from mathmodule.c
-
-import math
-from math import e, pi
-
-try: from __pypy__ import builtinify
-except ImportError: builtinify = lambda f: f
-
-
-# constants
-_one = complex(1., 0.)
-_half = complex(0.5, 0.)
-_i = complex(0., 1.)
-_halfi = complex(0., 0.5)
-
-
-
-# internal functions not available from Python
-def _to_complex(x):
- if isinstance(x, complex):
- return x
- if isinstance(x, (str, unicode)):
- raise TypeError('float or complex required')
- return complex(x)
-
-def _prodi(x):
- x = _to_complex(x)
- real = -x.imag
- imag = x.real
- return complex(real, imag)
-
-
- at builtinify
-def phase(x):
- x = _to_complex(x)
- return math.atan2(x.imag, x.real)
-
-
- at builtinify
-def polar(x):
- x = _to_complex(x)
- phi = math.atan2(x.imag, x.real)
- r = abs(x)
- return r, phi
-
-
- at builtinify
-def rect(r, phi):
- return complex(r * math.cos(phi), r * math.sin(phi))
-
-
- at builtinify
-def acos(x):
- """acos(x)
-
- Return the arc cosine of x."""
-
- x = _to_complex(x)
- return -(_prodi(log((x+(_i*sqrt((_one-(x*x))))))))
-
-
- at builtinify
-def acosh(x):
- """acosh(x)
-
- Return the hyperbolic arccosine of x."""
-
- x = _to_complex(x)
- z = log(_sqrt_half*(sqrt(x+_one)+sqrt(x-_one)))
- return z+z
-
-
- at builtinify
-def asin(x):
- """asin(x)
-
- Return the arc sine of x."""
-
- x = _to_complex(x)
- # -i * log[(sqrt(1-x**2) + i*x]
- squared = x*x
- sqrt_1_minus_x_sq = sqrt(_one-squared)
- return -(_prodi(log((sqrt_1_minus_x_sq+_prodi(x)))))
-
-
- at builtinify
-def asinh(x):
- """asinh(x)
-
- Return the hyperbolic arc sine of x."""
-
- x = _to_complex(x)
- z = log((_sqrt_half * (sqrt(x+_i)+sqrt((x-_i))) ))
- return z+z
-
-
- at builtinify
-def atan(x):
- """atan(x)
-
- Return the arc tangent of x."""
-
- x = _to_complex(x)
- return _halfi*log(((_i+x)/(_i-x)))
-
-
- at builtinify
-def atanh(x):
- """atanh(x)
-
- Return the hyperbolic arc tangent of x."""
-
- x = _to_complex(x)
- return _half*log((_one+x)/(_one-x))
-
-
- at builtinify
-def cos(x):
- """cos(x)
-
- Return the cosine of x."""
-
- x = _to_complex(x)
- real = math.cos(x.real) * math.cosh(x.imag)
- imag = -math.sin(x.real) * math.sinh(x.imag)
- return complex(real, imag)
-
-
- at builtinify
-def cosh(x):
- """cosh(x)
-
- Return the hyperbolic cosine of x."""
-
- x = _to_complex(x)
- real = math.cos(x.imag) * math.cosh(x.real)
- imag = math.sin(x.imag) * math.sinh(x.real)
- return complex(real, imag)
-
-
- at builtinify
-def exp(x):
- """exp(x)
-
- Return the exponential value e**x."""
-
- x = _to_complex(x)
- l = math.exp(x.real)
- real = l * math.cos(x.imag)
- imag = l * math.sin(x.imag)
- return complex(real, imag)
-
-
- at builtinify
-def log(x, base=None):
- """log(x)
-
- Return the natural logarithm of x."""
-
- if base is not None:
- return log(x) / log(base)
- x = _to_complex(x)
- l = math.hypot(x.real,x.imag)
- imag = math.atan2(x.imag, x.real)
- real = math.log(l)
- return complex(real, imag)
-
-
- at builtinify
-def log10(x):
- """log10(x)
-
- Return the base-10 logarithm of x."""
-
- x = _to_complex(x)
- l = math.hypot(x.real, x.imag)
- imag = math.atan2(x.imag, x.real)/math.log(10.)
- real = math.log10(l)
- return complex(real, imag)
-
-
- at builtinify
-def sin(x):
- """sin(x)
-
- Return the sine of x."""
-
- x = _to_complex(x)
- real = math.sin(x.real) * math.cosh(x.imag)
- imag = math.cos(x.real) * math.sinh(x.imag)
- return complex(real, imag)
-
-
- at builtinify
-def sinh(x):
- """sinh(x)
-
- Return the hyperbolic sine of x."""
-
- x = _to_complex(x)
- real = math.cos(x.imag) * math.sinh(x.real)
- imag = math.sin(x.imag) * math.cosh(x.real)
- return complex(real, imag)
-
-
- at builtinify
-def sqrt(x):
- """sqrt(x)
-
- Return the square root of x."""
-
- x = _to_complex(x)
- if x.real == 0. and x.imag == 0.:
- real, imag = 0, 0
- else:
- s = math.sqrt(0.5*(math.fabs(x.real) + math.hypot(x.real,x.imag)))
- d = 0.5*x.imag/s
- if x.real > 0.:
- real = s
- imag = d
- elif x.imag >= 0.:
- real = d
- imag = s
- else:
- real = -d
- imag = -s
- return complex(real, imag)
-
-_sqrt_half = sqrt(_half)
-
-
- at builtinify
-def tan(x):
- """tan(x)
-
- Return the tangent of x."""
-
- x = _to_complex(x)
- sr = math.sin(x.real)
- cr = math.cos(x.real)
- shi = math.sinh(x.imag)
- chi = math.cosh(x.imag)
- rs = sr * chi
- is_ = cr * shi
- rc = cr * chi
- ic = -sr * shi
- d = rc*rc + ic * ic
- real = (rs*rc + is_*ic) / d
- imag = (is_*rc - rs*ic) / d
- return complex(real, imag)
-
-
- at builtinify
-def tanh(x):
- """tanh(x)
-
- Return the hyperbolic tangent of x."""
-
- x = _to_complex(x)
- si = math.sin(x.imag)
- ci = math.cos(x.imag)
- shr = math.sinh(x.real)
- chr = math.cosh(x.real)
- rs = ci * shr
- is_ = si * chr
- rc = ci * chr
- ic = si * shr
- d = rc*rc + ic*ic
- real = (rs*rc + is_*ic) / d
- imag = (is_*rc - rs*ic) / d
- return complex(real, imag)
-
-def isnan(x):
- """isnan(z) -> bool
- Checks if the real or imaginary part of z not a number (NaN)"""
- x = _to_complex(x)
- return math.isnan(x.real) or math.isnan(x.imag)
-
-def isinf(x):
- """isnan(z) -> bool
- Checks if the real or imaginary part of z is infinite"""
- x = _to_complex(x)
- return math.isinf(x.real) or math.isinf(x.imag)
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/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/translator/c/src/math.c b/pypy/translator/c/src/math.c
deleted file mode 100644
--- a/pypy/translator/c/src/math.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* Definitions of some C99 math library functions, for those platforms
- that don't implement these functions already. */
-
-#include <errno.h>
-
-/* The following macros are copied from CPython header files */
-
-#ifdef _MSC_VER
-#include <float.h>
-#define PyPy_IS_NAN _isnan
-#define PyPy_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
-#define copysign _copysign
-#else
-#define PyPy_IS_NAN(X) ((X) != (X))
-#define PyPy_IS_INFINITY(X) ((X) && \
- (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
-#endif
-
-#undef PyPy_NAN
-
-int
-_pypy_math_isinf(double x)
-{
- return PyPy_IS_INFINITY(x);
-}
-
-int
-_pypy_math_isnan(double x)
-{
- return PyPy_IS_NAN(x);
-}
-
-/* The following copyright notice applies to the original
- implementations of acosh, asinh and atanh. */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-double _pypy_math_log1p(double x);
-
-static const double ln2 = 6.93147180559945286227E-01;
-static const double two_pow_m28 = 3.7252902984619141E-09; /* 2**-28 */
-static const double two_pow_p28 = 268435456.0; /* 2**28 */
-static const double zero = 0.0;
-
-/* acosh(x)
- * Method :
- * Based on
- * acosh(x) = log [ x + sqrt(x*x-1) ]
- * we have
- * acosh(x) := log(x)+ln2, if x is large; else
- * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else
- * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
- *
- * Special cases:
- * acosh(x) is NaN with signal if x<1.
- * acosh(NaN) is NaN without signal.
- */
-
-double
-_pypy_math_acosh(double x)
-{
- if (PyPy_IS_NAN(x)) {
- return x+x;
- }
- if (x < 1.) { /* x < 1; return a signaling NaN */
- errno = EDOM;
-#ifdef PyPy_NAN
- return PyPy_NAN;
-#else
- return (x-x)/(x-x);
-#endif
- }
- else if (x >= two_pow_p28) { /* x > 2**28 */
- if (PyPy_IS_INFINITY(x)) {
- return x+x;
- } else {
- return log(x)+ln2; /* acosh(huge)=log(2x) */
- }
- }
- else if (x == 1.) {
- return 0.0; /* acosh(1) = 0 */
- }
- else if (x > 2.) { /* 2 < x < 2**28 */
- double t = x*x;
- return log(2.0*x - 1.0 / (x + sqrt(t - 1.0)));
- }
- else { /* 1 < x <= 2 */
- double t = x - 1.0;
- return _pypy_math_log1p(t + sqrt(2.0*t + t*t));
- }
-}
-
-
-/* asinh(x)
- * Method :
- * Based on
- * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
- * we have
- * asinh(x) := x if 1+x*x=1,
- * := sign(x)*(log(x)+ln2)) for large |x|, else
- * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
- * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
- */
-
-double
-_pypy_math_asinh(double x)
-{
- double w;
- double absx = fabs(x);
-
- if (PyPy_IS_NAN(x) || PyPy_IS_INFINITY(x)) {
- return x+x;
- }
- if (absx < two_pow_m28) { /* |x| < 2**-28 */
- return x; /* return x inexact except 0 */
- }
- if (absx > two_pow_p28) { /* |x| > 2**28 */
- w = log(absx)+ln2;
- }
- else if (absx > 2.0) { /* 2 < |x| < 2**28 */
- w = log(2.0*absx + 1.0 / (sqrt(x*x + 1.0) + absx));
- }
- else { /* 2**-28 <= |x| < 2= */
- double t = x*x;
- w = _pypy_math_log1p(absx + t / (1.0 + sqrt(1.0 + t)));
- }
- return copysign(w, x);
-
-}
-
-/* atanh(x)
- * Method :
- * 1.Reduced x to positive by atanh(-x) = -atanh(x)
- * 2.For x>=0.5
- * 1 2x x
- * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
- * 2 1 - x 1 - x
- *
- * For x<0.5
- * atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
- *
- * Special cases:
- * atanh(x) is NaN if |x| >= 1 with signal;
- * atanh(NaN) is that NaN with no signal;
- *
- */
-
-double
-_pypy_math_atanh(double x)
-{
- double absx;
- double t;
-
- if (PyPy_IS_NAN(x)) {
- return x+x;
- }
- absx = fabs(x);
- if (absx >= 1.) { /* |x| >= 1 */
- errno = EDOM;
-#ifdef PyPy_NAN
- return PyPy_NAN;
-#else
- return x/zero;
-#endif
- }
- if (absx < two_pow_m28) { /* |x| < 2**-28 */
- return x;
- }
- if (absx < 0.5) { /* |x| < 0.5 */
- t = absx+absx;
- t = 0.5 * _pypy_math_log1p(t + t*absx / (1.0 - absx));
- }
- else { /* 0.5 <= |x| <= 1.0 */
- t = 0.5 * _pypy_math_log1p((absx + absx) / (1.0 - absx));
- }
- return copysign(t, x);
-}
-
-/* Mathematically, expm1(x) = exp(x) - 1. The expm1 function is designed
- to avoid the significant loss of precision that arises from direct
- evaluation of the expression exp(x) - 1, for x near 0. */
-
-double
-_pypy_math_expm1(double x)
-{
- /* For abs(x) >= log(2), it's safe to evaluate exp(x) - 1 directly; this
- also works fine for infinities and nans.
-
- For smaller x, we can use a method due to Kahan that achieves close to
- full accuracy.
- */
-
- if (fabs(x) < 0.7) {
- double u;
- u = exp(x);
- if (u == 1.0)
- return x;
- else
- return (u - 1.0) * x / log(u);
- }
- else
- return exp(x) - 1.0;
-}
-
-/* log1p(x) = log(1+x). The log1p function is designed to avoid the
- significant loss of precision that arises from direct evaluation when x is
- small. */
-
-double
-_pypy_math_log1p(double x)
-{
- /* For x small, we use the following approach. Let y be the nearest float
- to 1+x, then
-
- 1+x = y * (1 - (y-1-x)/y)
-
- so log(1+x) = log(y) + log(1-(y-1-x)/y). Since (y-1-x)/y is tiny, the
- second term is well approximated by (y-1-x)/y. If abs(x) >=
- DBL_EPSILON/2 or the rounding-mode is some form of round-to-nearest
- then y-1-x will be exactly representable, and is computed exactly by
- (y-1)-x.
-
- If abs(x) < DBL_EPSILON/2 and the rounding mode is not known to be
- round-to-nearest then this method is slightly dangerous: 1+x could be
- rounded up to 1+DBL_EPSILON instead of down to 1, and in that case
- y-1-x will not be exactly representable any more and the result can be
- off by many ulps. But this is easily fixed: for a floating-point
- number |x| < DBL_EPSILON/2., the closest floating-point number to
- log(1+x) is exactly x.
- */
-
- double y;
- if (fabs(x) < DBL_EPSILON/2.) {
- return x;
- } else if (-0.5 <= x && x <= 1.) {
- /* WARNING: it's possible than an overeager compiler
- will incorrectly optimize the following two lines
- to the equivalent of "return log(1.+x)". If this
- happens, then results from log1p will be inaccurate
- for small x. */
- y = 1.+x;
- return log(y)-((y-1.)-x)/y;
- } else {
- /* NaNs and infinities should end up here */
- return log(1.+x);
- }
-}
diff --git a/pypy/translator/c/test/test_genc.py b/pypy/translator/c/test/test_genc.py
--- a/pypy/translator/c/test/test_genc.py
+++ b/pypy/translator/c/test/test_genc.py
@@ -272,25 +272,39 @@
res = f1(3)
assert res == 1.5
-def test_nan():
- from pypy.translator.c.primitive import isnan, isinf
+def test_nan_and_special_values():
+ from pypy.rlib.rfloat import isnan, isinf, copysign
inf = 1e300 * 1e300
assert isinf(inf)
nan = inf/inf
assert isnan(nan)
- l = [nan]
- def f():
- return nan
- f1 = compile(f, [])
- res = f1()
- assert isnan(res)
+ for value, checker in [
+ (inf, lambda x: isinf(x) and x > 0.0),
+ (-inf, lambda x: isinf(x) and x < 0.0),
+ (nan, isnan),
+ (0.0, lambda x: not x and copysign(1., x) == 1.),
+ (-0.0, lambda x: not x and copysign(1., x) == -1.),
+ ]:
+ def f():
+ return value
+ f1 = compile(f, [])
+ res = f1()
+ assert checker(res)
- def g(x):
- return l[x]
- g2 = compile(g, [int])
- res = g2(0)
- assert isnan(res)
+ l = [value]
+ def g(x):
+ return l[x]
+ g2 = compile(g, [int])
+ res = g2(0)
+ assert checker(res)
+
+ l2 = [(-value, -value), (value, value)]
+ def h(x):
+ return l2[x][1]
+ h3 = compile(h, [int])
+ res = h3(1)
+ assert checker(res)
def test_prebuilt_instance_with_dict():
class A:
diff --git a/pypy/module/test_lib_pypy/test_distributed/test_distributed.py b/pypy/module/test_lib_pypy/test_distributed/test_distributed.py
--- a/pypy/module/test_lib_pypy/test_distributed/test_distributed.py
+++ b/pypy/module/test_lib_pypy/test_distributed/test_distributed.py
@@ -248,6 +248,7 @@
assert res == 3
def test_remote_sys(self):
+ skip("Fix me some day maybe")
import sys
protocol = self.test_env({'sys':sys})
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/mmap/app_mmap.py b/pypy/module/mmap/app_mmap.py
deleted file mode 100644
--- a/pypy/module/mmap/app_mmap.py
+++ /dev/null
@@ -1,5 +0,0 @@
-ACCESS_READ = 1
-ACCESS_WRITE = 2
-ACCESS_COPY = 3
-
-error = EnvironmentError
diff --git a/pypy/jit/backend/test/test_random.py b/pypy/jit/backend/test/test_random.py
--- a/pypy/jit/backend/test/test_random.py
+++ b/pypy/jit/backend/test/test_random.py
@@ -9,6 +9,7 @@
from pypy.jit.metainterp.resoperation import ResOperation, rop
from pypy.jit.metainterp.executor import execute_nonspec
from pypy.jit.metainterp.resoperation import opname
+from pypy.jit.codewriter import longlong
class PleaseRewriteMe(Exception):
pass
@@ -100,7 +101,8 @@
## 'ConstAddr(llmemory.cast_ptr_to_adr(%s_vtable), cpu)'
## % name)
elif isinstance(v, ConstFloat):
- args.append('ConstFloat(%r)' % v.value)
+ args.append('ConstFloat(longlong.getfloatstorage(%r))'
+ % v.getfloat())
elif isinstance(v, ConstInt):
args.append('ConstInt(%s)' % v.value)
else:
@@ -182,8 +184,8 @@
if hasattr(self.loop, 'inputargs'):
for i, v in enumerate(self.loop.inputargs):
if isinstance(v, (BoxFloat, ConstFloat)):
- print >>s, ' cpu.set_future_value_float(%d, %r)' % (i,
- v.value)
+ print >>s, (' cpu.set_future_value_float(%d,'
+ 'longlong.getfloatstorage(%r))' % (i, v.getfloat()))
else:
print >>s, ' cpu.set_future_value_int(%d, %d)' % (i,
v.value)
@@ -194,8 +196,8 @@
fail_args = self.should_fail_by.getfailargs()
for i, v in enumerate(fail_args):
if isinstance(v, (BoxFloat, ConstFloat)):
- print >>s, (' assert cpu.get_latest_value_float(%d) == %r'
- % (i, v.value))
+ print >>s, (' assert longlong.getrealfloat('
+ 'cpu.get_latest_value_float(%d)) == %r' % (i, v.value))
else:
print >>s, (' assert cpu.get_latest_value_int(%d) == %d'
% (i, v.value))
@@ -244,7 +246,7 @@
elif r.random() < 0.75 or not builder.cpu.supports_floats:
self.put(builder, [ConstInt(r.random_integer())])
else:
- self.put(builder, [ConstFloat(r.random_float())])
+ self.put(builder, [ConstFloat(r.random_float_storage())])
class BinaryOperation(AbstractOperation):
def __init__(self, opnum, and_mask=-1, or_mask=0, boolres=False):
@@ -302,16 +304,16 @@
raise CannotProduceOperation
k = r.random()
if k < 0.18:
- v_first = ConstFloat(r.random_float())
+ v_first = ConstFloat(r.random_float_storage())
else:
v_first = r.choice(builder.floatvars)
if k > 0.82:
- v_second = ConstFloat(r.random_float())
+ v_second = ConstFloat(r.random_float_storage())
else:
v_second = r.choice(builder.floatvars)
- if abs(v_first.value) > 1E100 or abs(v_second.value) > 1E100:
+ if abs(v_first.getfloat()) > 1E100 or abs(v_second.getfloat()) > 1E100:
raise CannotProduceOperation # avoid infinities
- if abs(v_second.value) < 1E-100:
+ if abs(v_second.getfloat()) < 1E-100:
raise CannotProduceOperation # e.g. division by zero error
self.put(builder, [v_first, v_second])
@@ -330,7 +332,7 @@
if not builder.floatvars:
raise CannotProduceOperation
box = r.choice(builder.floatvars)
- if not (-sys.maxint-1 <= box.value <= sys.maxint):
+ if not (-sys.maxint-1 <= box.getfloat() <= sys.maxint):
raise CannotProduceOperation # would give an overflow
self.put(builder, [box])
@@ -480,9 +482,13 @@
if k < 1.0:
x += k
return x
+ def get_random_float_storage():
+ x = get_random_float()
+ return longlong.getfloatstorage(x)
r.random_integer = get_random_integer
r.random_char = get_random_char
r.random_float = get_random_float
+ r.random_float_storage = get_random_float_storage
return r
def get_cpu():
@@ -516,7 +522,7 @@
at_least_once = 0
for i in range(pytest.config.option.n_vars):
if r.random() < k and i != at_least_once:
- startvars.append(BoxFloat(r.random_float()))
+ startvars.append(BoxFloat(r.random_float_storage()))
else:
startvars.append(BoxInt(r.random_integer()))
assert len(dict.fromkeys(startvars)) == len(startvars)
diff --git a/pypy/module/signal/app_signal.py b/pypy/module/signal/app_signal.py
deleted file mode 100644
--- a/pypy/module/signal/app_signal.py
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-def default_int_handler(signum, frame):
- """
- default_int_handler(...)
-
- The default handler for SIGINT installed by Python.
- It raises KeyboardInterrupt.
- """
- raise KeyboardInterrupt()
diff --git a/pypy/module/itertools/test/errors.txt b/pypy/module/itertools/test/errors.txt
deleted file mode 100644
--- a/pypy/module/itertools/test/errors.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-Here are the remaining errors of CPython 2.5's test_itertools. FWIW I
-consider them all as obscure undocumented implementation details.
-
-
-======================================================================
-ERROR: test_islice (__main__.TestBasicOps)
-----------------------------------------------------------------------
-Traceback (most recent call last):
- File "test_itertools.py", line 285, in test_islice
- self.assertRaises(ValueError, islice, xrange(10), 'a')
- File "/home/arigo/pypysrc/lib-python/2.4.1/unittest.py", line 322, in failUnlessRaises
- return
- File "/home/arigo/pypysrc/lib-python/2.4.1/unittest.py", line 320, in failUnlessRaises
- callableObj(*args, **kwargs)
-TypeError: expected integer, got str object
-
-======================================================================
-ERROR: test_tee (__main__.TestBasicOps)
-----------------------------------------------------------------------
-Traceback (most recent call last):
- File "itest25.py", line 376, in test_tee
- c = type(a)('def')
-TypeError: default __new__ takes no parameters
-
-======================================================================
-ERROR: test_repeat (__main__.LengthTransparency)
-----------------------------------------------------------------------
-Traceback (most recent call last):
- File "itest25.py", line 690, in test_repeat
- from test.test_iterlen import len
-ImportError: cannot import name 'len'
-
-======================================================================
-ERROR: test_keywords_in_subclass (__main__.SubclassWithKwargsTest)
-----------------------------------------------------------------------
-Traceback (most recent call last):
- File "itest25.py", line 760, in test_keywords_in_subclass
- class Subclass(cls):
-TypeError: type 'repeat' is not an acceptable base class
-
-======================================================================
-FAIL: test_count (__main__.TestBasicOps)
-----------------------------------------------------------------------
-Traceback (most recent call last):
- File "itest25.py", line 59, in test_count
- self.assertEqual(repr(c), 'count(3)')
-AssertionError: '<count object at 0x08fcdcac>' != 'count(3)'
-
-======================================================================
-FAIL: test_izip (__main__.TestBasicOps)
-----------------------------------------------------------------------
-Traceback (most recent call last):
- File "itest25.py", line 199, in test_izip
- self.assertEqual(min(ids), max(ids))
-AssertionError: 149283404 != 150789644
-
-======================================================================
-FAIL: test_repeat (__main__.TestBasicOps)
-----------------------------------------------------------------------
-Traceback (most recent call last):
- File "itest25.py", line 214, in test_repeat
- self.assertEqual(repr(r), 'repeat((1+0j))')
-AssertionError: '<repeat object at 0x09124a2c>' != 'repeat((1+0j))'
-
-----------------------------------------------------------------------
diff --git a/pypy/module/math/_genmath.py b/pypy/module/math/_genmath.py
deleted file mode 100644
--- a/pypy/module/math/_genmath.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# ONESHOT SCRIPT (probably can go away soon)
-# to generate the mixed module 'math' (see same directory)
-import py
-import math
-import re
-import sys
-rex_arg = re.compile(".*\((.*)\).*")
-
-if __name__ == '__main__':
- print py.code.Source("""
- import math
- from pypy.interpreter.gateway import ObjSpace
-
- """)
- names = []
- for name, func in math.__dict__.items():
- if not callable(func):
- continue
- sig = func.__doc__.split('\n')[0].strip()
- sig = sig.split('->')[0].strip()
- m = rex_arg.match(sig)
- assert m
- args = m.group(1)
- args = ", ".join(args.split(','))
- sig = sig.replace('(', '(space,')
- sig = ", ".join(sig.split(','))
- argc = len(args.split(','))
- unwrap_spec = ['ObjSpace']
- unwrap_spec += ['float'] * argc
- unwrap_spec = ", ".join(unwrap_spec)
- doc = func.__doc__.replace('\n', '\n ')
-
- print py.code.Source('''
- def %(sig)s:
- """%(doc)s
- """
- return space.wrap(math.%(name)s(%(args)s))
- %(name)s.unwrap_spec = [%(unwrap_spec)s]
- ''' % locals())
- names.append(name)
-
- print >>sys.stderr, py.code.Source("""
- # Package initialisation
- from pypy.interpreter.mixedmodule import MixedModule
-
- class Module(MixedModule):
- appleveldefs = {
- }
- interpleveldefs = {
- """)
-
- for name in names:
- space = " " * (15-len(name))
- print >>sys.stderr, (
- " %(name)r%(space)s: 'interp_math.%(name)s'," % locals())
- print >>sys.stderr, py.code.Source("""
- }
- """)
-
-
-
-
diff --git a/pypy/module/zlib/app_zlib.py b/pypy/module/zlib/app_zlib.py
deleted file mode 100644
--- a/pypy/module/zlib/app_zlib.py
+++ /dev/null
@@ -1,11 +0,0 @@
-
-"""
-Application-level definitions for the zlib module.
-
-NOT_RPYTHON
-"""
-
-class error(Exception):
- """
- Raised by zlib operations.
- """
diff --git a/pypy/tool/pytest/appsupport.py b/pypy/tool/pytest/appsupport.py
--- a/pypy/tool/pytest/appsupport.py
+++ b/pypy/tool/pytest/appsupport.py
@@ -176,10 +176,7 @@
w_BuiltinAssertionError = space.getitem(space.builtin.w_dict,
space.wrap('AssertionError'))
w_metaclass = space.type(w_BuiltinAssertionError)
- w_init = space.wrap(gateway.interp2app_temp(my_init,
- unwrap_spec=[gateway.ObjSpace,
- gateway.W_Root,
- gateway.Arguments]))
+ w_init = space.wrap(gateway.interp2app_temp(my_init))
w_dict = space.newdict()
space.setitem(w_dict, space.wrap('__init__'), w_init)
return space.call_function(w_metaclass,
@@ -247,11 +244,7 @@
raise OperationError(space.w_AssertionError,
space.wrap("DID NOT RAISE"))
-app_raises = gateway.interp2app_temp(pypyraises,
- unwrap_spec=[gateway.ObjSpace,
- gateway.W_Root,
- gateway.W_Root,
- gateway.Arguments])
+app_raises = gateway.interp2app_temp(pypyraises)
def pypyskip(space, w_message):
"""skip a test at app-level. """
diff --git a/pypy/module/parser/app_helpers.py b/pypy/module/parser/app_helpers.py
deleted file mode 100644
--- a/pypy/module/parser/app_helpers.py
+++ /dev/null
@@ -1,2 +0,0 @@
-class ParserError(Exception):
- pass
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/select/app_select.py b/pypy/module/select/app_select.py
deleted file mode 100644
--- a/pypy/module/select/app_select.py
+++ /dev/null
@@ -1,2 +0,0 @@
-class error(Exception):
- pass
diff --git a/pypy/objspace/std/test/helper.py b/pypy/objspace/std/test/helper.py
deleted file mode 100644
--- a/pypy/objspace/std/test/helper.py
+++ /dev/null
@@ -1,69 +0,0 @@
-def raises(excp, func, *args):
- try:
- func(*args)
- assert 1 == 0
- except excp:pass
-
-def assertEqual(a, b):
- assert a == b
-
-def assertNotEqual(a, b):
- assert a != b
-
-def assertIs(a, b):
- assert a is b
-
-# complex specific tests
-
-EPS = 1e-9
-
-def assertAlmostEqual(a, b):
- if isinstance(a, complex):
- if isinstance(b, complex):
- assert a.real - b.real < EPS
- assert a.imag - b.imag < EPS
- else:
- assert a.real - b < EPS
- assert a.imag < EPS
- else:
- if isinstance(b, complex):
- assert a - b.real < EPS
- assert b.imag < EPS
- else:
- assert a - b < EPS
-
-def assertCloseAbs(x, y, eps=1e-9):
- """Return true iff floats x and y "are close\""""
- # put the one with larger magnitude second
- if abs(x) > abs(y):
- x, y = y, x
- if y == 0:
- return abs(x) < eps
- if x == 0:
- return abs(y) < eps
- # check that relative difference < eps
- assert abs((x-y)/y) < eps
-
-def assertClose(x, y, eps=1e-9):
- """Return true iff complexes x and y "are close\""""
- assertCloseAbs(x.real, y.real, eps)
- assertCloseAbs(x.imag, y.imag, eps)
-
-
-def check_div(x, y):
- """Compute complex z=x*y, and check that z/x==y and z/y==x."""
- z = x * y
- if x != 0:
- q = z / x
- assertClose(q, y)
- q = z.__div__(x)
- assertClose(q, y)
- q = z.__truediv__(x)
- assertClose(q, y)
- if y != 0:
- q = z / y
- assertClose(q, x)
- q = z.__div__(y)
- assertClose(q, x)
- q = z.__truediv__(y)
- assertClose(q, x)
diff --git a/pypy/module/termios/app_termios.py b/pypy/module/termios/app_termios.py
deleted file mode 100644
--- a/pypy/module/termios/app_termios.py
+++ /dev/null
@@ -1,3 +0,0 @@
-
-class error(Exception):
- pass
diff --git a/pypy/test_all.py b/pypy/test_all.py
--- a/pypy/test_all.py
+++ b/pypy/test_all.py
@@ -1,4 +1,18 @@
#! /usr/bin/env python
+"""
+PyPy Test runner interface
+--------------------------
+
+Running test_all.py is equivalent to running py.test
+(either installed from the py lib package, or from ../py/bin/).
+
+For more information, use test_all.py -h.
+"""
+import sys, os
+
+if len(sys.argv) == 1 and os.path.dirname(sys.argv[0]) in '.':
+ print >> sys.stderr, __doc__
+ sys.exit(2)
if __name__ == '__main__':
import tool.autopath
diff --git a/pypy/module/_ssl/app_ssl.py b/pypy/module/_ssl/app_ssl.py
deleted file mode 100644
--- a/pypy/module/_ssl/app_ssl.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import _socket
-
-class SSLError(_socket.error):
- pass
-
-__doc__ = """Implementation module for SSL socket operations.
-See the socket module for documentation."""
diff --git a/pypy/module/pyexpat/app_pyexpat.py b/pypy/module/pyexpat/app_pyexpat.py
deleted file mode 100644
--- a/pypy/module/pyexpat/app_pyexpat.py
+++ /dev/null
@@ -1,6 +0,0 @@
-class ExpatError(Exception):
- def __init__(self, msg, code, lineno, colno):
- Exception.__init__(self, msg)
- self.code = code
- self.lineno = lineno
- self.colno = colno
diff --git a/lib-python/conftest.py b/lib-python/conftest.py
--- a/lib-python/conftest.py
+++ b/lib-python/conftest.py
@@ -192,7 +192,7 @@
RegrTest('test_dbm.py'),
RegrTest('test_decimal.py'),
RegrTest('test_decorators.py', core=True),
- RegrTest('test_deque.py', core=True),
+ RegrTest('test_deque.py', core=True, usemodules='_collections'),
RegrTest('test_descr.py', core=True, usemodules='_weakref'),
RegrTest('test_descrtut.py', core=True),
RegrTest('test_dict.py', core=True),
@@ -419,7 +419,7 @@
RegrTest('test_sundry.py'),
RegrTest('test_symtable.py', skip="implementation detail"),
RegrTest('test_syntax.py', core=True),
- RegrTest('test_sys.py', core=True),
+ RegrTest('test_sys.py', core=True, usemodules='struct'),
RegrTest('test_sys_settrace.py', core=True),
RegrTest('test_sys_setprofile.py', core=True),
RegrTest('test_sysconfig.py'),
@@ -495,8 +495,8 @@
RegrTest('test_coding.py'),
RegrTest('test_complex_args.py'),
RegrTest('test_contextlib.py', usemodules="thread"),
- RegrTest('test_ctypes.py', usemodules="_rawffi"),
- RegrTest('test_defaultdict.py'),
+ RegrTest('test_ctypes.py', usemodules="_rawffi thread"),
+ RegrTest('test_defaultdict.py', usemodules='_collections'),
RegrTest('test_email_renamed.py'),
RegrTest('test_exception_variations.py'),
RegrTest('test_float.py'),
@@ -516,8 +516,8 @@
RegrTest('test_with.py'),
RegrTest('test_wsgiref.py'),
RegrTest('test_xdrlib.py'),
- RegrTest('test_xml_etree.py', skip="unsupported ext module"),
- RegrTest('test_xml_etree_c.py', skip="unsupported ext module"),
+ RegrTest('test_xml_etree.py'),
+ RegrTest('test_xml_etree_c.py'),
RegrTest('test_zipfile64.py'),
]
@@ -672,6 +672,8 @@
cmd += ' --pdb'
if self.config.option.capture == 'no':
status = os.system(cmd)
+ stdout.write('')
+ stderr.write('')
else:
status = os.system("%s >>%s 2>>%s" %(cmd, stdout, stderr))
if os.WIFEXITED(status):
@@ -690,8 +692,10 @@
if test_stderr.rfind(26*"=" + "skipped" + 26*"=") != -1:
skipped = True
outcome = 'OK'
- if not exit_status:
- if 'FAIL' in test_stdout or re.search('[^:]ERROR', test_stderr):
+ if not exit_status:
+ # match "FAIL" but not e.g. "FAILURE", which is in the output of a
+ # test in test_zipimport_support.py
+ if re.search(r'\bFAIL\b', test_stdout) or re.search('[^:]ERROR', test_stderr):
outcome = 'FAIL'
exit_status = 2
elif timedout:
diff --git a/pypy/module/cpyext/include/modsupport.inl b/pypy/module/cpyext/include/modsupport.inl
deleted file mode 100644
--- a/pypy/module/cpyext/include/modsupport.inl
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- C -*- */
-/* Module support interface */
-
-#ifndef Py_MODSUPPORT_INL
-#define Py_MODSUPPORT_INL
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef PYPY_STANDALONE
-/* XXX1 On translation, forwarddecl.h is included after this file */
-/* XXX2 genc.py transforms "const char*" into "char*" */
-extern PyObject *_Py_InitPyPyModule(char *, PyMethodDef *, char *, PyObject *, int);
-#endif
-
-Py_LOCAL_INLINE(PyObject *) Py_InitModule4(
- const char* name, PyMethodDef* methods,
- const char* doc, PyObject *self,
- int api_version)
-{
- return _Py_InitPyPyModule((char*)name, methods,
- (char*)doc, self,
- api_version);
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !Py_MODSUPPORT_INL */
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/module/binascii/app_binascii.py b/pypy/module/binascii/app_binascii.py
deleted file mode 100644
--- a/pypy/module/binascii/app_binascii.py
+++ /dev/null
@@ -1,6 +0,0 @@
-
-class Error(Exception):
- pass
-
-class Incomplete(Exception):
- pass
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/zipimport/app_zipimport.py b/pypy/module/zipimport/app_zipimport.py
deleted file mode 100644
--- a/pypy/module/zipimport/app_zipimport.py
+++ /dev/null
@@ -1,4 +0,0 @@
-
-class ZipImportError(ImportError):
- pass
-
diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -155,7 +155,7 @@
def str_w(self, w_str):
return w_str
- def newdict(self):
+ def newdict(self, module=None):
return {}
def newtuple(self, iterable):
More information about the Pypy-commit
mailing list