Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r66167:8dc61b6df4f4 Date: 2013-08-15 12:05 -0700 http://bitbucket.org/pypy/pypy/changeset/8dc61b6df4f4/
Log: merge default diff --git a/pypy/doc/cppyy.rst b/pypy/doc/cppyy.rst --- a/pypy/doc/cppyy.rst +++ b/pypy/doc/cppyy.rst @@ -83,7 +83,7 @@ the selection of scientific software) will also work for a build with the builtin backend. -.. _`download`: http://cern.ch/wlav/reflex-2013-04-23.tar.bz2 +.. _`download`: http://cern.ch/wlav/reflex-2013-08-14.tar.bz2 .. _`ROOT`: http://root.cern.ch/ Besides Reflex, you probably need a version of `gccxml`_ installed, which is @@ -98,8 +98,8 @@ To install the standalone version of Reflex, after download:: - $ tar jxf reflex-2013-04-23.tar.bz2 - $ cd reflex-2013-04-23 + $ tar jxf reflex-2013-08-14.tar.bz2 + $ cd reflex-2013-08-14 $ ./build/autogen $ ./configure <usual set of options such as --prefix> $ make && make install diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py --- a/pypy/interpreter/app_main.py +++ b/pypy/interpreter/app_main.py @@ -114,13 +114,12 @@ except BaseException as e: try: stderr = sys.stderr - except AttributeError: - pass # too bad - else: print('Error calling sys.excepthook:', file=stderr) originalexcepthook(type(e), e, e.__traceback__) print(file=stderr) print('Original exception was:', file=stderr) + except: + pass # too bad # we only get here if sys.excepthook didn't do its job originalexcepthook(etype, evalue, etraceback) 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 @@ -856,6 +856,69 @@ assert l assert l[0] is None or len(l[0]) == 0 + def test_assign_object_with_special_methods(self): + from array import array + + class Num(object): + def __float__(self): + return 5.25 + + def __int__(self): + return 7 + + class NotNum(object): + pass + + class Silly(object): + def __float__(self): + return None + + def __int__(self): + return None + + class OldNum: + def __float__(self): + return 6.25 + + def __int__(self): + return 8 + + class OldNotNum: + pass + + class OldSilly: + def __float__(self): + return None + + def __int__(self): + return None + + for tc in 'bBhHiIlL': + a = array(tc, [0]) + raises(TypeError, a.__setitem__, 0, 1.0) + a[0] = 1 + a[0] = Num() + assert a[0] == 7 + raises(TypeError, a.__setitem__, NotNum()) + a[0] = OldNum() + assert a[0] == 8 + raises(TypeError, a.__setitem__, OldNotNum()) + raises(TypeError, a.__setitem__, Silly()) + raises(TypeError, a.__setitem__, OldSilly()) + + for tc in 'fd': + a = array(tc, [0]) + a[0] = 1.0 + a[0] = 1 + a[0] = Num() + assert a[0] == 5.25 + raises(TypeError, a.__setitem__, NotNum()) + a[0] = OldNum() + assert a[0] == 6.25 + raises(TypeError, a.__setitem__, OldNotNum()) + raises(TypeError, a.__setitem__, Silly()) + raises(TypeError, a.__setitem__, OldSilly()) + def test_bytearray(self): a = self.array('u', 'hi') b = self.array('u') diff --git a/pypy/module/cppyy/genreflex-methptrgetter.patch b/pypy/module/cppyy/genreflex-methptrgetter.patch --- a/pypy/module/cppyy/genreflex-methptrgetter.patch +++ b/pypy/module/cppyy/genreflex-methptrgetter.patch @@ -10,7 +10,7 @@ # The next is to avoid a known problem with gccxml that it generates a # references to id equal '_0' which is not defined anywhere self.xref['_0'] = {'elem':'Unknown', 'attrs':{'id':'_0','name':''}, 'subelems':[]} -@@ -1306,6 +1307,8 @@ +@@ -1328,6 +1329,8 @@ bases = self.getBases( attrs['id'] ) if inner and attrs.has_key('demangled') and self.isUnnamedType(attrs['demangled']) : cls = attrs['demangled'] @@ -19,7 +19,7 @@ clt = '' else: cls = self.genTypeName(attrs['id'],const=True,colon=True) -@@ -1343,7 +1346,7 @@ +@@ -1365,7 +1368,7 @@ # Inner class/struct/union/enum. for m in memList : member = self.xref[m] @@ -28,7 +28,7 @@ and member['attrs'].get('access') in ('private','protected') \ and not self.isUnnamedType(member['attrs'].get('demangled')): cmem = self.genTypeName(member['attrs']['id'],const=True,colon=True) -@@ -1981,8 +1984,15 @@ +@@ -2003,8 +2006,15 @@ else : params = '0' s = ' .AddFunctionMember(%s, Reflex::Literal("%s"), %s%s, 0, %s, %s)' % (self.genTypeID(id), name, type, id, params, mod) s += self.genCommentProperty(attrs) @@ -44,7 +44,7 @@ def genMCODef(self, type, name, attrs, args): id = attrs['id'] cl = self.genTypeName(attrs['context'],colon=True) -@@ -2049,8 +2059,44 @@ +@@ -2071,8 +2081,44 @@ if returns == 'void' : body += ' }\n' else : body += ' }\n' body += '}\n' @@ -105,17 +105,16 @@ -h, --help Print this help\n """ -@@ -127,7 +131,8 @@ - opts, args = getopt.getopt(options, 'ho:s:c:I:U:D:PC', \ +@@ -128,7 +132,7 @@ ['help','debug=', 'output=','selection_file=','pool','dataonly','interpreteronly','deep','gccxmlpath=', 'capabilities=','rootmap=','rootmap-lib=','comments','iocomments','no_membertypedefs', -- 'fail_on_warnings', 'quiet', 'gccxmlopt=', 'reflex', 'split=','no_templatetypedefs','gccxmlpost=']) -+ 'fail_on_warnings', 'quiet', 'gccxmlopt=', 'reflex', 'split=','no_templatetypedefs','gccxmlpost=', -+ 'with-methptrgetter']) + 'fail_on_warnings', 'quiet', 'gccxmlopt=', 'reflex', 'split=','no_templatetypedefs','gccxmlpost=', +- 'library=']) ++ 'library=', 'with-methptrgetter']) except getopt.GetoptError, e: print "--->> genreflex: ERROR:",e self.usage(2) -@@ -186,6 +191,8 @@ +@@ -187,6 +191,8 @@ self.rootmap = a if o in ('--rootmap-lib',): self.rootmaplib = a diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py --- a/pypy/module/micronumpy/test/test_complex.py +++ b/pypy/module/micronumpy/test/test_complex.py @@ -685,3 +685,8 @@ msg=error_message) sys.stderr.write('.') sys.stderr.write('\n') + + def test_complexbox_to_pycomplex(self): + from numpypy import complex128 + x = complex128(3.4j) + assert complex(x) == 3.4j diff --git a/pypy/objspace/std/complextype.py b/pypy/objspace/std/complextype.py --- a/pypy/objspace/std/complextype.py +++ b/pypy/objspace/std/complextype.py @@ -194,7 +194,7 @@ if w_z is not None: # __complex__() must return a complex or (float,int,long) object # (XXX should not use isinstance here) - if not strict_typing and (space.isinstance_w(w_z, space.w_int) or + if not strict_typing and (space.isinstance_w(w_z, space.w_int) or space.isinstance_w(w_z, space.w_float)): return (space.float_w(w_z), 0.0) elif isinstance(w_z, W_ComplexObject): @@ -206,8 +206,10 @@ # # no '__complex__' method, so we assume it is a float, # unless it is an instance of some subclass of complex. - if isinstance(w_complex, W_ComplexObject): - return (w_complex.realval, w_complex.imagval) + if space.isinstance_w(w_complex, space.gettypefor(W_ComplexObject)): + real = space.float(space.getattr(w_complex, space.wrap("real"))) + imag = space.float(space.getattr(w_complex, space.wrap("imag"))) + return (space.float_w(real), space.float_w(imag)) # # Check that it is not a string (on which space.float() would succeed). if (space.isinstance_w(w_complex, space.w_str) or diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py --- a/pypy/tool/jitlogparser/parser.py +++ b/pypy/tool/jitlogparser/parser.py @@ -382,7 +382,7 @@ from rpython.jit.backend.tool.viewcode import World world = World() for entry in extract_category(log, 'jit-backend-dump'): - world.parse(entry.splitlines(True), truncate_addr=False) + world.parse(entry.splitlines(True)) dumps = {} for r in world.ranges: if r.addr in addrs and addrs[r.addr]: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit