[pypy-commit] pypy default: fix error message

2018-09-23 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r95156:3c6307e2bd64
Date: 2018-09-23 13:07 +0200
http://bitbucket.org/pypy/pypy/changeset/3c6307e2bd64/

Log:fix error message

diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -151,7 +151,7 @@
 if getattr(func, '_elidable_function_', False):
 raise TypeError("it does not make sense for %s to be both elidable and 
unroll_safe" % func)
 if not getattr(func, '_jit_look_inside_', True):
-raise TypeError("it does not make sense for %s to be both elidable and 
dont_look_inside" % func)
+raise TypeError("it does not make sense for %s to be both unroll_safe 
and dont_look_inside" % func)
 func._jit_unroll_safe_ = True
 return func
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix error message to not contain the internal name 'bigint'

2017-08-04 Thread cfbolz
Author: Carl Friedrich Bolz 
Branch: 
Changeset: r92070:76adf2cfc536
Date: 2017-08-04 12:22 +0200
http://bitbucket.org/pypy/pypy/changeset/76adf2cfc536/

Log:fix error message to not contain the internal name 'bigint'

diff --git a/pypy/module/array/interp_array.py 
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -769,7 +769,9 @@
 
 class TypeCode(object):
 def __init__(self, itemtype, unwrap, canoverflow=False, signed=False,
- method='__int__'):
+ method='__int__', errorname=None):
+if errorname is None:
+errorname = unwrap[:-2]
 self.itemtype = itemtype
 self.bytes = rffi.sizeof(itemtype)
 self.arraytype = lltype.Array(itemtype, hints={'nolength': True})
@@ -779,6 +781,7 @@
 self.canoverflow = canoverflow
 self.w_class = None
 self.method = method
+self.errorname = errorname
 
 def _freeze_(self):
 # hint for the annotator: track individual constant instances
@@ -802,8 +805,8 @@
 'i': TypeCode(rffi.INT,   'int_w', True, True),
 'I': _UINTTypeCode,
 'l': TypeCode(rffi.LONG,  'int_w', True, True),
-'L': TypeCode(rffi.ULONG, 'bigint_w'),  # Overflow handled by
-# rbigint.touint() which
+'L': TypeCode(rffi.ULONG, 'bigint_w',   # Overflow handled by
+  errorname="integer"), # rbigint.touint() which
 # corresponds to the
 # C-type unsigned long
 'f': TypeCode(lltype.SingleFloat, 'float_w', method='__float__'),
@@ -881,7 +884,7 @@
 item = unwrap(space.call_method(w_item, mytype.method))
 except OperationError:
 raise oefmt(space.w_TypeError,
-"array item must be " + mytype.unwrap[:-2])
+"array item must be " + mytype.errorname)
 else:
 raise
 if mytype.unwrap == 'bigint_w':
diff --git a/pypy/module/array/test/test_array.py 
b/pypy/module/array/test/test_array.py
--- a/pypy/module/array/test/test_array.py
+++ b/pypy/module/array/test/test_array.py
@@ -162,6 +162,11 @@
 raises(OverflowError, a.append, -1)
 raises(OverflowError, a.append, 2 ** (8 * b))
 
+def test_errormessage(self):
+a = self.array("L", [1, 2, 3])
+excinfo = raises(TypeError, "a[0] = 'abc'")
+assert str(excinfo.value) == "array item must be integer"
+
 def test_fromstring(self):
 import sys
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix error message

2017-01-25 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r89774:20567a253f17
Date: 2017-01-25 21:56 +0100
http://bitbucket.org/pypy/pypy/changeset/20567a253f17/

Log:fix error message

diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -307,8 +307,8 @@
 if config.objspace.usemodules.cpyext:
 if config.translation.gc not in ('incminimark', 'boehm'):
 raise Exception("The 'cpyext' module requires the 
'incminimark'"
-" 'boehm' GC.  You need either 
'targetpypystandalone.py"
-" --withoutmod-cpyext' or '--gc=incminimark'")
+" or 'boehm' GC.  You need either 'targetpypystandalone.py"
+" --withoutmod-cpyext', or use one of these two GCs.")
 
 config.translating = True
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix error message

2016-05-01 Thread pjenvey
Author: Philip Jenvey 
Branch: 
Changeset: r84113:ad27d9cf6f2d
Date: 2016-05-01 21:42 -0700
http://bitbucket.org/pypy/pypy/changeset/ad27d9cf6f2d/

Log:fix error message

diff --git a/pypy/module/cppyy/interp_cppyy.py 
b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -436,7 +436,7 @@
 s = capi.c_resolve_name(self.space, s)
 if s != self.templ_args[i]:
 raise OperationError(self.space.w_TypeError, self.space.wrap(
-"non-matching template (got %s where %s expected" % (s, 
self.templ_args[i])))
+"non-matching template (got %s where %s expected)" % (s, 
self.templ_args[i])))
 return W_CPPBoundMethod(cppthis, self)
 
 def bound_call(self, cppthis, args_w):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix error message

2015-01-11 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: 
Changeset: r75299:230d81716c11
Date: 2015-01-11 22:56 +0100
http://bitbucket.org/pypy/pypy/changeset/230d81716c11/

Log:fix error message

diff --git a/pypy/module/_cffi_backend/func.py 
b/pypy/module/_cffi_backend/func.py
--- a/pypy/module/_cffi_backend/func.py
+++ b/pypy/module/_cffi_backend/func.py
@@ -55,7 +55,13 @@
 except OperationError, e:
 if not e.match(space, space.w_TypeError):
 raise
-index = space.int_w(w_field_or_index)
+try:
+index = space.int_w(w_field_or_index)
+except OperationError, e:
+if not e.match(space, space.w_TypeError):
+raise
+raise OperationError(space.w_TypeError,
+space.wrap(field name or array index expected))
 ctype, offset = w_ctype.typeoffsetof_index(index)
 else:
 ctype, offset = w_ctype.typeoffsetof_field(fieldname, following)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fix error message

2012-09-25 Thread arigo
Author: Armin Rigo ar...@tunes.org
Branch: 
Changeset: r57548:e31552c35f5e
Date: 2012-09-25 09:54 +0200
http://bitbucket.org/pypy/pypy/changeset/e31552c35f5e/

Log:Fix error message

diff --git a/pypy/module/_cffi_backend/ctypefunc.py 
b/pypy/module/_cffi_backend/ctypefunc.py
--- a/pypy/module/_cffi_backend/ctypefunc.py
+++ b/pypy/module/_cffi_backend/ctypefunc.py
@@ -286,8 +286,8 @@
 for i, cf in enumerate(ctype.fields_list):
 if cf.is_bitfield():
 raise OperationError(space.w_NotImplementedError,
-space.wrap(cannot pass as argument a struct 
-   with bit fields))
+space.wrap(cannot pass as argument or return value 
+   a struct with bit fields))
 ffi_subtype = self.fb_fill_type(cf.ctype, False)
 if elements:
 elements[i] = ffi_subtype
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit