[pypy-commit] pypy default: fix translation (why does the same code work on py3.6?)
Author: Carl Friedrich Bolz-Tereick Branch: Changeset: r98686:57362e78ee31 Date: 2020-02-08 13:31 +0100 http://bitbucket.org/pypy/pypy/changeset/57362e78ee31/ Log:fix translation (why does the same code work on py3.6?) diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -131,7 +131,7 @@ def listview_ascii(self): if self.is_ascii(): -return list(self._utf8) +return _create_list_from_unicode(self._utf8) return None def ord(self, space): @@ -1808,6 +1808,10 @@ ) W_UnicodeObject.typedef.flag_sequence_bug_compat = True +def _create_list_from_unicode(value): +# need this helper function to allow the jit to look inside and inline +# listview_ascii +return [s for s in value] W_UnicodeObject.EMPTY = W_UnicodeObject('', 0) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation, tweak output
Author: Carl Friedrich Bolz-Tereick Branch: Changeset: r97761:c866b476cfee Date: 2019-10-11 10:43 +0200 http://bitbucket.org/pypy/pypy/changeset/c866b476cfee/ Log:fix translation, tweak output diff --git a/rpython/jit/metainterp/quasiimmut.py b/rpython/jit/metainterp/quasiimmut.py --- a/rpython/jit/metainterp/quasiimmut.py +++ b/rpython/jit/metainterp/quasiimmut.py @@ -27,12 +27,14 @@ return qmut def make_invalidation_function(STRUCT, mutatefieldname): -# +# fake a repr +descr_repr = "FieldDescr(%s, '%s')" % (STRUCT.TO, mutatefieldname) + def _invalidate_now(p): qmut_ptr = getattr(p, mutatefieldname) setattr(p, mutatefieldname, lltype.nullptr(rclass.OBJECT)) qmut = cast_base_ptr_to_instance(QuasiImmut, qmut_ptr) -qmut.invalidate(mutatefieldname) +qmut.invalidate(descr_repr) _invalidate_now._dont_inline_ = True # def invalidation(p): @@ -46,7 +48,7 @@ if qmut_ref: cpu.bh_setfield_gc_r(p, ConstPtr.value, mutatefielddescr) qmut = cast_gcref_to_instance(QuasiImmut, qmut_ref) -qmut.invalidate(mutatefielddescr.fieldname) +qmut.invalidate(mutatefielddescr.repr_of_descr()) class QuasiImmut(object): @@ -79,7 +81,7 @@ # already invalidated; see below self.compress_limit = (len(self.looptokens_wrefs) + 15) * 2 -def invalidate(self, fieldname=None): +def invalidate(self, descr_repr=None): debug_start("jit-invalidate-quasi-immutable") # When this is called, all the loops that we record become # invalid: all GUARD_NOT_INVALIDATED in these loops (and @@ -104,7 +106,7 @@ if not we_are_translated(): self.cpu.stats.invalidated_token_numbers.add( looptoken.number) -debug_print("fieldname", fieldname or "", "invalidated", invalidated) +debug_print("fieldname", descr_repr or "", "invalidated", invalidated) debug_stop("jit-invalidate-quasi-immutable") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Carl Friedrich Bolz-Tereick Branch: Changeset: r97460:ba849ddc5eaf Date: 2019-09-12 15:50 +0200 http://bitbucket.org/pypy/pypy/changeset/ba849ddc5eaf/ Log:fix translation diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py --- a/pypy/module/_io/interp_textio.py +++ b/pypy/module/_io/interp_textio.py @@ -433,7 +433,10 @@ end = len(self.text) else: end = self.pos + limit -pos = self.text.find(marker, self.pos, end) +pos = self.pos +assert pos >= 0 +assert end >= 0 +pos = self.text.find(marker, pos, end) if pos >= 0: self.pos = self.upos = pos + 1 return True ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation on arm
Author: Armin Rigo Branch: Changeset: r96810:c82849260828 Date: 2019-06-17 10:27 +0200 http://bitbucket.org/pypy/pypy/changeset/c82849260828/ Log:fix translation on arm diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py --- a/rpython/jit/backend/arm/opassembler.py +++ b/rpython/jit/backend/arm/opassembler.py @@ -835,8 +835,9 @@ assert 0 def emit_op_load_effective_address(self, op, arglocs, regalloc, fcond): -self._gen_address(arglocs[4], arglocs[0], arglocs[1], arglocs[3].value, - arglocs[2].value) +static_ofs = op.getarg(2).getint() +scale = op.getarg(3).getint() +self._gen_address(arglocs[2], arglocs[0], arglocs[1], scale, static_ofs) return fcond # result = base_loc + (scaled_loc << scale) + static_offset diff --git a/rpython/jit/backend/arm/regalloc.py b/rpython/jit/backend/arm/regalloc.py --- a/rpython/jit/backend/arm/regalloc.py +++ b/rpython/jit/backend/arm/regalloc.py @@ -902,7 +902,7 @@ arg0 = self.make_sure_var_in_reg(args[0], args) arg1 = self.make_sure_var_in_reg(args[1], args) res = self.force_allocate_reg(op) -return [arg0, arg1, args[2], args[3], res] +return [arg0, arg1, res] def prepare_op_call_malloc_nursery(self, op, fcond): size_box = op.getarg(0) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation for MSVC which doesn't like void* arithmetic
Author: Matti Picus Branch: Changeset: r96592:d4c7063c42e8 Date: 2019-05-10 06:14 -0700 http://bitbucket.org/pypy/pypy/changeset/d4c7063c42e8/ Log:fix translation for MSVC which doesn't like void* arithmetic diff --git a/rpython/translator/c/gc.py b/rpython/translator/c/gc.py --- a/rpython/translator/c/gc.py +++ b/rpython/translator/c/gc.py @@ -461,10 +461,10 @@ raise Exception("gc_pop_roots should be removed by postprocess_graph") def OP_GC_ENTER_ROOTS_FRAME(self, funcgen, op): -return '%s += sizeof(pypy_ss_t);' % (funcgen.gcpol_ss,) +return '(char *)(%s) += sizeof(pypy_ss_t);' % (funcgen.gcpol_ss,) def OP_GC_LEAVE_ROOTS_FRAME(self, funcgen, op): -return '%s -= sizeof(pypy_ss_t);' % (funcgen.gcpol_ss,) +return 'char *)(%s) -= sizeof(pypy_ss_t);' % (funcgen.gcpol_ss,) def OP_GC_SAVE_ROOT(self, funcgen, op): num = op.args[0].value ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r95257:e32a30711384 Date: 2018-10-27 22:34 +0300 http://bitbucket.org/pypy/pypy/changeset/e32a30711384/ Log:fix translation diff --git a/pypy/module/thread/os_lock.py b/pypy/module/thread/os_lock.py --- a/pypy/module/thread/os_lock.py +++ b/pypy/module/thread/os_lock.py @@ -195,7 +195,7 @@ w_owner = space.getitem(self.w_active, space.newint(self.rlock_owner)) w_name = space.getattr(w_owner, space.newtext('name')) -owner = space.str_w(space.repr(w_name)) +owner = space.text_w(space.repr(w_name)) except OperationError as e: if e.async(space): raise ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r94834:b42a5efd4312 Date: 2018-07-08 17:58 -0700 http://bitbucket.org/pypy/pypy/changeset/b42a5efd4312/ Log:fix translation 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 @@ -510,7 +510,7 @@ not space.is_w(w_obj, space.w_None) or space.is_w(w_cls, space.type(space.w_None))) if asking_for_bound: -return MethodWithProps(space, self, w_obj) +return MethodWithProps(space, self, w_obj, w_cls) else: return self # unbound methods don't exist in Python 3, return self @@ -626,7 +626,7 @@ # onto a class and w_this should be set cppinstance = self.space.interp_w(W_CPPInstance, w_obj) if cppinstance.clsdecl.handle != self.scope.handle: -return MethodWithProps(self.space, self, w_obj)# bound +return MethodWithProps(self.space, self, w_obj, w_cls)# bound return self # unbound @unwrap_spec(args_w='args_w') diff --git a/pypy/module/cpyext/cdatetime.py b/pypy/module/cpyext/cdatetime.py --- a/pypy/module/cpyext/cdatetime.py +++ b/pypy/module/cpyext/cdatetime.py @@ -135,6 +135,7 @@ '''Fills a newly allocated py_obj from the w_obj If it is a datetime.time or datetime.datetime, it may have tzinfo ''' +assert len(datetimeAPI_global) > 0 if datetimeAPI_global[0].c_TimeType == py_obj.c_ob_type: py_datetime = rffi.cast(PyDateTime_Time, py_obj) w_tzinfo = space.getattr(w_obj, space.newtext('tzinfo')) @@ -158,6 +159,7 @@ @slot_function([PyObject], lltype.Void) def type_dealloc(space, py_obj): from pypy.module.cpyext.object import _dealloc +assert len(datetimeAPI_global) > 0 if datetimeAPI_global[0].c_TimeType == py_obj.c_ob_type: py_datetime = rffi.cast(PyDateTime_Time, py_obj) if (widen(py_datetime.c_hastzinfo) != 0): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r94779:5eb961f7541c Date: 2018-06-25 14:50 -0700 http://bitbucket.org/pypy/pypy/changeset/5eb961f7541c/ Log:fix translation diff --git a/pypy/module/cpyext/longobject.py b/pypy/module/cpyext/longobject.py --- a/pypy/module/cpyext/longobject.py +++ b/pypy/module/cpyext/longobject.py @@ -133,7 +133,7 @@ overflow_ptr[0] = rffi.cast(rffi.INT_real, -1) return -1 -@cpython_api([PyObject, rffi.CArrayPtr(rffi.INT_real)], rffi.LONGLONG, +@cpython_api([PyObject, INTP_real], rffi.LONGLONG, error=-1) def PyLong_AsLongLongAndOverflow(space, w_long, overflow_ptr): """ diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py --- a/pypy/module/cpyext/object.py +++ b/pypy/module/cpyext/object.py @@ -228,7 +228,7 @@ comparison is returned in result. Returns -1 on failure. This is the equivalent of the Python statement result = cmp(o1, o2).""" res = space.int_w(space.cmp(w_o1, w_o2)) -result[0] = rffi.cast(rffi.INT, res) +result[0] = rffi.cast(rffi.INT_real, res) return 0 @cpython_api([PyObject, PyObject, rffi.INT_real], PyObject) diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py --- a/pypy/module/cpyext/pystrtod.py +++ b/pypy/module/cpyext/pystrtod.py @@ -114,7 +114,7 @@ buffer, rtype = rfloat.double_to_string(val, format_code, intmask(precision), intmask(flags)) -if ptype != lltype.nullptr(rffi.INTP.TO): -ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype]) +if ptype != lltype.nullptr(INTP_real.TO): +ptype[0] = rffi.cast(rffi.INT_real, DOUBLE_TO_STRING_TYPES_MAP[rtype]) bufp = rffi.str2charp(buffer) return bufp diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py --- a/pypy/module/cpyext/unicodeobject.py +++ b/pypy/module/cpyext/unicodeobject.py @@ -576,7 +576,7 @@ None, # errorhandler byteorder) if pbyteorder is not None: -pbyteorder[0] = rffi.cast(rffi.INT, byteorder) +pbyteorder[0] = rffi.cast(rffi.INT_real, byteorder) return space.newunicode(result) @@ -632,7 +632,7 @@ None, # errorhandler byteorder) if pbyteorder is not None: -pbyteorder[0] = rffi.cast(rffi.INT, byteorder) +pbyteorder[0] = rffi.cast(rffi.INT_real, byteorder) return space.newunicode(result) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation, hopefully
Author: Carl Friedrich Bolz-Tereick Branch: Changeset: r94197:6b7d3a98a2ba Date: 2018-03-31 12:58 +0200 http://bitbucket.org/pypy/pypy/changeset/6b7d3a98a2ba/ Log:fix translation, hopefully diff --git a/pypy/module/pypyjit/interp_resop.py b/pypy/module/pypyjit/interp_resop.py --- a/pypy/module/pypyjit/interp_resop.py +++ b/pypy/module/pypyjit/interp_resop.py @@ -113,14 +113,14 @@ ofs = ops_offset.get(op, 0) num = op.getopnum() name = op.getopname() -repr = logops.repr_of_resop(op) +repr_op = logops.repr_of_resop(op) if num == rop.DEBUG_MERGE_POINT: jd_sd = jitdrivers_sd[op.getarg(0).getint()] greenkey = op.getarglist()[3:] repr = jd_sd.warmstate.get_location_str(greenkey) w_greenkey = wrap_greenkey(space, jd_sd.jitdriver, greenkey, repr) l_w.append(DebugMergePoint(space, name, - repr, + repr_op, jd_sd.jitdriver.name, op.getarg(1).getint(), op.getarg(2).getint(), @@ -131,9 +131,9 @@ hash = op.getdescr().get_jitcounter_hash() else: hash = -1 -l_w.append(GuardOp(name, ofs, repr, hash)) +l_w.append(GuardOp(name, ofs, repr_op, hash)) else: -l_w.append(WrappedOp(name, ofs, repr)) +l_w.append(WrappedOp(name, ofs, repr_op)) return l_w @unwrap_spec(offset=int, repr='text', name='text') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Ronan Lamy Branch: Changeset: r93851:fc072d7375a3 Date: 2018-02-21 04:09 + http://bitbucket.org/pypy/pypy/changeset/fc072d7375a3/ Log:fix translation diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -442,9 +442,9 @@ return SLOTS[key] except KeyError: slot_func = SLOT_FACTORIES[name](space, typedef, name, method_name) -llfunc = llslot(space, slot_func) if slot_func else None -SLOTS[key] = llfunc -return llfunc +api_func = slot_func.api_func if slot_func else None +SLOTS[key] = api_func +return api_func def make_unary_slot(space, typedef, name, attr): diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py --- a/pypy/module/cpyext/typeobject.py +++ b/pypy/module/cpyext/typeobject.py @@ -265,10 +265,11 @@ def update_all_slots_builtin(space, w_type, pto): typedef = w_type.layout.typedef for method_name, slot_name, slot_names, slot_apifunc in slotdefs_for_tp_slots: -slot_llfunc = get_slot_tp_function(space, typedef, slot_name, method_name) -if not slot_llfunc: +slot_apifunc = get_slot_tp_function(space, typedef, slot_name, method_name) +if not slot_apifunc: warn_missing_slot(space, method_name, slot_name, w_type) continue +slot_llfunc = slot_apifunc.get_llhelper(space) fill_slot(space, pto, w_type, slot_names, slot_llfunc) @specialize.arg(3) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation, cleanup
Author: Matti Picus Branch: Changeset: r93793:8b069fa659af Date: 2018-02-09 16:28 -0500 http://bitbucket.org/pypy/pypy/changeset/8b069fa659af/ Log:fix translation, cleanup diff --git a/rpython/memory/gctypelayout.py b/rpython/memory/gctypelayout.py --- a/rpython/memory/gctypelayout.py +++ b/rpython/memory/gctypelayout.py @@ -97,7 +97,7 @@ def q_destructor_or_custom_trace(self, typeid): if not self.get(typeid).customdata: -return lltype.nullptr(GCData.CUSTOM_DATA_STRUCT) +return lltype.nullptr(GCData.CUSTOM_FUNC_PTR.TO) return self.get(typeid).customdata.customfunc def q_is_old_style_finalizer(self, typeid): diff --git a/rpython/translator/c/test/test_newgc.py b/rpython/translator/c/test/test_newgc.py --- a/rpython/translator/c/test/test_newgc.py +++ b/rpython/translator/c/test/test_newgc.py @@ -573,7 +573,7 @@ return compute_hash(x) for size in ([random.randrange(0, 260) for i in range(10)] + [random.randrange(260, 6)]): -print 'PREBUILT DICTIONARY OF SIZE', size +#print 'PREBUILT DICTIONARY OF SIZE', size keys = [X() for j in range(size)] d = r_dict(keq, khash) for j in range(size): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation
Author: Ronan Lamy Branch: Changeset: r92546:d56dadcef996 Date: 2017-10-02 01:52 +0200 http://bitbucket.org/pypy/pypy/changeset/d56dadcef996/ Log:Fix translation diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -776,7 +776,7 @@ def __init__(self, method_name, slot_name, function, wrapper1, wrapper2, doc): self.method_name = method_name self.slot_name = slot_name -self.slot_names = ("c_" + slot_name).split(".") +self.slot_names = tuple(("c_" + slot_name).split(".")) self.slot_func = function self.wrapper_func = wrapper1 self.wrapper_func_kwds = wrapper2 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r91356:c971f0f22925 Date: 2017-05-20 23:45 +0300 http://bitbucket.org/pypy/pypy/changeset/c971f0f22925/ Log:fix translation diff --git a/pypy/module/cpyext/listobject.py b/pypy/module/cpyext/listobject.py --- a/pypy/module/cpyext/listobject.py +++ b/pypy/module/cpyext/listobject.py @@ -27,7 +27,6 @@ @always_inline def get_list_storage(space, w_list): from pypy.module.cpyext.sequence import CPyListStrategy -assert isinstance(w_list, W_ListObject) w_list.convert_to_cpy_strategy(space) return CPyListStrategy.unerase(w_list.lstorage) @@ -40,6 +39,7 @@ discard a reference to any item that it being replaced; any reference in list at position i will be leaked. """ +assert isinstance(w_list, W_ListObject) storage = get_list_storage(space, w_list) assert 0 <= index < w_list.length() storage._elems[index] = py_item @@ -53,10 +53,10 @@ an item already in the list at the affected position. """ if not isinstance(w_list, W_ListObject): -decref(space, w_item) +decref(space, py_item) PyErr_BadInternalCall(space) if index < 0 or index >= w_list.length(): -decref(space, w_item) +decref(space, py_item) raise oefmt(space.w_IndexError, "list assignment index out of range") storage = get_list_storage(space, w_list) py_old = storage._elems[index] @@ -66,6 +66,7 @@ @cpython_api([rffi.VOIDP, Py_ssize_t], PyObject, result_is_ll=True) def PyList_GET_ITEM(space, w_list, index): +assert isinstance(w_list, W_ListObject) storage = get_list_storage(space, w_list) assert 0 <= index < w_list.length() return storage._elems[index] # borrowed ref ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation: these missing wrappers take no keyword arguments.
Author: Amaury Forgeot d'Arc Branch: Changeset: r90912:a01f47870f2b Date: 2017-04-02 10:08 +0200 http://bitbucket.org/pypy/pypy/changeset/a01f47870f2b/ Log:Fix translation: these missing wrappers take no keyword arguments. diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -795,7 +795,7 @@ missing_wrappers = ['wrap_indexargfunc', 'wrap_delslice', 'wrap_coercefunc'] for name in missing_wrappers: assert name not in globals() -def missing_wrapper(space, w_self, w_args, func, w_kwds): +def missing_wrapper(space, w_self, w_args, func): print "cpyext: missing slot wrapper " + name raise NotImplementedError("Slot wrapper " + name) missing_wrapper.__name__ = name ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Philip Jenvey Branch: Changeset: r90756:a2617768d238 Date: 2017-03-19 12:52 -0700 http://bitbucket.org/pypy/pypy/changeset/a2617768d238/ Log:fix translation diff --git a/pypy/module/thread/os_local.py b/pypy/module/thread/os_local.py --- a/pypy/module/thread/os_local.py +++ b/pypy/module/thread/os_local.py @@ -75,6 +75,8 @@ return w_dict def descr_local__new__(space, w_subtype, __args__): +from pypy.objspace.std.typeobject import _precheck_for_new +w_subtype = _precheck_for_new(space, w_subtype) if __args__.arguments_w or __args__.keywords: w_parent_init, _ = space.lookup_in_type_where(w_subtype, '__init__') if w_parent_init is space.w_object: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation by adding import.
Author: Manuel Jacob Branch: Changeset: r90520:ef6200437274 Date: 2017-03-04 00:47 +0100 http://bitbucket.org/pypy/pypy/changeset/ef6200437274/ Log:Fix translation by adding import. diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py --- a/pypy/module/_io/interp_fileio.py +++ b/pypy/module/_io/interp_fileio.py @@ -2,6 +2,7 @@ from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.error import ( OperationError, oefmt, wrap_oserror, wrap_oserror2, exception_from_errno) +from rpython.rlib.objectmodel import keepalive_until_here from rpython.rlib.rarithmetic import r_longlong from rpython.rlib.rposix import get_saved_errno from rpython.rlib.rstring import StringBuilder ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation: add required casts from const char* to char*
Author: Ronan Lamy Branch: Changeset: r89645:0cce543d57b5 Date: 2017-01-17 19:23 + http://bitbucket.org/pypy/pypy/changeset/0cce543d57b5/ Log:Fix translation: add required casts from const char* to char* diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py --- a/pypy/module/cpyext/buffer.py +++ b/pypy/module/cpyext/buffer.py @@ -1,6 +1,6 @@ from rpython.rtyper.lltypesystem import rffi from pypy.module.cpyext.api import ( -cpython_api, CANNOT_FAIL, Py_TPFLAGS_HAVE_NEWBUFFER) +cpython_api, CANNOT_FAIL, Py_TPFLAGS_HAVE_NEWBUFFER, cts) from pypy.module.cpyext.pyobject import PyObject @cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL) @@ -10,10 +10,8 @@ flags = pyobj.c_ob_type.c_tp_flags if (flags & Py_TPFLAGS_HAVE_NEWBUFFER and as_buffer.c_bf_getbuffer): return 1 -name = rffi.charp2str(pyobj.c_ob_type.c_tp_name) +name = rffi.charp2str(cts.cast('char*', pyobj.c_ob_type.c_tp_name)) if name in ('str', 'bytes'): # XXX remove once wrapper of __buffer__ -> bf_getbuffer works return 1 -return 0 - - +return 0 diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py --- a/pypy/module/cpyext/typeobject.py +++ b/pypy/module/cpyext/typeobject.py @@ -360,7 +360,8 @@ wrapper_func_kwds, doc, func_voidp, offset=offset) dict_w[method_name] = space.wrap(w_obj) if pto.c_tp_doc: -dict_w['__doc__'] = space.newbytes(rffi.charp2str(pto.c_tp_doc)) +dict_w['__doc__'] = space.newbytes( +rffi.charp2str(cts.cast('char*', pto.c_tp_doc))) if pto.c_tp_new: add_tp_new_wrapper(space, dict_w, pto) @@ -487,7 +488,7 @@ convert_getset_defs(space, dict_w, pto.c_tp_getset, self) convert_member_defs(space, dict_w, pto.c_tp_members, self) -name = rffi.charp2str(pto.c_tp_name) +name = rffi.charp2str(cts.cast('char*', pto.c_tp_name)) flag_heaptype = pto.c_tp_flags & Py_TPFLAGS_HEAPTYPE if flag_heaptype: minsize = rffi.sizeof(PyHeapTypeObject.TO) @@ -506,7 +507,8 @@ not (pto.c_tp_as_sequence and pto.c_tp_as_sequence.c_sq_slice)): self.flag_map_or_seq = 'M' if pto.c_tp_doc: -self.w_doc = space.wrap(rffi.charp2str(pto.c_tp_doc)) +self.w_doc = space.newbytes( +rffi.charp2str(cts.cast('char*', pto.c_tp_doc))) @bootstrap_function def init_typeobject(space): @@ -800,7 +802,7 @@ try: w_obj = _type_realize(space, py_obj) finally: -name = rffi.charp2str(pto.c_tp_name) +name = rffi.charp2str(cts.cast('char*', pto.c_tp_name)) pto.c_tp_flags &= ~Py_TPFLAGS_READYING pto.c_tp_flags |= Py_TPFLAGS_READY return w_obj @@ -907,7 +909,7 @@ base = pto.c_tp_base base_pyo = rffi.cast(PyObject, pto.c_tp_base) if base and not base.c_tp_flags & Py_TPFLAGS_READY: -name = rffi.charp2str(base.c_tp_name) +name = rffi.charp2str(cts.cast('char*', base.c_tp_name)) type_realize(space, base_pyo) if base and not pto.c_ob_type: # will be filled later pto.c_ob_type = base.c_ob_type ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation (typo)
Author: Ronan Lamy Branch: Changeset: r89047:a12b1539331d Date: 2016-12-13 23:22 + http://bitbucket.org/pypy/pypy/changeset/a12b1539331d/ Log:fix translation (typo) diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py --- a/pypy/interpreter/gateway.py +++ b/pypy/interpreter/gateway.py @@ -671,10 +671,10 @@ return space.newtuple([builtin_code, space.newtuple([space.wrap(self.identifier)])]) -def find(space, indentifier): +@staticmethod +def find(space, identifier): from pypy.interpreter.function import Function return Function.find(space, identifier).code -find = staticmethod(find) def signature(self): return self.sig ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Ronan Lamy Branch: Changeset: r89007:5a43ad14735f Date: 2016-12-11 06:13 + http://bitbucket.org/pypy/pypy/changeset/5a43ad14735f/ Log:fix translation diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py --- a/pypy/module/cpyext/pyobject.py +++ b/pypy/module/cpyext/pyobject.py @@ -27,7 +27,7 @@ def get_dealloc(self): from pypy.module.cpyext.typeobject import subtype_dealloc -return subtype_dealloc +return subtype_dealloc.api_func def allocate(self, space, w_type, itemcount=0): # similar to PyType_GenericAlloc? @@ -108,7 +108,7 @@ if tp_dealloc: def get_dealloc(self): -return tp_dealloc +return tp_dealloc.api_func if tp_attach: def attach(self, space, pyobj, w_obj): diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -8,12 +8,12 @@ cpython_api, generic_cpy_call, PyObject, Py_ssize_t, Py_TPFLAGS_CHECKTYPES, mangle_name, pypy_decl, Py_buffer, Py_bufferP) from pypy.module.cpyext.typeobjectdefs import ( -unaryfunc, wrapperfunc, ternaryfunc, PyTypeObjectPtr, binaryfunc, ternaryfunc, +unaryfunc, ternaryfunc, PyTypeObjectPtr, binaryfunc, getattrfunc, getattrofunc, setattrofunc, lenfunc, ssizeargfunc, inquiry, ssizessizeargfunc, ssizeobjargproc, iternextfunc, initproc, richcmpfunc, cmpfunc, hashfunc, descrgetfunc, descrsetfunc, objobjproc, objobjargproc, readbufferproc, getbufferproc, ssizessizeobjargproc) -from pypy.module.cpyext.pyobject import from_ref, make_ref, Py_DecRef +from pypy.module.cpyext.pyobject import make_ref, Py_DecRef from pypy.module.cpyext.pyerrors import PyErr_Occurred from pypy.module.cpyext.memoryobject import fill_Py_buffer from pypy.module.cpyext.state import State @@ -21,8 +21,10 @@ from pypy.interpreter.argument import Arguments from rpython.rlib.buffer import Buffer from rpython.rlib.unroll import unrolling_iterable -from rpython.rlib.objectmodel import specialize +from rpython.rlib.objectmodel import specialize, not_rpython from rpython.tool.sourcetools import func_renamer +from rpython.flowspace.model import Constant +from rpython.flowspace.specialcase import register_flow_sc from rpython.rtyper.annlowlevel import llhelper from pypy.module.sys.version import CPYTHON_VERSION @@ -59,9 +61,17 @@ "expected %d-%d arguments, got %d", low, high, space.len_w(w_ob)) +@not_rpython def llslot(space, func): return llhelper(func.api_func.functype, func.api_func.get_wrapper(space)) +@register_flow_sc(llslot) +def sc_llslot(ctx, v_space, v_func): +assert isinstance(v_func, Constant) +get_llhelper = v_func.value.api_func.get_llhelper +return ctx.appcall(get_llhelper, v_space) + + def wrap_init(space, w_self, w_args, func, w_kwargs): func_init = rffi.cast(initproc, func) res = generic_cpy_call(space, func_init, w_self, w_args, w_kwargs) @@ -440,9 +450,10 @@ try: return SLOTS[key] except KeyError: -ret = build_slot_tp_function(space, typedef, name) -SLOTS[key] = ret -return ret +slot_func = build_slot_tp_function(space, typedef, name) +api_func = slot_func.api_func if slot_func else None +SLOTS[key] = api_func +return api_func def build_slot_tp_function(space, typedef, name): w_type = space.gettypeobject(typedef) @@ -983,8 +994,8 @@ slotdefs = sorted(slotdefs, key=slotdef_sort_key) slotdefs_for_tp_slots = unrolling_iterable( -[(x.method_name, x.slot_name, x.slot_names, x.slot_func) - for x in slotdefs]) +[(x.method_name, x.slot_name, x.slot_names, + x.slot_func.api_func if x.slot_func else None) for x in slotdefs]) slotdefs_for_wrappers = unrolling_iterable( [(x.method_name, x.slot_names, x.wrapper_func, x.wrapper_func_kwds, x.doc) diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py --- a/pypy/module/cpyext/typeobject.py +++ b/pypy/module/cpyext/typeobject.py @@ -247,20 +247,21 @@ # coming from a parent C type. typedef = w_type.layout.typedef -for method_name, slot_name, slot_names, slot_func in slotdefs_for_tp_slots: +for method_name, slot_name, slot_names, slot_apifunc in slotdefs_for_tp_slots: w_descr = w_type.lookup(method_name) if w_descr is None: # XXX special case iternext continue -if slot_func is None and typedef is not None: -slot_func = get_slot_tp_function(space, typedef, slot_name) -if not slot_func: +if slot_apifunc is None and typedef is not None: +slot_apifunc = get_slot_tp_function(space, typedef, slot_name) +if not slot_apifunc: if WARN_ABOUT_MISSING_SLOT_FUNCTIONS: -os.write(2, "%s defined by %s but no slot functi
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r87459:aa7addfd4bd1 Date: 2016-09-30 06:53 +0300 http://bitbucket.org/pypy/pypy/changeset/aa7addfd4bd1/ Log:fix translation diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -217,7 +217,6 @@ res = generic_cpy_call(space, func_target, w_self, i, j, w_y) if rffi.cast(lltype.Signed, res) == -1: space.fromcache(State).check_and_raise_exception(always=True) -return res def wrap_lenfunc(space, w_self, w_args, func): func_len = rffi.cast(lenfunc, func) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation with --no-allworkingmodules
Author: Armin Rigo Branch: Changeset: r87410:04821987a10e Date: 2016-09-27 09:58 +0200 http://bitbucket.org/pypy/pypy/changeset/04821987a10e/ Log:fix translation with --no-allworkingmodules diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py --- a/pypy/module/sys/initpath.py +++ b/pypy/module/sys/initpath.py @@ -7,7 +7,7 @@ import stat import sys -from rpython.rlib import rpath +from rpython.rlib import rpath, rdynload from rpython.rlib.objectmodel import we_are_translated from rpython.rtyper.lltypesystem import lltype, rffi from rpython.translator.tool.cbuild import ExternalCompilationInfo @@ -243,6 +243,7 @@ _eci = ExternalCompilationInfo(separate_module_sources=[_source_code], post_include_bits=['RPY_EXPORTED char *_pypy_init_home(void);']) +_eci = _eci.merge(rdynload.eci) pypy_init_home = rffi.llexternal("_pypy_init_home", [], rffi.CCHARP, _nowrapper=True, compilation_info=_eci) diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py --- a/rpython/rlib/rdynload.py +++ b/rpython/rlib/rdynload.py @@ -34,6 +34,7 @@ else: libraries = ['dl'] +# this 'eci' is also used in pypy/module/sys/initpath.py eci = ExternalCompilationInfo( pre_include_bits = pre_include_bits, includes = includes, ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation and add a warning in annmodel.unionof
Author: Ronan Lamy Branch: Changeset: r86825:82980a978280 Date: 2016-09-01 23:02 +0100 http://bitbucket.org/pypy/pypy/changeset/82980a978280/ Log:Fix translation and add a warning in annmodel.unionof diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -165,7 +165,9 @@ # graph -- it's already low-level operations! for a, s_newarg in zip(block.inputargs, cells): s_oldarg = a.annotation -if not s_oldarg.contains(s_newarg): +# XXX: Should use s_oldarg.contains(s_newarg) but that breaks +# PyPy translation +if annmodel.unionof(s_oldarg, s_newarg) != s_oldarg: raise annmodel.AnnotatorError( "Late-stage annotation is not allowed to modify the " "existing annotation for variable %s: %s" % diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -750,6 +750,7 @@ s1 = pair(s1, s2).union() else: # this is just a performance shortcut +# XXX: This is a lie! Grep for no_side_effects_in_union and weep. if s1 != s2: s1 = pair(s1, s2).union() return s1 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation when there is no SOCK_CLOEXEC
Author: Ronan Lamy Branch: Changeset: r86749:24d11640c483 Date: 2016-08-30 18:26 +0100 http://bitbucket.org/pypy/pypy/changeset/24d11640c483/ Log:Fix translation when there is no SOCK_CLOEXEC diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py --- a/rpython/rlib/rsocket.py +++ b/rpython/rlib/rsocket.py @@ -526,7 +526,7 @@ fd=_c.INVALID_SOCKET, inheritable=True): """Create a new socket.""" if _c.invalid_socket(fd): -if not inheritable and SOCK_CLOEXEC is not None: +if not inheritable and 'SOCK_CLOEXEC' in constants: # Non-inheritable: we try to call socket() with # SOCK_CLOEXEC, which may fail. If we get EINVAL, # then we fall back to the SOCK_CLOEXEC-less case. @@ -655,7 +655,7 @@ address, addr_p, addrlen_p = self._addrbuf() try: remove_inheritable = not inheritable -if (not inheritable and SOCK_CLOEXEC is not None +if (not inheritable and 'SOCK_CLOEXEC' in constants and _c.HAVE_ACCEPT4 and _accept4_syscall.attempt_syscall()): newfd = _c.socketaccept4(self.fd, addr_p, addrlen_p, @@ -1138,7 +1138,7 @@ try: res = -1 remove_inheritable = not inheritable -if not inheritable and SOCK_CLOEXEC is not None: +if not inheritable and 'SOCK_CLOEXEC' in constants: # Non-inheritable: we try to call socketpair() with # SOCK_CLOEXEC, which may fail. If we get EINVAL, # then we fall back to the SOCK_CLOEXEC-less case. ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Carl Friedrich Bolz Branch: Changeset: r85264:d70f72636d06 Date: 2016-06-20 23:38 +0200 http://bitbucket.org/pypy/pypy/changeset/d70f72636d06/ Log:fix translation diff --git a/rpython/jit/metainterp/optimizeopt/virtualstate.py b/rpython/jit/metainterp/optimizeopt/virtualstate.py --- a/rpython/jit/metainterp/optimizeopt/virtualstate.py +++ b/rpython/jit/metainterp/optimizeopt/virtualstate.py @@ -478,7 +478,7 @@ self.intbound = info def _generate_guards_unkown(self, other, box, runtime_box, extra_guards, -optimizer): +state): other_intbound = None if isinstance(other, NotVirtualStateInfoInt): other_intbound = other.intbound @@ -490,7 +490,7 @@ self.intbound.contains(runtime_box.getint())): # this may generate a few more guards than needed, but they are # optimized away when emitting them -self.intbound.make_guards(box, extra_guards, optimizer) +self.intbound.make_guards(box, extra_guards, state.optimizer) return raise VirtualStatesCantMatch("intbounds don't match") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Ronan Lamy Branch: Changeset: r84410:4251bbe57346 Date: 2016-05-13 01:09 +0100 http://bitbucket.org/pypy/pypy/changeset/4251bbe57346/ Log:fix translation diff --git a/rpython/memory/gc/env.py b/rpython/memory/gc/env.py --- a/rpython/memory/gc/env.py +++ b/rpython/memory/gc/env.py @@ -244,7 +244,9 @@ size = data[start:end] if size[len(size)-1] not in ('K', 'k'):# assume kilobytes for now continue -number = int(size[:len(size)-1])* 1024 +last = len(size) - 1 +assert last >= 0 +number = int(size[:last]) * 1024 # for now we look for the smallest of the L2 caches of the CPUs if number < L2cache: L2cache = number ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation.
Author: Manuel Jacob Branch: Changeset: r82379:337c536c54c1 Date: 2016-02-22 02:04 +0100 http://bitbucket.org/pypy/pypy/changeset/337c536c54c1/ Log:Fix translation. diff --git a/pypy/interpreter/pyparser/pytokenizer.py b/pypy/interpreter/pyparser/pytokenizer.py --- a/pypy/interpreter/pyparser/pytokenizer.py +++ b/pypy/interpreter/pyparser/pytokenizer.py @@ -261,14 +261,13 @@ token_list.append((tokens.ENDMARKER, '', lnum, pos, line)) return token_list + def universal_newline(line): -if len(line) >= 2: -c0 = line[-2] -c1 = line[-1] -if c0 == '\r' and c1 == '\n': -return line[:-2] + '\n' -if len(line) >= 1: -c = line[-1] -if c == '\r': -return line[:-1] + '\n' +# show annotator that indexes below are non-negative +line_len_m2 = len(line) - 2 +if line_len_m2 >= 0 and line[-2] == '\r' and line[-1] == '\n': +return line[:line_len_m2] + '\n' +line_len_m1 = len(line) - 1 +if line_len_m1 >= 0 and line[-1] == '\r': +return line[:line_len_m1] + '\n' return line ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: mattip Branch: Changeset: r81443:29e5f94db9b6 Date: 2015-12-24 17:24 +0200 http://bitbucket.org/pypy/pypy/changeset/29e5f94db9b6/ Log:fix translation diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -4,7 +4,8 @@ from rpython.rtyper.lltypesystem import rffi, lltype from pypy.module.cpyext.api import ( -cpython_api, generic_cpy_call, PyObject, Py_ssize_t, Py_TPFLAGS_CHECKTYPES) +cpython_api, generic_cpy_call, PyObject, Py_ssize_t, Py_TPFLAGS_CHECKTYPES, +CANNOT_FAIL) from pypy.module.cpyext.typeobjectdefs import ( unaryfunc, wrapperfunc, ternaryfunc, PyTypeObjectPtr, binaryfunc, getattrfunc, getattrofunc, setattrofunc, lenfunc, ssizeargfunc, inquiry, @@ -386,7 +387,7 @@ return @cpython_api([PyObject, PyObject], PyObject, - error=lltype.nullptr(rffi.VOIDP.TO), external=True) + error=CANNOT_FAIL, external=True) @func_renamer("cpyext_tp_getattro_%s" % (typedef.name,)) def slot_tp_getattro(space, w_self, w_name): return space.call_function(getattr_fn, w_self, w_name) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation when CLOCK_T is unsigned (BSDs)
Author: Philip Jenvey Branch: Changeset: r81417:49495a30004c Date: 2015-12-21 15:52 -0800 http://bitbucket.org/pypy/pypy/changeset/49495a30004c/ Log:fix translation when CLOCK_T is unsigned (BSDs) diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py --- a/rpython/rlib/rposix.py +++ b/rpython/rlib/rposix.py @@ -1302,7 +1302,7 @@ try: # note: times() can return a negative value (or even -1) # even if there is no error -result = widen(c_times(l_tmsbuf)) +result = rffi.cast(lltype.Signed, c_times(l_tmsbuf)) if result == -1: errno = get_saved_errno() if errno != 0: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: fijal Branch: Changeset: r80760:1f06b485fd84 Date: 2015-11-18 18:17 +0200 http://bitbucket.org/pypy/pypy/changeset/1f06b485fd84/ Log:fix translation diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -391,8 +391,7 @@ self.check_signal_action = None # changed by the signal module self.user_del_action = UserDelAction(self) self._code_of_sys_exc_info = None -self._code_hook = None - + # can be overridden to a subclass self.initialize() @@ -1242,13 +1241,6 @@ self.setitem(w_globals, w_key, self.wrap(self.builtin)) return statement.exec_code(self, w_globals, w_locals) -def new_code_hook(self, w_code): -if self._code_hook is not None: -try: -self.call_function(self._code_hook, w_code) -except OperationError, e: -e.write_unraisable(self, "new_code_hook()") - def appexec(self, posargs_w, source): """ return value from executing given source at applevel. EXPERIMENTAL. The source must look like diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -50,6 +50,9 @@ kwargname = varnames[argcount] if code.co_flags & CO_VARKEYWORDS else None return Signature(argnames, varargname, kwargname) +class CodeHookCache(object): +def __init__(self, space): +self._code_hook = None class PyCode(eval.Code): "CPython-style code objects." @@ -86,7 +89,15 @@ self._signature = cpython_code_signature(self) self._initialize() self._init_ready() -self.space.new_code_hook(self) +self.new_code_hook() + +def new_code_hook(self): +code_hook = self.space.fromcache(CodeHookCache)._code_hook +if code_hook is not None: +try: +self.space.call_function(code_hook, self) +except OperationError, e: +e.write_unraisable(self.space, "new_code_hook()") def _initialize(self): if self.co_cellvars: diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py --- a/pypy/module/__pypy__/interp_magic.py +++ b/pypy/module/__pypy__/interp_magic.py @@ -1,5 +1,6 @@ from pypy.interpreter.error import OperationError, wrap_oserror from pypy.interpreter.gateway import unwrap_spec +from pypy.interpreter.pycode import CodeHookCache from pypy.interpreter.pyframe import PyFrame from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib.objectmodel import we_are_translated @@ -153,7 +154,8 @@ return specialized_zip_2_lists(space, w_list1, w_list2) def set_code_callback(space, w_callable): +cache = space.fromcache(CodeHookCache) if space.is_none(w_callable): -space._code_hook = None +cache._code_hook = None else: -space._code_hook = w_callable \ No newline at end of file +cache._code_hook = w_callable \ No newline at end of file ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation - closure -> class
Author: mattip Branch: Changeset: r79863:403ce2521b92 Date: 2015-09-27 08:52 +0300 http://bitbucket.org/pypy/pypy/changeset/403ce2521b92/ Log:fix translation - closure -> class diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py --- a/pypy/module/micronumpy/concrete.py +++ b/pypy/module/micronumpy/concrete.py @@ -18,6 +18,19 @@ is_f_contiguous) from rpython.rlib.objectmodel import keepalive_until_here +TimSort = make_timsort_class() +class StrideSort(TimSort): +''' +argsort (return the indices to sort) a list of strides +''' +def __init__(self, rangelist, strides): +self.strides = strides +TimSort.__init__(self, rangelist) + +def lt(self, a, b): +return self.strides[a] < self.strides[b] + + class BaseConcreteArray(object): _immutable_fields_ = ['dtype?', 'storage', 'start', 'size', 'shape[*]', 'strides[*]', 'backstrides[*]', 'order', 'gcstruct', @@ -355,11 +368,9 @@ elif order != self.order: t_strides, backstrides = calc_strides(shape, dtype, order) else: -def arg_lt(a, b): -return strides[a] < strides[b] -ArgSort=make_timsort_class(lt=arg_lt) indx_array = range(len(strides)) -ArgSort(indx_array).sort() +list_sorter = StrideSort(indx_array, strides) +list_sorter.sort() t_elsize = dtype.elsize t_strides = strides[:] base = dtype.elsize ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation (hopefully)
Author: Armin Rigo Branch: Changeset: r78361:a6536252040f Date: 2015-06-30 15:01 +0200 http://bitbucket.org/pypy/pypy/changeset/a6536252040f/ Log:Fix translation (hopefully) diff --git a/pypy/module/_vmprof/interp_vmprof.py b/pypy/module/_vmprof/interp_vmprof.py --- a/pypy/module/_vmprof/interp_vmprof.py +++ b/pypy/module/_vmprof/interp_vmprof.py @@ -26,7 +26,7 @@ eci_kwds = dict( include_dirs = [SRC], includes = ['vmprof.h', 'trampoline.h'], -separate_module_files = [SRC.join('trampoline.s')], +separate_module_files = [SRC.join('trampoline.vmprof.s')], libraries = ['dl'], post_include_bits=[""" diff --git a/pypy/module/_vmprof/src/trampoline.s b/pypy/module/_vmprof/src/trampoline.vmprof.s rename from pypy/module/_vmprof/src/trampoline.s rename to pypy/module/_vmprof/src/trampoline.vmprof.s diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py --- a/rpython/translator/c/genc.py +++ b/rpython/translator/c/genc.py @@ -439,8 +439,8 @@ mk.definition('PYTHON', get_recent_cpython_executable()) -mk.definition('GCMAPFILES', '$(subst .asmgcc.s,.gcmap,$(subst .c,.gcmap,$(SOURCES)))') -mk.definition('OBJECTS1', '$(subst .asmgcc.s,.o,$(subst .c,.o,$(SOURCES)))') +mk.definition('GCMAPFILES', '$(subst .vmprof.s,.gcmap,$(subst .c,.gcmap,$(SOURCES)))') +mk.definition('OBJECTS1', '$(subst .vmprof.s,.o,$(subst .c,.o,$(SOURCES)))') mk.definition('OBJECTS', '$(OBJECTS1) gcmaptable.s') # the CFLAGS passed to gcc when invoked to assembler the .s file @@ -462,9 +462,9 @@ 'rm $*.s $*.lbl.s']) # this is for manually written assembly files which needs to be parsed by asmgcc -mk.rule('%.o %.gcmap', '%.asmgcc.s', [ +mk.rule('%.o %.gcmap', '%.vmprof.s', [ '$(PYTHON) $(RPYDIR)/translator/c/gcc/trackgcroot.py ' -'-t $*.asmgcc.s > $*.gctmp', +'-t $*.vmprof.s > $*.gctmp', '$(CC) -o $*.o -c $*.asmgcc.lbl.s', 'mv $*.gctmp $*.gcmap', 'rm $*.asmgcc.lbl.s']) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation and allow order='K'
Author: Ronan Lamy Branch: Changeset: r77932:75e2c1d303eb Date: 2015-06-07 02:36 +0100 http://bitbucket.org/pypy/pypy/changeset/75e2c1d303eb/ Log:Fix translation and allow order='K' diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py --- a/pypy/module/micronumpy/concrete.py +++ b/pypy/module/micronumpy/concrete.py @@ -345,10 +345,12 @@ if s < mins: mins = s t_strides = [s * t_elsize / mins for s in strides] -if order not in ('C', 'F'): +if order == 'K': +pass +elif order not in ('C', 'F'): raise oefmt(space.w_ValueError, "Unknown order %s in astype", order) -if order != self.order: -t_strides = tstrides[::-1] +elif order != self.order: +t_strides.reverse() backstrides = calc_backstrides(t_strides, shape) else: t_strides = [] @@ -379,7 +381,7 @@ gc._trace_callback(callback, arg, storage) storage += step i += 1 - + lambda_customtrace = lambda: customtrace def _setup(): @@ -403,8 +405,6 @@ make_sure_not_resized(backstrides) self.shape = shape self.size = support.product(shape) * dtype.elsize -if order not in ('C', 'F'): -raise oefmt(space.w_ValueError, "Unknown order %s in astype", order) self.order = order self.dtype = dtype self.strides = strides @@ -445,7 +445,7 @@ gcstruct = V_OBJECTSTORE flags = NPY.ARRAY_ALIGNED | NPY.ARRAY_WRITEABLE if storage == lltype.nullptr(RAW_STORAGE): -length = support.product(shape) +length = support.product(shape) if dtype.num == NPY.OBJECT: storage = dtype.itemtype.malloc(length * dtype.elsize, zero=True) gcstruct = _create_objectstore(storage, length, dtype.elsize) @@ -507,7 +507,7 @@ ConcreteArray.__init__(self, shape, dtype, order, strides, backstrides, storage, zero) self.flags &= ~ NPY.ARRAY_WRITEABLE - + def descr_setitem(self, space, orig_array, w_index, w_value): raise OperationError(space.w_ValueError, space.wrap( "assignment destination is read-only")) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation ("argument not constant")
Author: mattip Branch: Changeset: r77787:61595f3c9846 Date: 2015-06-02 21:12 +0300 http://bitbucket.org/pypy/pypy/changeset/61595f3c9846/ Log:fix translation ("argument not constant") diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -99,7 +99,7 @@ info = self.ctxobj.info errmsg = rffi.charp2str(info.c_error_message) if len(input_text) > 500: -raise oefmt(self.w_FFIError, errmsg) +raise oefmt(self.w_FFIError, "%s", errmsg) printable_text = ['?'] * len(input_text) for i in range(len(input_text)): if ' ' <= input_text[i] < '\x7f': ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: mattip Branch: Changeset: r76959:f15b0957b177 Date: 2015-05-01 08:37 +0300 http://bitbucket.org/pypy/pypy/changeset/f15b0957b177/ Log:fix translation diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py --- a/pypy/interpreter/pyframe.py +++ b/pypy/interpreter/pyframe.py @@ -63,10 +63,10 @@ w_locals = None # dict containing locals, if forced or necessary pycode = None # code object executed by that frame locals_stack_w = None # the list of all locals and valuestack -valuestackdepth = -1 # number of items on valuestack +valuestackdepth = 0 # number of items on valuestack lastblock = None # default to False -f_lineno = -1 # current lineno +f_lineno = 0 # current lineno cells = None # cells # other fields: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation on freebsd
Author: Brian Kearns Branch: Changeset: r73563:a3bb59563fe7 Date: 2014-09-16 18:19 -0400 http://bitbucket.org/pypy/pypy/changeset/a3bb59563fe7/ Log:fix translation on freebsd diff --git a/rpython/rtyper/module/ll_os_stat.py b/rpython/rtyper/module/ll_os_stat.py --- a/rpython/rtyper/module/ll_os_stat.py +++ b/rpython/rtyper/module/ll_os_stat.py @@ -186,7 +186,10 @@ _name_struct_stat = '_stati64' INCLUDES = ['sys/types.h', 'sys/stat.h', 'sys/statvfs.h'] else: -_name_struct_stat = 'stat64' +if 'bsd' in sys.platform: +_name_struct_stat = 'stat' +else: +_name_struct_stat = 'stat64' INCLUDES = ['sys/types.h', 'sys/stat.h', 'sys/statvfs.h', 'unistd.h'] compilation_info = ExternalCompilationInfo( ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Brian Kearns Branch: Changeset: r73434:ba969ea17c8e Date: 2014-09-10 20:22 -0400 http://bitbucket.org/pypy/pypy/changeset/ba969ea17c8e/ Log:fix translation diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py --- a/rpython/rlib/rfile.py +++ b/rpython/rlib/rfile.py @@ -205,7 +205,7 @@ def create_stdio(): -close2 = [None, None] +close2 = (None, None) stdin = RFile(c_stdin(), close2=close2) stdout = RFile(c_stdout(), close2=close2) stderr = RFile(c_stderr(), close2=close2) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Brian Kearns Branch: Changeset: r73407:615fa520e47e Date: 2014-09-09 20:56 -0400 http://bitbucket.org/pypy/pypy/changeset/615fa520e47e/ Log:fix translation diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py --- a/rpython/rlib/rfile.py +++ b/rpython/rlib/rfile.py @@ -220,6 +220,9 @@ do_close = self._close2[1] do_close(ll_file) # return value ignored +def _cleanup_(self): +self._ll_file = lltype.nullptr(FILEP.TO) + def close(self): """Closes the described file. ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Brian Kearns Branch: Changeset: r73178:5ddeaa6b6665 Date: 2014-08-29 12:58 -0400 http://bitbucket.org/pypy/pypy/changeset/5ddeaa6b6665/ Log:fix translation diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py --- a/rpython/rlib/rfile.py +++ b/rpython/rlib/rfile.py @@ -206,6 +206,7 @@ def write(self, value): self._check_closed() self._check_writing() +assert value is not None ll_value = rffi.get_nonmovingbuffer(value) try: # note that since we got a nonmoving buffer, it is either raw ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation of test
Author: mattip Branch: Changeset: r72023:18f696e31514 Date: 2014-06-11 21:44 +0300 http://bitbucket.org/pypy/pypy/changeset/18f696e31514/ Log:fix translation of test diff --git a/rpython/translator/c/test/test_extfunc.py b/rpython/translator/c/test/test_extfunc.py --- a/rpython/translator/c/test/test_extfunc.py +++ b/rpython/translator/c/test/test_extfunc.py @@ -185,6 +185,7 @@ os.stat("nonexistentdir/nonexistentfile") except WindowsError, e: return e.winerror +return 0 f = compile(call_stat, []) res = f() expected = call_stat() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Ronan Lamy Branch: Changeset: r71735:ef8c0505fc21 Date: 2014-05-26 18:12 +0100 http://bitbucket.org/pypy/pypy/changeset/ef8c0505fc21/ Log:fix translation diff --git a/rpython/rtyper/module/r_os_stat.py b/rpython/rtyper/module/r_os_stat.py --- a/rpython/rtyper/module/r_os_stat.py +++ b/rpython/rtyper/module/r_os_stat.py @@ -91,7 +91,7 @@ s_index = rtyper.annotator.bookkeeper.immutablevalue(index) hop2 = hop.copy() spaceop = op.getitem(hop.args_v[0], Constant(index)) -spaceop.result = hop.result +spaceop.result = hop.spaceop.result hop2.spaceop = spaceop hop2.args_v = spaceop.args hop2.args_s = [self.s_tuple, s_index] ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation on msvc after 3484aaa1e858
Author: mattip Branch: Changeset: r71361:ad12f8418f24 Date: 2014-05-07 09:26 +0300 http://bitbucket.org/pypy/pypy/changeset/ad12f8418f24/ Log:fix translation on msvc after 3484aaa1e858 diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py --- a/rpython/translator/c/genc.py +++ b/rpython/translator/c/genc.py @@ -753,6 +753,8 @@ def add_extra_files(eci): srcdir = py.path.local(__file__).join('..', 'src') +_MSVC = eci.platform.name == 'msvc' + files = [ srcdir / 'entrypoint.c', # ifdef PYPY_STANDALONE srcdir / 'allocator.c',# ifdef PYPY_STANDALONE @@ -769,6 +771,8 @@ ] if _CYGWIN: files.append(srcdir / 'cygwin_wait.c') +if _MSVC: +files.append(srcdir / 'asm_msvc.c') return eci.merge(ExternalCompilationInfo(separate_module_files=files)) diff --git a/rpython/translator/c/src/asm_msvc.c b/rpython/translator/c/src/asm_msvc.c --- a/rpython/translator/c/src/asm_msvc.c +++ b/rpython/translator/c/src/asm_msvc.c @@ -1,5 +1,6 @@ #ifdef PYPY_X86_CHECK_SSE2 #include +#include void pypy_x86_check_sse2(void) { int features; ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Philip Jenvey Branch: Changeset: r70506:da3975c63a3e Date: 2014-04-09 11:52 -0700 http://bitbucket.org/pypy/pypy/changeset/da3975c63a3e/ Log:fix translation diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py --- a/pypy/module/sys/initpath.py +++ b/pypy/module/sys/initpath.py @@ -13,7 +13,9 @@ from pypy.interpreter.gateway import unwrap_spec from pypy.module.sys.state import get as get_state -IS_WINDOWS = sys.platform == 'win32' +PLATFORM = sys.platform +_MACOSX = sys.platform == 'darwin' +_WIN32 = sys.platform == 'win32' def find_executable(executable): @@ -21,10 +23,10 @@ Return the absolute path of the executable, by looking into PATH and the current directory. If it cannot be found, return ''. """ -if (we_are_translated() and IS_WINDOWS and +if (we_are_translated() and _WIN32 and not executable.lower().endswith('.exe')): executable += '.exe' -if os.sep in executable or (IS_WINDOWS and ':' in executable): +if os.sep in executable or (_WIN32 and ':' in executable): # the path is already more than just an executable name pass else: @@ -43,7 +45,7 @@ def _readlink_maybe(filename): -if not IS_WINDOWS: +if not _WIN32: return os.readlink(filename) raise NotImplementedError @@ -116,9 +118,9 @@ importlist.append(lib_tk) # List here the extra platform-specific paths. -if not IS_WINDOWS: -importlist.append(os.path.join(python_std_lib, 'plat-' + sys.platform)) -if sys.platform == 'darwin': +if not _WIN32: +importlist.append(os.path.join(python_std_lib, 'plat-' + PLATFORM)) +if _MACOSX: platmac = os.path.join(python_std_lib, 'plat-mac') importlist.append(platmac) importlist.append(os.path.join(platmac, 'lib-scriptpackages')) diff --git a/pypy/module/sys/test/test_initpath.py b/pypy/module/sys/test/test_initpath.py --- a/pypy/module/sys/test/test_initpath.py +++ b/pypy/module/sys/test/test_initpath.py @@ -84,7 +84,7 @@ assert find_executable('pypy') == a.join('pypy') # monkeypatch.setattr(initpath, 'we_are_translated', lambda: True) -monkeypatch.setattr(initpath, 'IS_WINDOWS', True) +monkeypatch.setattr(initpath, '_WIN32', True) monkeypatch.setenv('PATH', str(a)) a.join('pypy.exe').ensure(file=True) assert find_executable('pypy') == a.join('pypy.exe') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Brian Kearns Branch: Changeset: r70060:131563225cdf Date: 2014-03-18 14:48 -0400 http://bitbucket.org/pypy/pypy/changeset/131563225cdf/ Log:fix translation diff --git a/pypy/module/__builtin__/interp_memoryview.py b/pypy/module/__builtin__/interp_memoryview.py --- a/pypy/module/__builtin__/interp_memoryview.py +++ b/pypy/module/__builtin__/interp_memoryview.py @@ -42,7 +42,6 @@ def buffer_w(self, space): return self.buf -@staticmethod @unwrap_spec(offset=int, size=int) def descr_new(space, w_subtype, w_object, offset=0, size=-1): if space.isinstance_w(w_object, space.w_unicode): @@ -145,7 +144,7 @@ start of the object (or at the specified offset). The slice will extend to the end of the target object (or with the specified size). """, -__new__ = interp2app(W_Buffer.descr_new), +__new__ = interp2app(W_Buffer.descr_new.im_func), __len__ = interp2app(W_Buffer.descr_len), __getitem__ = interp2app(W_Buffer.descr_getitem), __setitem__ = interp2app(W_Buffer.descr_setitem), @@ -176,7 +175,6 @@ def buffer_w(self, space): return self.buf -@staticmethod def descr_new(space, w_subtype, w_object): w_memoryview = W_MemoryView(space.buffer_w(w_object)) return w_memoryview @@ -298,7 +296,7 @@ __doc__ = """\ Create a new memoryview object which references the given object. """, -__new__ = interp2app(W_MemoryView.descr_new), +__new__ = interp2app(W_MemoryView.descr_new.im_func), __eq__ = interp2app(W_MemoryView.descr_eq), __ge__ = interp2app(W_MemoryView.descr_ge), __getitem__ = interp2app(W_MemoryView.descr_getitem), ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Brian Kearns Branch: Changeset: r68517:2607be88f864 Date: 2013-12-20 15:38 -0500 http://bitbucket.org/pypy/pypy/changeset/2607be88f864/ Log:fix translation diff --git a/pypy/module/micronumpy/arrayimpl/scalar.py b/pypy/module/micronumpy/arrayimpl/scalar.py --- a/pypy/module/micronumpy/arrayimpl/scalar.py +++ b/pypy/module/micronumpy/arrayimpl/scalar.py @@ -133,7 +133,9 @@ return self.get_scalar_value() elif space.isinstance_w(w_idx, space.w_str): if self.dtype.is_record_type(): -return self.value.descr_getitem(space, w_idx).descr_ravel(space) +w_val = self.value.descr_getitem(space, w_idx) +assert isinstance(w_val, W_GenericBox) +return w_val.descr_ravel(space) elif space.is_none(w_idx): new_shape = [1] arr = W_NDimArray.from_shape(space, new_shape, self.dtype) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation (odd?)
Author: Brian Kearns Branch: Changeset: r68505:70c1284ebcc9 Date: 2013-12-19 22:57 -0500 http://bitbucket.org/pypy/pypy/changeset/70c1284ebcc9/ Log:fix translation (odd?) diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py --- a/pypy/module/micronumpy/interp_dtype.py +++ b/pypy/module/micronumpy/interp_dtype.py @@ -169,7 +169,7 @@ subdescr.append(subdtype.descr_get_str(space)) if subdtype.shape != []: subdescr.append(subdtype.descr_get_shape(space)) -descr.append(space.newtuple(subdescr)) +descr.append(space.newtuple(subdescr[:])) return space.newlist(descr) def descr_get_base(self, space): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Brian Kearns Branch: Changeset: r68459:685403c62cab Date: 2013-12-18 00:10 -0500 http://bitbucket.org/pypy/pypy/changeset/685403c62cab/ Log:fix translation diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -1044,6 +1044,7 @@ raise OperationError(space.w_TypeError, space.wrap( "only integer arrays with one element " "can be converted to an index")) +assert isinstance(value, interp_boxes.W_GenericBox) return value.item(space) def descr_reduce(self, space): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation, be more like cpython
Author: Matti Picus Branch: Changeset: r68310:d45c21ada48f Date: 2013-11-24 20:22 +0200 http://bitbucket.org/pypy/pypy/changeset/d45c21ada48f/ Log:fix translation, be more like cpython diff --git a/pypy/module/cpyext/include/pyconfig.h b/pypy/module/cpyext/include/pyconfig.h --- a/pypy/module/cpyext/include/pyconfig.h +++ b/pypy/module/cpyext/include/pyconfig.h @@ -25,16 +25,18 @@ #define Py_UNICODE_SIZE 2 #endif -#if defined(_MSC_VER) - /* So MSVC users need not specify the .lib file in -* their Makefile (other compilers are generally -* taken care of by distutils.) */ -#ifdef _DEBUG -#error("debug first with cpython") -#pragma comment(lib,"python27.lib") -#else -#pragma comment(lib,"python27.lib") -#endif /* _DEBUG */ +#ifndef Py_BUILD_CORE /* not building the core - must be an ext */ +#if defined(_MSC_VER) + /* So MSVC users need not specify the .lib file in + * their Makefile (other compilers are generally + * taken care of by distutils.) */ +#ifdef _DEBUG +#error("debug first with cpython") +#pragma comment(lib,"python27.lib") +#else +#pragma comment(lib,"python27.lib") +#endif /* _DEBUG */ +#endif #endif /* _MSC_VER */ ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation after last commit
Author: Brian Kearns Branch: Changeset: r67672:57fb97ec48c9 Date: 2013-10-28 23:35 -0400 http://bitbucket.org/pypy/pypy/changeset/57fb97ec48c9/ Log:fix translation after last commit diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -363,7 +363,7 @@ @unwrap_spec(w_axis=WrappedDefault(None), w_out=WrappedDefault(None), w_mode=WrappedDefault('raise')) -def descr_take(self, space, w_obj, w_axis, w_out, w_mode): +def descr_take(self, space, w_obj, w_axis=None, w_out=None, w_mode=None): return app_take(space, self, w_obj, w_axis, w_out, w_mode) def descr_compress(self, space, w_obj, w_axis=None): @@ -577,7 +577,7 @@ @unwrap_spec(w_axis=WrappedDefault(None), w_out=WrappedDefault(None)) -def descr_ptp(self, space, w_axis, w_out): +def descr_ptp(self, space, w_axis=None, w_out=None): return app_ptp(space, self, w_axis, w_out) def descr_put(self, space, w_indices, w_values, w_mode=None): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation, fix test for removed numpy.py file
Author: Matti Picus Branch: Changeset: r67369:f25225624539 Date: 2013-10-14 21:27 +0300 http://bitbucket.org/pypy/pypy/changeset/f25225624539/ Log:fix translation, fix test for removed numpy.py file diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py --- a/pypy/module/micronumpy/interp_ufuncs.py +++ b/pypy/module/micronumpy/interp_ufuncs.py @@ -78,9 +78,16 @@ def descr_accumulate(self, space, w_obj, w_axis=None, w_dtype=None, w_out=None): if space.is_none(w_axis) or w_axis is None: w_axis = space.wrap(0) +if space.is_none(w_out): +out = None +elif not isinstance(w_out, W_NDimArray): +raise OperationError(space.w_TypeError, space.wrap( +'output must be an array')) +else: +out = w_out return self.reduce(space, w_obj, False, #do not promote_to_largest w_axis, True, #keepdims must be true -w_out, w_dtype, cumultative=True) +out, w_dtype, cumultative=True) @unwrap_spec(skipna=bool, keepdims=bool) def descr_reduce(self, space, w_obj, w_axis=None, w_dtype=None, diff --git a/pypy/module/micronumpy/test/test_sorting.py b/pypy/module/micronumpy/test/test_sorting.py --- a/pypy/module/micronumpy/test/test_sorting.py +++ b/pypy/module/micronumpy/test/test_sorting.py @@ -97,11 +97,11 @@ # check doubles from numpypy import array, nan, zeros, complex128, arange -from numpy import isnan +from math import isnan a = array([nan, 1, 0]) b = a.copy() b.sort() -assert (isnan(b) == isnan(a[::-1])).all() +assert [isnan(bb) for bb in b] == [isnan(aa) for aa in a[::-1]] assert (b[:2] == a[::-1][:2]).all() # check complex @@ -110,7 +110,7 @@ a.imag += [nan, 1, 0, nan, nan, 1, 0, 1, 0] b = a.copy() b.sort() -assert (isnan(b) == isnan(a[::-1])).all() +assert [isnan(bb) for bb in b] == [isnan(aa) for aa in a[::-1]] assert (b[:4] == a[::-1][:4]).all() # all c scalar sorts use the same code with different types ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r67342:218eb71b2288 Date: 2013-10-13 11:24 +0300 http://bitbucket.org/pypy/pypy/changeset/218eb71b2288/ Log:fix translation diff --git a/pypy/module/cpyext/ndarrayobject.py b/pypy/module/cpyext/ndarrayobject.py --- a/pypy/module/cpyext/ndarrayobject.py +++ b/pypy/module/cpyext/ndarrayobject.py @@ -171,7 +171,7 @@ w_array.implementation.shape = [] return w_array -@cpython_api([rffi.INT_real], PyObject) +@cpython_api([Py_ssize_t], PyObject) def _PyArray_DescrFromType(space, typenum): try: dtype = get_dtype_cache(space).dtypes_by_num[typenum] ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Alex Gaynor Branch: Changeset: r67134:b276b99a50c9 Date: 2013-09-29 09:09 -0700 http://bitbucket.org/pypy/pypy/changeset/b276b99a50c9/ Log:fix translation diff --git a/rpython/jit/metainterp/heapcache.py b/rpython/jit/metainterp/heapcache.py --- a/rpython/jit/metainterp/heapcache.py +++ b/rpython/jit/metainterp/heapcache.py @@ -122,7 +122,7 @@ len(effectinfo.write_descrs_arrays) == 1 ): # Fish the descr out of the effectinfo -cache = self.heap_array_cache.get(effectinfo.write_descrs_arrays[0]) +cache = self.heap_array_cache.get(effectinfo.write_descrs_arrays[0], None) if cache is not None: # XXX: in theory the indices of the copy could be # looked at ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation: backout 1043bb8b12f8 for now
Author: Philip Jenvey Branch: Changeset: r66309:96d6dfac5ab9 Date: 2013-08-23 17:13 -0700 http://bitbucket.org/pypy/pypy/changeset/96d6dfac5ab9/ Log:fix translation: backout 1043bb8b12f8 for now diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -577,12 +577,13 @@ except OperationError, e: # fall back to the original byte string result_w[i] = w_bytes -return space.newlist(result_w) else: dirname = space.str0_w(w_dirname) -return space.newlist_str(rposix.listdir(dirname)) +result = rposix.listdir(dirname) +result_w = [space.wrap(s) for s in result] except OSError, e: raise wrap_oserror2(space, e, w_dirname) +return space.newlist(result_w) def pipe(space): "Create a pipe. Returns (read_end, write_end)." ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation without threads (hopefully)
Author: Armin Rigo Branch: Changeset: r65978:4c7b26f3c910 Date: 2013-08-06 19:07 +0200 http://bitbucket.org/pypy/pypy/changeset/4c7b26f3c910/ Log:Fix translation without threads (hopefully) diff --git a/pypy/module/cpyext/pystate.py b/pypy/module/cpyext/pystate.py --- a/pypy/module/cpyext/pystate.py +++ b/pypy/module/cpyext/pystate.py @@ -3,7 +3,6 @@ from pypy.module.cpyext.pyobject import PyObject, Py_DecRef, make_ref, from_ref from rpython.rtyper.lltypesystem import rffi, lltype from rpython.rlib import rthread -from pypy.module.thread import os_thread PyInterpreterStateStruct = lltype.ForwardReference() PyInterpreterState = lltype.Ptr(PyInterpreterStateStruct) @@ -45,7 +44,10 @@ @cpython_api([], lltype.Void) def PyEval_InitThreads(space): -os_thread.setup_threads(space) +if space.config.translation.thread: +from pypy.module.thread import os_thread +os_thread.setup_threads(space) +#else: nothing to do @cpython_api([], rffi.INT_real, error=CANNOT_FAIL) def PyEval_ThreadsInitialized(space): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation, maybe
Author: Maciej Fijalkowski Branch: Changeset: r65595:c7b6692d954c Date: 2013-07-24 11:25 +0200 http://bitbucket.org/pypy/pypy/changeset/c7b6692d954c/ Log:fix translation, maybe diff --git a/rpython/rtyper/module/ll_os_stat.py b/rpython/rtyper/module/ll_os_stat.py --- a/rpython/rtyper/module/ll_os_stat.py +++ b/rpython/rtyper/module/ll_os_stat.py @@ -105,7 +105,10 @@ class SomeStatvfsResult(annmodel.SomeObject): -knowntype = os.statvfs_result +if hasattr(os, 'statvfs_result'): +knowntype = os.statvfs_result +else: +knowntype = None # will not be used def rtyper_makerepr(self, rtyper): from rpython.rtyper.module import r_os_stat ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation, int%float is not RPython.
Author: Amaury Forgeot d'Arc Branch: Changeset: r65071:d77e4dd8ef04 Date: 2013-06-28 16:47 +0200 http://bitbucket.org/pypy/pypy/changeset/d77e4dd8ef04/ Log:Fix translation, int%float is not RPython. Don't use floats when integer arithmetics is possible, I'm sure there were possible rounding errors as well. This also fixes a bug for empty arrays. diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -627,27 +627,29 @@ w_dtype)) else: dtype = self.get_dtype() -factor = float(dtype.get_size()) / self.get_dtype().get_size() -if self.get_size() % factor != 0: -raise OperationError(space.w_ValueError, space.wrap( -"new type not compatible with array.")) +old_itemsize = self.get_dtype().get_size() +new_itemsize = dtype.get_size() impl = self.implementation new_shape = self.get_shape() -if len(new_shape) > 0: -if impl.get_strides()[0] < impl.get_strides()[-1]: -new_shape[0] = int(new_shape[0] / factor) -if new_shape[0] == 0: -raise OperationError(space.w_ValueError, space.wrap( -"new type not compatible with array shape")) -else: -new_shape[-1] = int(new_shape[-1] / factor) -if new_shape[-1] == 0: -raise OperationError(space.w_ValueError, space.wrap( -"new type not compatible with array shape")) -else: -if factor != 1: +dims = len(new_shape) +if dims == 0: +# Cannot resize scalars +if old_itemsize != new_itemsize: raise OperationError(space.w_ValueError, space.wrap( "new type not compatible with array shape")) +else: +if dims == 1 or impl.get_strides()[0] < impl.get_strides()[-1]: +# Column-major, resize first dimension +if new_shape[0] * old_itemsize % new_itemsize != 0: +raise OperationError(space.w_ValueError, space.wrap( +"new type not compatible with array.")) +new_shape[0] = new_shape[0] * old_itemsize / new_itemsize +else: +# Row-major, resize last dimension +if new_shape[-1] * old_itemsize % new_itemsize != 0: +raise OperationError(space.w_ValueError, space.wrap( +"new type not compatible with array.")) +new_shape[-1] = new_shape[-1] * old_itemsize / new_itemsize return W_NDimArray(impl.get_view(self, dtype, new_shape)) diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py --- a/pypy/module/micronumpy/test/test_numarray.py +++ b/pypy/module/micronumpy/test/test_numarray.py @@ -1432,6 +1432,11 @@ x = array(range(15), dtype='int16').reshape(3,5).T assert x.view('int8').shape == (10, 3) +def test_ndarray_view_empty(self): +from numpypy import array, int8, int16, dtype +x = array([], dtype=[('a', int8), ('b', int8)]) +y = x.view(dtype=int16) + def test_scalar_view(self): from numpypy import int64, array a = array(0, dtype='int32') ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation.
Author: Alex Gaynor Branch: Changeset: r64495:416ab73a45e1 Date: 2013-05-22 16:04 -0700 http://bitbucket.org/pypy/pypy/changeset/416ab73a45e1/ Log:Fix translation. diff --git a/rpython/jit/metainterp/optimizeopt/vstring.py b/rpython/jit/metainterp/optimizeopt/vstring.py --- a/rpython/jit/metainterp/optimizeopt/vstring.py +++ b/rpython/jit/metainterp/optimizeopt/vstring.py @@ -137,6 +137,7 @@ self._chars = [None] * size def shrink(self, length): +assert length >= 0 del self._chars[length:] def setup_slice(self, longerlist, start, stop): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: David Schneider Branch: Changeset: r64372:e50833e88c65 Date: 2013-05-21 07:46 + http://bitbucket.org/pypy/pypy/changeset/e50833e88c65/ Log:fix translation diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -365,7 +365,7 @@ modules = [name for name in modules if name not in essential_modules] if config.translation.platform == 'arm' and '_continuation' in modules: -del modules[modules.find('_continuation')] +modules.remove('_continuation') config.objspace.usemodules.suggest(**dict.fromkeys(modules, True)) def enable_translationmodules(config): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation on ARM, I believe
Author: Maciej Fijalkowski Branch: Changeset: r63484:e64058419d45 Date: 2013-04-18 21:46 +0200 http://bitbucket.org/pypy/pypy/changeset/e64058419d45/ Log:fix translation on ARM, I believe diff --git a/rpython/jit/backend/arm/assembler.py b/rpython/jit/backend/arm/assembler.py --- a/rpython/jit/backend/arm/assembler.py +++ b/rpython/jit/backend/arm/assembler.py @@ -249,7 +249,9 @@ else: self.wb_slowpath[withcards + 2 * withfloats] = rawstart -def _build_malloc_slowpath(self): +def _build_malloc_slowpath(self, kind): +if kind != 'fixed': +return 0 mc = InstrBuilder(self.cpu.arch_version) self._push_all_regs_to_jitframe(mc, [r.r0, r.r1], self.cpu.supports_floats) ofs = self.cpu.get_ofs_of_frame_field('jf_gcmap') ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Brian Kearns Branch: Changeset: r63263:7a2e0a6b013b Date: 2013-04-11 23:17 -0400 http://bitbucket.org/pypy/pypy/changeset/7a2e0a6b013b/ Log:fix translation 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 @@ -12,7 +12,7 @@ class W_BytesIO(RStringIO, W_BufferedIOBase): def __init__(self, space): W_BufferedIOBase.__init__(self, space) -RStringIO.__init__(self) +self.init() def descr_init(self, space, w_initial_bytes=None): if not space.is_none(w_initial_bytes): diff --git a/pypy/module/cStringIO/interp_stringio.py b/pypy/module/cStringIO/interp_stringio.py --- a/pypy/module/cStringIO/interp_stringio.py +++ b/pypy/module/cStringIO/interp_stringio.py @@ -146,7 +146,7 @@ class W_OutputType(RStringIO, W_InputOutputType): def __init__(self, space): -RStringIO.__init__(self) +self.init() self.space = space def descr_truncate(self, w_size=None): diff --git a/rpython/rlib/rStringIO.py b/rpython/rlib/rStringIO.py --- a/rpython/rlib/rStringIO.py +++ b/rpython/rlib/rStringIO.py @@ -11,6 +11,9 @@ _mixin_ = True# for interp_stringio.py def __init__(self): +self.init() + +def init(self): # The real content is the join of the following data: # * the list of characters self.__bigbuffer; # * each of the strings in self.__strings. ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation instructions
Author: Matti Picus Branch: Changeset: r62901:ad0365848ec6 Date: 2013-03-31 16:11 +0300 http://bitbucket.org/pypy/pypy/changeset/ad0365848ec6/ Log:fix translation instructions diff --git a/pypy/doc/arm.rst b/pypy/doc/arm.rst --- a/pypy/doc/arm.rst +++ b/pypy/doc/arm.rst @@ -145,7 +145,7 @@ :: - pypy ~/path_to_pypy_checkout/rpython/translator/goal/translate.py -O1 --platform=arm target.py + pypy ~/path_to_pypy_checkout/rpython/bin/rpython -O1 --platform=arm target.py If everything worked correctly this should yield an ARM binary. Running this binary in the ARM chroot or on an ARM device should produce the output ``"Hello World"``. @@ -153,7 +153,7 @@ :: - pypy /rpython/translator/goal/translate.py -Ojit --platform=arm --gcrootfinder=shadowstack --jit-backend=arm targetpypystandalone.py + pypy /rpython/bin/rpython -Ojit --platform=arm --gcrootfinder=shadowstack --jit-backend=arm targetpypystandalone.py The gcrootfinder option is needed to work around `issue 1377`_ and the jit-backend works around `issue 1376`_ ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation (maybe)
Author: Maciej Fijalkowski Branch: Changeset: r62757:b1537cfcaaed Date: 2013-03-25 14:38 -0700 http://bitbucket.org/pypy/pypy/changeset/b1537cfcaaed/ Log:fix translation (maybe) diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py --- a/pypy/interpreter/function.py +++ b/pypy/interpreter/function.py @@ -22,7 +22,6 @@ assert not func.can_change_code return func.code - class Function(W_Root): """A function is a code object captured with some environment: an object space, a dictionary of globals, default arguments, diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py --- a/pypy/interpreter/gateway.py +++ b/pypy/interpreter/gateway.py @@ -812,6 +812,8 @@ d = {} exec func_code.compile() in d f = d['f'] +f.__module__ = func.__module__ +# necessary for unique identifiers for pickling f.func_name = func.func_name if unwrap_spec is None: unwrap_spec = {} diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py --- a/pypy/objspace/std/floatobject.py +++ b/pypy/objspace/std/floatobject.py @@ -1,7 +1,7 @@ import operator -from pypy.interpreter import gateway from pypy.interpreter.error import OperationError from pypy.objspace.std import model, newformat +from pypy.objspace.std.floattype import float_typedef, W_AbstractFloatObject from pypy.objspace.std.multimethod import FailedToImplementArgs from pypy.objspace.std.model import registerimplementation, W_Object from pypy.objspace.std.register_all import register_all @@ -19,36 +19,14 @@ import math from pypy.objspace.std.intobject import W_IntObject -class W_AbstractFloatObject(W_Object): -__slots__ = () - -def is_w(self, space, w_other): -from rpython.rlib.longlong2float import float2longlong -if not isinstance(w_other, W_AbstractFloatObject): -return False -if self.user_overridden_class or w_other.user_overridden_class: -return self is w_other -one = float2longlong(space.float_w(self)) -two = float2longlong(space.float_w(w_other)) -return one == two - -def immutable_unique_id(self, space): -if self.user_overridden_class: -return None -from rpython.rlib.longlong2float import float2longlong -from pypy.objspace.std.model import IDTAG_FLOAT as tag -val = float2longlong(space.float_w(self)) -b = rbigint.fromrarith_int(val) -b = b.lshift(3).or_(rbigint.fromint(tag)) -return space.newlong_from_rbigint(b) - class W_FloatObject(W_AbstractFloatObject): """This is a implementation of the app-level 'float' type. The constructor takes an RPython float as an argument.""" -from pypy.objspace.std.floattype import float_typedef as typedef _immutable_fields_ = ['floatval'] +typedef = float_typedef + def __init__(w_self, floatval): w_self.floatval = floatval @@ -59,6 +37,9 @@ return self.floatval def int(self, space): +if (type(self) is not W_FloatObject and +space.is_overloaded(self, space.w_float, '__int__')): +return W_Object.int(self, space) try: value = ovfcheck_float_to_int(self.floatval) except OverflowError: diff --git a/pypy/objspace/std/floattype.py b/pypy/objspace/std/floattype.py --- a/pypy/objspace/std/floattype.py +++ b/pypy/objspace/std/floattype.py @@ -3,13 +3,15 @@ from rpython.rlib.unroll import unrolling_iterable from rpython.rlib import rfloat, rarithmetic from pypy.interpreter import typedef -from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault -from pypy.interpreter.baseobjspace import ObjSpace, W_Root +from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault,\ + interpindirect2app from pypy.interpreter.error import OperationError from pypy.objspace.std.register_all import register_all from pypy.objspace.std.stdtypedef import StdTypeDef, SMM from pypy.objspace.std.strutil import ParseStringError from pypy.objspace.std.strutil import string_to_float +from pypy.objspace.std.model import W_Object +from rpython.rlib.rbigint import rbigint float_as_integer_ratio = SMM("as_integer_ratio", 1) @@ -270,6 +272,32 @@ # +class W_AbstractFloatObject(W_Object): +__slots__ = () + +def is_w(self, space, w_other): +from rpython.rlib.longlong2float import float2longlong +if not isinstance(w_other, W_AbstractFloatObject): +return False +if self.user_overridden_class or w_other.user_overridden_class: +return self is w_other +one = float2longlong(space.float_w(self)) +two = float2longlong(space.float_w(w_other)) +return one == two + +def immutable_unique_id(self, space): +if self.user_overridden_class: +return None +from rpython.rlib.longl
[pypy-commit] pypy default: fix translation
Author: Maciej Fijalkowski Branch: Changeset: r62705:97fea5c972a2 Date: 2013-03-23 12:35 -0700 http://bitbucket.org/pypy/pypy/changeset/97fea5c972a2/ Log:fix translation diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py --- a/pypy/objspace/std/intobject.py +++ b/pypy/objspace/std/intobject.py @@ -49,8 +49,8 @@ return float(self.intval) def int(self, space): -if type(self) != W_IntObject and space.is_overloaded(self, space.w_int, - '__int__'): +if (type(self) is not W_IntObject and +space.is_overloaded(self, space.w_int, '__int__')): return W_Object.int(self, space) if space.is_w(space.type(self), space.w_int): return self ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Maciej Fijalkowski Branch: Changeset: r62703:c9e6b6819cbb Date: 2013-03-23 12:22 -0700 http://bitbucket.org/pypy/pypy/changeset/c9e6b6819cbb/ Log:fix translation diff --git a/pypy/module/_cffi_backend/cdataobj.py b/pypy/module/_cffi_backend/cdataobj.py --- a/pypy/module/_cffi_backend/cdataobj.py +++ b/pypy/module/_cffi_backend/cdataobj.py @@ -56,13 +56,13 @@ def nonzero(self): return self.space.wrap(bool(self._cdata)) -def int(self): -w_result = self.ctype.int(self._cdata) +def int(self, space): +w_result = self.ctype.cast_to_int(self._cdata) keepalive_until_here(self) return w_result -def long(self): -w_result = self.int() +def long(self, space): +w_result = self.int(space) space = self.space if space.is_w(space.type(w_result), space.w_int): w_result = space.newlong(space.int_w(w_result)) diff --git a/pypy/module/_cffi_backend/ctypeobj.py b/pypy/module/_cffi_backend/ctypeobj.py --- a/pypy/module/_cffi_backend/ctypeobj.py +++ b/pypy/module/_cffi_backend/ctypeobj.py @@ -54,7 +54,7 @@ raise operationerrfmt(space.w_TypeError, "cannot cast to '%s'", self.name) -def int(self, cdata): +def cast_to_int(self, cdata): space = self.space raise operationerrfmt(space.w_TypeError, "int() not supported on cdata '%s'", self.name) diff --git a/pypy/module/_cffi_backend/ctypeprim.py b/pypy/module/_cffi_backend/ctypeprim.py --- a/pypy/module/_cffi_backend/ctypeprim.py +++ b/pypy/module/_cffi_backend/ctypeprim.py @@ -99,7 +99,7 @@ _attrs_ = [] cast_anything = True -def int(self, cdata): +def cast_to_int(self, cdata): return self.space.wrap(ord(cdata[0])) def convert_to_object(self, cdata): @@ -124,7 +124,7 @@ class W_CTypePrimitiveUniChar(W_CTypePrimitiveCharOrUniChar): _attrs_ = [] -def int(self, cdata): +def cast_to_int(self, cdata): unichardata = rffi.cast(rffi.CWCHARP, cdata) return self.space.wrap(ord(unichardata[0])) @@ -168,7 +168,7 @@ self.vmin = r_uint(-1) << (sh - 1) self.vrangemax = (r_uint(1) << sh) - 1 -def int(self, cdata): +def cast_to_int(self, cdata): return self.convert_to_object(cdata) def convert_to_object(self, cdata): @@ -213,7 +213,7 @@ sh = self.size * 8 return (r_uint(1) << sh) - 1 -def int(self, cdata): +def cast_to_int(self, cdata): return self.convert_to_object(cdata) def convert_from_object(self, cdata, w_ob): @@ -288,7 +288,7 @@ keepalive_until_here(w_cdata) return w_cdata -def int(self, cdata): +def cast_to_int(self, cdata): w_value = self.float(cdata) return self.space.int(w_value) diff --git a/pypy/objspace/std/boolobject.py b/pypy/objspace/std/boolobject.py --- a/pypy/objspace/std/boolobject.py +++ b/pypy/objspace/std/boolobject.py @@ -36,6 +36,8 @@ def float_w(self, space): return float(self.boolval) +def int(self, space): +return self registerimplementation(W_BoolObject) diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py --- a/pypy/objspace/std/intobject.py +++ b/pypy/objspace/std/intobject.py @@ -308,10 +308,6 @@ res = a | b return wrapint(space, res) -# int__Int is supposed to do nothing, unless it has -# a derived integer object, where it should return -# an exact one. - def pos__Int(self, space): return self.int(space) trunc__Int = pos__Int ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation.
Author: Alex Gaynor Branch: Changeset: r62373:46b9ff612805 Date: 2013-03-16 14:27 -0700 http://bitbucket.org/pypy/pypy/changeset/46b9ff612805/ Log:Fix translation. diff --git a/rpython/rlib/rmmap.py b/rpython/rlib/rmmap.py --- a/rpython/rlib/rmmap.py +++ b/rpython/rlib/rmmap.py @@ -13,6 +13,7 @@ _POSIX = os.name == "posix" _MS_WINDOWS = os.name == "nt" _LINUX = "linux" in sys.platform +_DARWIN = sys.platform == "darwin" _64BIT = "64bit" in platform.architecture()[0] _ARM = platform.machine().startswith('arm') _PPC = platform.machine().startswith('ppc') @@ -680,7 +681,7 @@ else: m.fd = os.dup(fd) -if sys.platform == "darwin" and not flags & MAP_SHARED: +if _DARWIN and not flags & MAP_SHARED: flags |= MAP_PRIVATE # XXX if we use hintp below in alloc, the NonConstant ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r61810:1ba981281500 Date: 2013-02-26 07:19 +0200 http://bitbucket.org/pypy/pypy/changeset/1ba981281500/ Log:fix translation diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -507,7 +507,7 @@ if v == 0: # XXX good place to warn return -maxint -return 1 / v +return rffi.cast(self.T, 1) / v @raw_unary_op def signbit(self, v): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation after 34f8c678ef62
Author: Brian Kearns Branch: Changeset: r61647:dc621a04b30d Date: 2013-02-23 03:21 -0500 http://bitbucket.org/pypy/pypy/changeset/dc621a04b30d/ Log:fix translation after 34f8c678ef62 diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -453,13 +453,17 @@ @unwrap_spec(mode=str) def descr_choose(self, space, w_choices, mode='raise', w_out=None): -if not space.is_none(w_out) and not isinstance(w_out, W_NDimArray): +if space.is_none(w_out): +w_out = None +elif not isinstance(w_out, W_NDimArray): raise OperationError(space.w_TypeError, space.wrap( "return arrays must be of ArrayType")) return interp_arrayops.choose(space, self, w_choices, w_out, mode) def descr_clip(self, space, w_min, w_max, w_out=None): -if not space.is_none(w_out) and not isinstance(w_out, W_NDimArray): +if space.is_none(w_out): +w_out = None +elif not isinstance(w_out, W_NDimArray): raise OperationError(space.w_TypeError, space.wrap( "return arrays must be of ArrayType")) min = convert_to_array(space, w_min) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation
Author: Armin Rigo Branch: Changeset: r58826:3701a1f44095 Date: 2012-11-11 12:46 +0100 http://bitbucket.org/pypy/pypy/changeset/3701a1f44095/ Log:Fix translation 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 @@ -86,7 +86,7 @@ return ''.join(argnames) def _fget_args(self): -return self.space.newtuple(self.fargs) +return self.space.newtuple([self.space.wrap(a) for a in self.fargs]) def _fget_result(self): return self.space.wrap(self.ctitem) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation I believe
Author: Alex Gaynor Branch: Changeset: r58819:cb94dcefc50d Date: 2012-11-10 09:53 -0800 http://bitbucket.org/pypy/pypy/changeset/cb94dcefc50d/ Log:fix translation I believe diff --git a/pypy/jit/backend/llsupport/llmodel.py b/pypy/jit/backend/llsupport/llmodel.py --- a/pypy/jit/backend/llsupport/llmodel.py +++ b/pypy/jit/backend/llsupport/llmodel.py @@ -312,7 +312,7 @@ ofs = arraydescr.lendescr.offset return rffi.cast(rffi.CArrayPtr(lltype.Signed), array)[ofs/WORD] -@specialize.argtype(2) +@specialize.argtype(1) def bh_getarrayitem_gc_i(self, gcref, itemindex, arraydescr): ofs, size, sign = self.unpack_arraydescr_size(arraydescr) # --- start of GC unsafe code (no GC operation!) --- @@ -341,7 +341,7 @@ # --- end of GC unsafe code --- return pval -@specialize.argtype(2) +@specialize.argtype(1) def bh_getarrayitem_gc_f(self, gcref, itemindex, arraydescr): ofs = self.unpack_arraydescr(arraydescr) # --- start of GC unsafe code (no GC operation!) --- @@ -351,7 +351,7 @@ # --- end of GC unsafe code --- return fval -@specialize.argtype(2) +@specialize.argtype(1) def bh_setarrayitem_gc_i(self, gcref, itemindex, newvalue, arraydescr): ofs, size, sign = self.unpack_arraydescr_size(arraydescr) # --- start of GC unsafe code (no GC operation!) --- @@ -374,7 +374,7 @@ items[itemindex] = self.cast_gcref_to_int(newvalue) # --- end of GC unsafe code --- -@specialize.argtype(2) +@specialize.argtype(1) def bh_setarrayitem_gc_f(self, gcref, itemindex, newvalue, arraydescr): ofs = self.unpack_arraydescr(arraydescr) # --- start of GC unsafe code (no GC operation!) --- ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation on Macs
Author: David Schneider Branch: Changeset: r55755:9daab4fb1be1 Date: 2012-06-22 17:36 +0200 http://bitbucket.org/pypy/pypy/changeset/9daab4fb1be1/ Log:fix translation on Macs diff --git a/pypy/rpython/module/ll_os.py b/pypy/rpython/module/ll_os.py --- a/pypy/rpython/module/ll_os.py +++ b/pypy/rpython/module/ll_os.py @@ -133,18 +133,24 @@ _WIN32 = True else: _WIN32 = False - if _WIN32: underscore_on_windows = '_' else: underscore_on_windows = '' +_DARWIN = sys.platform.startswith('darwin') + includes = [] if not _WIN32: # XXX many of these includes are not portable at all includes += ['dirent.h', 'sys/stat.h', 'sys/times.h', 'utime.h', 'sys/types.h', 'unistd.h', - 'signal.h', 'sys/wait.h', 'fcntl.h', 'pty.h'] + 'signal.h', 'sys/wait.h', 'fcntl.h'] +if _DARWIN: +includes += ['util.h'] +else: +includes += ['pty.h'] + else: includes += ['sys/utime.h'] ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Matti Picus Branch: Changeset: r54639:88576b6607fa Date: 2012-04-23 02:36 +0300 http://bitbucket.org/pypy/pypy/changeset/88576b6607fa/ Log:fix translation diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -66,7 +66,7 @@ args_w = space.fixedview(w_args) res = generic_cpy_call(space, func_inquiry, w_self) if rffi.cast(lltype.Signed, res) == -1: -space.fromcache(State).check_and_raise_exception() +space.fromcache(State).check_and_raise_exception(always=True) return space.wrap(bool(res)) def wrap_getattr(space, w_self, w_args, func): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation (@Alex_Gaynor)
Author: Matti Picus Branch: Changeset: r54637:0b78258294b6 Date: 2012-04-23 02:15 +0300 http://bitbucket.org/pypy/pypy/changeset/0b78258294b6/ Log:fix translation (@Alex_Gaynor) diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -65,7 +65,7 @@ check_num_args(space, w_args, 0) args_w = space.fixedview(w_args) res = generic_cpy_call(space, func_inquiry, w_self) -if res == -1: +if rffi.cast(lltype.Signed, res) == -1: space.fromcache(State).check_and_raise_exception() return space.wrap(bool(res)) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation (?)
Author: Maciej Fijalkowski Branch: Changeset: r54116:ba8760573e6d Date: 2012-04-01 15:52 +0200 http://bitbucket.org/pypy/pypy/changeset/ba8760573e6d/ Log:fix translation (?) diff --git a/pypy/module/cpyext/pyerrors.py b/pypy/module/cpyext/pyerrors.py --- a/pypy/module/cpyext/pyerrors.py +++ b/pypy/module/cpyext/pyerrors.py @@ -57,7 +57,7 @@ if operror: ptype[0] = make_ref(space, operror.w_type) pvalue[0] = make_ref(space, operror.get_w_value(space)) -ptraceback[0] = make_ref(space, space.wrap(operror.get_traceback())) +ptraceback[0] = make_ref(space, operror.get_traceback()) else: ptype[0] = lltype.nullptr(PyObject.TO) pvalue[0] = lltype.nullptr(PyObject.TO) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation
Author: Amaury Forgeot d'Arc Branch: Changeset: r52533:f272bf10ef94 Date: 2012-02-16 00:17 +0100 http://bitbucket.org/pypy/pypy/changeset/f272bf10ef94/ Log:Fix translation diff --git a/pypy/module/cpyext/pystate.py b/pypy/module/cpyext/pystate.py --- a/pypy/module/cpyext/pystate.py +++ b/pypy/module/cpyext/pystate.py @@ -61,6 +61,7 @@ return MemoryCapsule def ThreadState_dealloc(ts, space): +assert space is not None Py_DecRef(space, ts.c_dict) ThreadStateCapsule = encapsulator(PyThreadState.TO, dealloc=ThreadState_dealloc) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Alex Gaynor Branch: Changeset: r50227:4d94de61c725 Date: 2011-12-06 16:01 -0500 http://bitbucket.org/pypy/pypy/changeset/4d94de61c725/ Log:fix translation diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -852,7 +852,7 @@ if len(args_w) == 1: w_shape = args_w[0] else: -w_shape = space.newlist(args_w) +w_shape = space.newtuple(args_w) concrete = self.get_concrete() new_shape = get_shape_from_iterable(space, concrete.find_size(), w_shape) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Alex Gaynor Branch: Changeset: r50004:9eec6149907c Date: 2011-11-29 23:27 -0500 http://bitbucket.org/pypy/pypy/changeset/9eec6149907c/ Log:fix translation diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py --- a/pypy/module/micronumpy/interp_dtype.py +++ b/pypy/module/micronumpy/interp_dtype.py @@ -131,7 +131,7 @@ def binop(func): -func._annspecialcase_ = "specialize:call_location" +specialize.argtype(1, 2)(func) @functools.wraps(func) def impl(self, v1, v2): return self.adapt_val(func(self, @@ -141,6 +141,7 @@ return impl def raw_binop(func): +specialize.argtype(1, 2)(func) # Returns the result unwrapped. @functools.wraps(func) def impl(self, v1, v2): @@ -151,6 +152,7 @@ return impl def unaryop(func): +specialize.argtype(1)(func) @functools.wraps(func) def impl(self, v): return self.adapt_val(func(self, self.for_computation(self.unbox(v ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation hopefully
Author: Maciej Fijalkowski Branch: Changeset: r49899:86a762812948 Date: 2011-11-28 16:40 +0200 http://bitbucket.org/pypy/pypy/changeset/86a762812948/ Log:fix translation hopefully diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -963,7 +963,9 @@ return Call1Iterator(self.values.start_iter(res_shape)) def debug_repr(self): -call_sig = self.signature.components[0] +sig = self.signature +assert isinstance(sig, signature.Signature) +call_sig = sig.components[0] assert isinstance(call_sig, signature.Call1) if self.forced_result is not None: return 'Call1(%s, forced=%s)' % (call_sig.func.func_name, @@ -1011,7 +1013,9 @@ return call_sig.func(self.calc_dtype, lhs, rhs) def debug_repr(self): -call_sig = self.signature.components[0] +sig = self.signature +assert isinstance(sig, signature.Signature) +call_sig = sig.components[0] assert isinstance(call_sig, signature.Call2) if self.forced_result is not None: return 'Call2(%s, forced=%s)' % (call_sig.func.func_name, ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation hopefully
Author: Alex Gaynor Branch: Changeset: r49896:67ac82a4bea4 Date: 2011-11-28 07:23 -0500 http://bitbucket.org/pypy/pypy/changeset/67ac82a4bea4/ Log:fix translation hopefully diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -1121,7 +1121,11 @@ def copy(self): array = NDimArray(self.size, self.shape[:], self.dtype, self.order) -rffi.c_memcpy(array.storage, self.storage, self.size * self.dtype.num_bytes) +rffi.c_memcpy( +rffi.cast(rffi.VOIDP, array.storage), +rffi.cast(rffi.VOIDP, self.storage), +self.size * self.dtype.num_bytes +) return array def descr_len(self, space): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation
Author: Alex Gaynor Branch: Changeset: r48354:10f7167b3e98 Date: 2011-10-22 22:34 -0700 http://bitbucket.org/pypy/pypy/changeset/10f7167b3e98/ Log:fix translation diff --git a/pypy/jit/backend/llsupport/descr.py b/pypy/jit/backend/llsupport/descr.py --- a/pypy/jit/backend/llsupport/descr.py +++ b/pypy/jit/backend/llsupport/descr.py @@ -203,8 +203,6 @@ class StructArrayDescr(BaseArrayDescr): _clsname = 'StructArrayDescr' _is_array_of_structs = True -def get_item_size(self, translate_support_code): -return symbolic.get_size() class BaseArrayNoLengthDescr(BaseArrayDescr): def get_base_size(self, translate_support_code): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation.
Author: Alex Gaynor Branch: Changeset: r47356:6846a02685ec Date: 2011-09-19 15:12 -0400 http://bitbucket.org/pypy/pypy/changeset/6846a02685ec/ Log:fix translation. diff --git a/pypy/jit/metainterp/heapcache.py b/pypy/jit/metainterp/heapcache.py --- a/pypy/jit/metainterp/heapcache.py +++ b/pypy/jit/metainterp/heapcache.py @@ -30,11 +30,13 @@ self.clear_caches(opnum, descr, argboxes) def mark_escaped(self, opnum, argboxes): -for idx, box in enumerate(argboxes): +idx = 0 +for box in argboxes: # setfield_gc and setarrayitem_gc don't escape their first argument if not (idx == 0 and opnum in [rop.SETFIELD_GC, rop.SETARRAYITEM_GC]): if box in self.new_boxes: self.new_boxes[box] = False +idx += 1 def clear_caches(self, opnum, descr, argboxes): if opnum == rop.SETFIELD_GC: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation, hopefully
Author: Maciej Fijalkowski Branch: Changeset: r47215:971b55704207 Date: 2011-09-12 12:29 +0200 http://bitbucket.org/pypy/pypy/changeset/971b55704207/ Log:fix translation, hopefully diff --git a/pypy/module/__pypy__/interp_builders.py b/pypy/module/__pypy__/interp_builders.py --- a/pypy/module/__pypy__/interp_builders.py +++ b/pypy/module/__pypy__/interp_builders.py @@ -3,6 +3,7 @@ from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.typedef import TypeDef from pypy.rlib.rstring import UnicodeBuilder, StringBuilder +from pypy.tool.sourcetools import func_with_new_name def create_builder(name, strtype, builder_cls): @@ -41,8 +42,9 @@ W_Builder.__name__ = "W_%s" % name W_Builder.typedef = TypeDef(name, -__new__ = interp2app(W_Builder.descr__new__.im_func), - +__new__ = interp2app(func_with_new_name( +W_Builder.descr__new__.im_func, +'%s_new' % (name,))), append = interp2app(W_Builder.descr_append), append_slice = interp2app(W_Builder.descr_append_slice), build = interp2app(W_Builder.descr_build), @@ -51,4 +53,4 @@ return W_Builder W_StringBuilder = create_builder("StringBuilder", str, StringBuilder) -W_UnicodeBuilder = create_builder("UnicodeBuilder", unicode, UnicodeBuilder) \ No newline at end of file +W_UnicodeBuilder = create_builder("UnicodeBuilder", unicode, UnicodeBuilder) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation (and you know.. functionality) on windows.
Author: Alex Gaynor Branch: Changeset: r47199:84ad4c442f43 Date: 2011-09-10 19:04 -0700 http://bitbucket.org/pypy/pypy/changeset/84ad4c442f43/ Log:Fix translation (and you know.. functionality) on windows. diff --git a/pypy/rlib/rwin32.py b/pypy/rlib/rwin32.py --- a/pypy/rlib/rwin32.py +++ b/pypy/rlib/rwin32.py @@ -235,7 +235,7 @@ @jit.dont_look_inside def GetVersionEx(): -info = lltype.malloc(OSVERSIONINFO, flavor='raw') +info = lltype.malloc(OSVERSIONINFOEX, flavor='raw') rffi.setintfield(info, 'c_dwOSVersionInfoSize', rffi.sizeof(OSVERSIONINFOEX)) try: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation
Author: Amaury Forgeot d'Arc Branch: Changeset: r47095:517b88c3b7d5 Date: 2011-09-06 02:02 +0200 http://bitbucket.org/pypy/pypy/changeset/517b88c3b7d5/ Log:Fix translation diff --git a/pypy/module/pwd/interp_pwd.py b/pypy/module/pwd/interp_pwd.py --- a/pypy/module/pwd/interp_pwd.py +++ b/pypy/module/pwd/interp_pwd.py @@ -4,10 +4,12 @@ from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.error import OperationError, operationerrfmt +eci = ExternalCompilationInfo( +includes=['pwd.h'] +) + class CConfig: -_compilation_info_ = ExternalCompilationInfo( -includes=['pwd.h'] -) +_compilation_info_ = eci uid_t = rffi_platform.SimpleType("uid_t") @@ -26,11 +28,14 @@ passwd_p = lltype.Ptr(config['passwd']) uid_t = config['uid_t'] -c_getpwuid = rffi.llexternal("getpwuid", [uid_t], passwd_p) -c_getpwnam = rffi.llexternal("getpwnam", [rffi.CCHARP], passwd_p) -c_setpwent = rffi.llexternal("setpwent", [], lltype.Void) -c_getpwent = rffi.llexternal("getpwent", [], passwd_p) -c_endpwent = rffi.llexternal("endpwent", [], lltype.Void) +def external(name, args, result, **kwargs): +return rffi.llexternal(name, args, result, compilation_info=eci, **kwargs) + +c_getpwuid = external("getpwuid", [uid_t], passwd_p) +c_getpwnam = external("getpwnam", [rffi.CCHARP], passwd_p) +c_setpwent = external("setpwent", [], lltype.Void) +c_getpwent = external("getpwent", [], passwd_p) +c_endpwent = external("endpwent", [], lltype.Void) def make_struct_passwd(space, pw): w_passwd_struct = space.getattr(space.getbuiltinmodule('pwd'), ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation (whoops).
Author: Alex Gaynor Branch: Changeset: r45656:cfa96ceb9935 Date: 2011-07-15 23:08 -0700 http://bitbucket.org/pypy/pypy/changeset/cfa96ceb9935/ Log:Fix translation (whoops). diff --git a/pypy/module/_file/interp_stream.py b/pypy/module/_file/interp_stream.py --- a/pypy/module/_file/interp_stream.py +++ b/pypy/module/_file/interp_stream.py @@ -3,7 +3,7 @@ from pypy.rlib.streamio import StreamErrors from pypy.interpreter.error import OperationError, wrap_oserror2 -from pypy.interpreter.baseobjspace import Wrappable +from pypy.interpreter.baseobjspace import ObjSpace, Wrappable from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation.
Author: Alex Gaynor Branch: Changeset: r45257:826ab6a098e6 Date: 2011-07-01 21:11 -0700 http://bitbucket.org/pypy/pypy/changeset/826ab6a098e6/ Log:Fix translation. diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py --- a/pypy/objspace/std/dictmultiobject.py +++ b/pypy/objspace/std/dictmultiobject.py @@ -453,7 +453,7 @@ def next_entry(self): # note that this 'for' loop only runs once, at most for key, w_value in self.iterator: -return self.dictimplementation.strategy.wrap(key), w_value +return self.space.wrap(key), w_value else: return None, None @@ -495,7 +495,7 @@ def next_entry(self): # note that this 'for' loop only runs once, at most for key, w_value in self.iterator: -return self.dictimplementation.strategy.wrap(key), w_value +return self.space.wrap(key), w_value else: return None, None @@ -507,8 +507,8 @@ def next_entry(self): # note that this 'for' loop only runs once, at most -for key, w_value in self.iterator: -return self.dictimplementation.strategy.wrap(key), w_value +for w_key, w_value in self.iterator: +return w_key, w_value else: return None, None ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix translation on 32-bit.
Author: Armin Rigo Branch: Changeset: r45137:65b1ed60d7da Date: 2011-06-26 13:46 +0200 http://bitbucket.org/pypy/pypy/changeset/65b1ed60d7da/ Log:Fix translation on 32-bit. diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py --- a/pypy/jit/backend/x86/assembler.py +++ b/pypy/jit/backend/x86/assembler.py @@ -706,7 +706,7 @@ if rx86.fits_in_32bits(rst): self.mc.MOV_rj(eax.value, rst)# MOV eax, [rootstacktop] else: -self.mc.MOV_ri64(r13.value, rst) # MOV r13, rootstacktop +self.mc.MOV_ri(r13.value, rst)# MOV r13, rootstacktop self.mc.MOV_rm(eax.value, (r13.value, 0)) # MOV eax, [r13] # self.mc.LEA_rm(ebx.value, (eax.value, 2*WORD)) # LEA ebx, [eax+2*WORD] @@ -723,7 +723,7 @@ if rx86.fits_in_32bits(rst): self.mc.SUB_ji8(rst, 2*WORD) # SUB [rootstacktop], 2*WORD else: -self.mc.MOV_ri64(ebx.value, rst) # MOV ebx, rootstacktop +self.mc.MOV_ri(ebx.value, rst) # MOV ebx, rootstacktop self.mc.SUB_mi8((ebx.value, 0), 2*WORD) # SUB [ebx], 2*WORD def _assemble_bootstrap_direct_call(self, arglocs, jmppos, stackdepth): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix translation. no cookie for fijal.
Author: Alex Gaynor Branch: Changeset: r45027:38b3bfe9ac3f Date: 2011-06-19 20:56 -0700 http://bitbucket.org/pypy/pypy/changeset/38b3bfe9ac3f/ Log:fix translation. no cookie for fijal. diff --git a/pypy/module/pypyjit/interp_resop.py b/pypy/module/pypyjit/interp_resop.py --- a/pypy/module/pypyjit/interp_resop.py +++ b/pypy/module/pypyjit/interp_resop.py @@ -29,6 +29,7 @@ llcode = lltype.cast_opaque_ptr(lltype.Ptr(OBJECT), boxes[4].getref_base()) pycode = cast_base_ptr_to_instance(PyCode, llcode) +assert pycode is not None return W_DebugMergePoint(mp_no, offset, pycode) W_DebugMergePoint.typedef = TypeDef( ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit