[pypy-commit] pypy py3.5: fix translation?
Author: Matti PicusBranch: py3.5 Changeset: r93636:29875e4930fc Date: 2018-01-08 08:09 +0200 http://bitbucket.org/pypy/pypy/changeset/29875e4930fc/ Log:fix translation? diff --git a/pypy/module/cpyext/methodobject.py b/pypy/module/cpyext/methodobject.py --- a/pypy/module/cpyext/methodobject.py +++ b/pypy/module/cpyext/methodobject.py @@ -190,7 +190,7 @@ assert isinstance(w_objclass, W_TypeObject) raise oefmt(space.w_TypeError, "descriptor '%8' of '%s' object needs an argument", -self.name, w_objclass.name) +self.name, self.w_objclass.getname(space)) w_instance = __args__.arguments_w[0] # XXX: needs a stricter test if not space.isinstance_w(w_instance, self.w_objclass): @@ -230,7 +230,7 @@ def descr_call(self, space, __args__): if len(__args__.arguments_w) == 0: raise oefmt(space.w_TypeError, -"descriptor '%s' of '%s' object needs an argument", +"descriptor '%8' of '%s' object needs an argument", self.name, self.w_objclass.getname(space)) w_instance = __args__.arguments_w[0] # XXX typecheck missing # CCC: we can surely do better than this ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation?
Author: Matti PicusBranch: py3.5 Changeset: r93526:0fda157e0d0e Date: 2017-12-21 07:15 +0200 http://bitbucket.org/pypy/pypy/changeset/0fda157e0d0e/ Log:fix translation? diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -204,7 +204,7 @@ if lastdirname: basename = '%s/%s' % (lastdirname, basename) self.co_filename = '/%s' % (basename,) -self.w_filename = space.newfilename(self.co_filename) +self.w_filename = self.space.newfilename(self.co_filename) co_names = property(lambda self: [self.space.str_w(w_name) for w_name in self.co_names_w]) # for trace ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r93451:b1f6c07626d3 Date: 2017-12-17 21:23 + http://bitbucket.org/pypy/pypy/changeset/b1f6c07626d3/ Log:fix translation diff --git a/pypy/module/_continuation/interp_pickle.py b/pypy/module/_continuation/interp_pickle.py --- a/pypy/module/_continuation/interp_pickle.py +++ b/pypy/module/_continuation/interp_pickle.py @@ -2,10 +2,9 @@ from rpython.rlib import jit from pypy.interpreter.error import OperationError from pypy.interpreter.pyframe import PyFrame -from pypy.module._continuation.interp_continuation import State, global_state -from pypy.module._continuation.interp_continuation import build_sthread -from pypy.module._continuation.interp_continuation import post_switch -from pypy.module._continuation.interp_continuation import get_result, geterror +from pypy.module._continuation.interp_continuation import ( +State, global_state, build_sthread, pre_switch, post_switch, +get_result, geterror) def getunpickle(space): @@ -65,9 +64,10 @@ if self.bottomframe is None: w_result = space.w_None else: +saved_exception = pre_switch(sthread) h = sthread.switch(self.h) try: -w_result = post_switch(sthread, h) +w_result = post_switch(sthread, h, saved_exception) operr = None except OperationError as e: w_result = None ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92990:92c6fb568fa1 Date: 2017-11-11 15:51 + http://bitbucket.org/pypy/pypy/changeset/92c6fb568fa1/ Log:fix translation diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py --- a/pypy/objspace/std/typeobject.py +++ b/pypy/objspace/std/typeobject.py @@ -977,6 +977,7 @@ w_type.setdictvalue(space, '__doc__', w_value) def type_get_txtsig(space, w_type): +w_type = _check(space, w_type) if w_type.text_signature is None: return space.w_None return space.newtext(w_type.text_signature) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92636:3f5373832c7a Date: 2017-10-07 17:57 +0200 http://bitbucket.org/pypy/pypy/changeset/3f5373832c7a/ Log:fix translation 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 @@ -68,9 +68,10 @@ def unicode_attach(space, py_obj, w_obj, w_userdata=None): "Fills a newly allocated PyUnicodeObject with a unicode string" -set_wsize(py_obj, len(space.unicode_w(w_obj))) +value = space.unicode_w(w_obj) +set_wsize(py_obj, len(value) set_wbuffer(py_obj, lltype.nullptr(rffi.CWCHARP.TO)) -_readify(space, py_obj, w_obj._value) +_readify(space, py_obj, value) def unicode_realize(space, py_obj): """ ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92548:527396233189 Date: 2017-10-02 11:02 +0200 http://bitbucket.org/pypy/pypy/changeset/527396233189/ Log:Fix translation diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py --- a/pypy/module/cpyext/api.py +++ b/pypy/module/cpyext/api.py @@ -14,6 +14,7 @@ from rpython.rlib.rfile import (FILEP, c_fread, c_fclose, c_fwrite, c_fdopen, c_fileno, c_fopen)# for tests +from rpython.rlib import jit from rpython.translator import cdir from rpython.translator.tool.cbuild import ExternalCompilationInfo from rpython.translator.gensupp import NameManager @@ -1669,6 +1670,7 @@ state.fixup_extension(w_mod, name, path) return w_mod +@jit.dont_look_inside def exec_extension_module(space, w_mod): from pypy.module.cpyext.modsupport import exec_def if not space.config.objspace.usemodules.cpyext: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92463:ca8b2b8a0df0 Date: 2017-09-25 03:01 +0100 http://bitbucket.org/pypy/pypy/changeset/ca8b2b8a0df0/ Log:fix translation diff --git a/pypy/module/cpyext/genobject.py b/pypy/module/cpyext/genobject.py --- a/pypy/module/cpyext/genobject.py +++ b/pypy/module/cpyext/genobject.py @@ -20,6 +20,7 @@ _, PyCoro_CheckExact = build_type_checkers("Coro", Coroutine) def gi_attach(space, py_obj, w_obj, w_userdata=None): +assert isinstance(w_obj, GeneratorIterator) cts.cast('PyGenObject*', py_obj).c_gi_code = as_pyobj(space, w_obj.pycode) def gi_realize(space, py_obj): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation again
Author: Ronan LamyBranch: py3.5 Changeset: r92408:a874c797101f Date: 2017-09-15 22:55 +0100 http://bitbucket.org/pypy/pypy/changeset/a874c797101f/ Log:fix translation again 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 @@ -314,6 +314,7 @@ if size < 0: raise oefmt(space.w_ValueError, "size must be positive") data = cts.cast('char *', data) +kind = widen(kind) if kind == _1BYTE_KIND: value = rffi.charpsize2str(data, size) w_res = latin_1_decode(space, value, w_final=space.w_False) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92407:5ad69386dfac Date: 2017-09-15 22:33 +0100 http://bitbucket.org/pypy/pypy/changeset/5ad69386dfac/ Log:fix translation 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 @@ -313,6 +313,7 @@ def PyUnicode_FromKindAndData(space, kind, data, size): if size < 0: raise oefmt(space.w_ValueError, "size must be positive") +data = cts.cast('char *', data) if kind == _1BYTE_KIND: value = rffi.charpsize2str(data, size) w_res = latin_1_decode(space, value, w_final=space.w_False) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Matti PicusBranch: py3.5 Changeset: r92401:2ec9c954ee0a Date: 2017-09-15 12:46 +0300 http://bitbucket.org/pypy/pypy/changeset/2ec9c954ee0a/ Log:fix translation 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 @@ -943,7 +943,7 @@ res = PyType_GenericAlloc(space, space.w_type, 0) res = cts.cast('PyHeapTypeObject *', res) typ = res.c_ht_type -typ.c_tp_flags = rffi.cast(lltype.Signed, spec.c_flags) +typ.c_tp_flags = rffi.cast(lltype.Unsigned, spec.c_flags) typ.c_tp_flags |= Py_TPFLAGS_HEAPTYPE specname = rffi.charp2str(cts.cast('char*', spec.c_name)) dotpos = specname.rfind('.') ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92311:87310894a32d Date: 2017-09-03 11:40 +0100 http://bitbucket.org/pypy/pypy/changeset/87310894a32d/ Log:fix translation diff --git a/pypy/module/cpyext/modsupport.py b/pypy/module/cpyext/modsupport.py --- a/pypy/module/cpyext/modsupport.py +++ b/pypy/module/cpyext/modsupport.py @@ -153,7 +153,7 @@ execf = rffi.cast(execfunctype, cur_slot[0].c_value) res = generic_cpy_call_dont_convert_result(space, execf, w_mod) state = space.fromcache(State) -if res: +if rffi.cast(lltype.Signed, res): state.check_and_raise_exception() raise oefmt(space.w_SystemError, "execution of module %S failed without " ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r92138:4c0d6aa834a4 Date: 2017-08-13 00:01 +0200 http://bitbucket.org/pypy/pypy/changeset/4c0d6aa834a4/ Log:fix translation diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py --- a/pypy/interpreter/function.py +++ b/pypy/interpreter/function.py @@ -598,7 +598,7 @@ else: w_builtins = space.getbuiltinmodule('builtins') new_inst = space.getattr(w_builtins, space.newtext('getattr')) -tup = [w_instance, space.newtext(self.w_function.name)] +tup = [w_instance, space.newunicode(w_function.getname(space))] return space.newtuple([new_inst, space.newtuple(tup)]) diff --git a/pypy/module/cpyext/methodobject.py b/pypy/module/cpyext/methodobject.py --- a/pypy/module/cpyext/methodobject.py +++ b/pypy/module/cpyext/methodobject.py @@ -46,7 +46,7 @@ class W_PyCFunctionObject(W_Root): def __init__(self, space, ml, w_self, w_module=None): self.ml = ml -self.name = rffi.charp2str(rffi.cast(rffi.CCHARP,self.ml.c_ml_name)) +self.name = rffi.charp2str(rffi.cast(rffi.CCHARP, self.ml.c_ml_name)) self.w_self = w_self self.w_module = w_module @@ -205,8 +205,8 @@ args_w, kw_w = __args__.unpack() if len(args_w) < 1: raise oefmt(space.w_TypeError, -"descriptor '%s' of '%s' object needs an argument", -self.name, self.w_objclass.getname(space)) +"descriptor '%8' of '%N' object needs an argument", +self.name, self.w_objclass) w_instance = args_w[0] # XXX typecheck missing w_args = space.newtuple(args_w[1:]) w_kw = space.newdict() @@ -328,8 +328,8 @@ if not method.c_ml_name: break if name == "__methods__": -method_list_w.append( -space.newtext(rffi.charp2str(rffi.cast(rffi.CCHARP, method.c_ml_name +method_list_w.append(space.newtext(rffi.charp2str( +rffi.cast(rffi.CCHARP, method.c_ml_name elif rffi.charp2str(rffi.cast(rffi.CCHARP, method.c_ml_name)) == name: # XXX expensive copy return W_PyCFunctionObject(space, method, w_obj) if name == "__methods__": ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation on Windows. space.text_w returns an RPython bytestring.
Author: Amaury Forgeot d'ArcBranch: py3.5 Changeset: r91656:f5d11f59787a Date: 2017-06-27 23:46 +0200 http://bitbucket.org/pypy/pypy/changeset/f5d11f59787a/ Log:Fix translation on Windows. space.text_w returns an RPython bytestring. diff --git a/pypy/module/_cffi_backend/errorbox.py b/pypy/module/_cffi_backend/errorbox.py --- a/pypy/module/_cffi_backend/errorbox.py +++ b/pypy/module/_cffi_backend/errorbox.py @@ -86,7 +86,7 @@ return w_text = self.space.call_function(w_done) -p = rffi.unicode2wcharp(self.space.text_w(w_text), +p = rffi.unicode2wcharp(self.space.unicode_w(w_text), track_allocation=False) if self.text_p: rffi.free_wcharp(self.text_p, track_allocation=False) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation on OS X (and likely FreeBSD as well)
Author: Dan Villiom Podlaski ChristiansenBranch: py3.5 Changeset: r91479:86914a929334 Date: 2017-05-31 22:05 +0200 http://bitbucket.org/pypy/pypy/changeset/86914a929334/ Log:Fix translation on OS X (and likely FreeBSD as well) BSDs don't provide SCHED_BATCH, so remove the assert that checks for its presence. diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py --- a/pypy/module/posix/__init__.py +++ b/pypy/module/posix/__init__.py @@ -235,8 +235,8 @@ interpleveldefs['sched_get_priority_min'] = 'interp_posix.sched_get_priority_min' for _name in ['SCHED_FIFO', 'SCHED_RR', 'SCHED_OTHER', 'SCHED_BATCH']: -assert getattr(rposix, _name) is not None, "missing %r" % (_name,) -interpleveldefs[_name] = 'space.wrap(%d)' % getattr(rposix, _name) +if getattr(rposix, _name) is not None: +interpleveldefs[_name] = 'space.wrap(%d)' % getattr(rposix, _name) for _name in ["O_CLOEXEC"]: if getattr(rposix, _name) is not None: diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -944,7 +944,8 @@ assert posix.sched_get_priority_max(posix.SCHED_FIFO) != -1 assert posix.sched_get_priority_max(posix.SCHED_RR) != -1 assert posix.sched_get_priority_max(posix.SCHED_OTHER) != -1 -assert posix.sched_get_priority_max(posix.SCHED_BATCH) != -1 +if getattr(posix, 'SCHED_BATCH', None): +assert posix.sched_get_priority_max(posix.SCHED_BATCH) != -1 if hasattr(rposix, 'sched_get_priority_min'): def test_os_sched_get_priority_min(self): @@ -953,7 +954,8 @@ assert posix.sched_get_priority_min(posix.SCHED_FIFO) != -1 assert posix.sched_get_priority_min(posix.SCHED_RR) != -1 assert posix.sched_get_priority_min(posix.SCHED_OTHER) != -1 -assert posix.sched_get_priority_min(posix.SCHED_BATCH) != -1 +if getattr(posix, 'SCHED_BATCH', None): +assert posix.sched_get_priority_min(posix.SCHED_BATCH) != -1 if hasattr(rposix, 'sched_get_priority_min'): def test_os_sched_priority_max_greater_than_min(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r91277:2157c3d029f1 Date: 2017-05-13 14:59 +0100 http://bitbucket.org/pypy/pypy/changeset/2157c3d029f1/ 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 @@ -79,7 +79,7 @@ def getname(self, space): try: -return space.text_w(space.getattr(self, space.newtext('__name__'))) +return space.unicode_w(space.getattr(self, space.newtext('__name__'))) except OperationError as e: if e.match(space, space.w_TypeError) or e.match(space, space.w_AttributeError): return u'?' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation
Author: Amaury Forgeot d'ArcBranch: py3.5 Changeset: r91070:61b843dccbd8 Date: 2017-04-17 18:21 +0200 http://bitbucket.org/pypy/pypy/changeset/61b843dccbd8/ Log:Fix translation diff --git a/pypy/interpreter/astcompiler/symtable.py b/pypy/interpreter/astcompiler/symtable.py --- a/pypy/interpreter/astcompiler/symtable.py +++ b/pypy/interpreter/astcompiler/symtable.py @@ -135,7 +135,7 @@ err = "no binding for nonlocal '%s' found" % (name,) raise SyntaxError(err, self.lineno, self.col_offset) self.symbols[name] = SCOPE_FREE -self.free_vars[name] = None +self.free_vars.append(name) free[name] = None self.has_free = True elif flags & SYM_BOUND: @@ -147,7 +147,7 @@ pass elif bound and name in bound: self.symbols[name] = SCOPE_FREE -self.free_vars[name] = None +self.free_vars.append(name) free[name] = None self.has_free = True elif name in globs: @@ -204,7 +204,7 @@ except KeyError: if bound and name in bound: self.symbols[name] = SCOPE_FREE -self.free_vars[name] = None +self.free_vars.append(name) else: if role_here & (SYM_BOUND | SYM_GLOBAL) and \ self._hide_bound_from_nested_scopes: @@ -213,7 +213,7 @@ # scope. We add the name to the class scope's list of free # vars, so it will be passed through by the interpreter, but # we leave the scope alone, so it can be local on its own. -self.free_vars[name] = None +self.free_vars.append(name) self._check_optimization() free.update(new_free) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation for platforms without tm_zone
Author: Amaury Forgeot d'ArcBranch: py3.5 Changeset: r90908:4dec46cc728e Date: 2017-04-01 22:00 +0200 http://bitbucket.org/pypy/pypy/changeset/4dec46cc728e/ Log:Fix translation for platforms without tm_zone diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py --- a/pypy/module/time/interp_time.py +++ b/pypy/module/time/interp_time.py @@ -588,10 +588,10 @@ rffi.setintfield(glob_buf, 'c_tm_yday', tm_yday) rffi.setintfield(glob_buf, 'c_tm_isdst', space.c_int_w(tup_w[8])) # -old_tm_zone = glob_buf.c_tm_zone -glob_buf.c_tm_zone = lltype.nullptr(rffi.CCHARP.TO) -rffi.setintfield(glob_buf, 'c_tm_gmtoff', 0) if HAS_TM_ZONE : +old_tm_zone = glob_buf.c_tm_zone +glob_buf.c_tm_zone = lltype.nullptr(rffi.CCHARP.TO) +rffi.setintfield(glob_buf, 'c_tm_gmtoff', 0) if len(tup_w) >= 10: # NOTE this is not cleanly solved! # it saves the string that is later deleted when this ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation; millisecs should be ints.
Author: Amaury Forgeot d'ArcBranch: py3.5 Changeset: r90907:6c201838bca7 Date: 2017-04-01 21:29 +0200 http://bitbucket.org/pypy/pypy/changeset/6c201838bca7/ Log:Fix translation; millisecs should be ints. diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py --- a/pypy/module/time/interp_time.py +++ b/pypy/module/time/interp_time.py @@ -465,10 +465,10 @@ main_thread = space.fromcache(State).main_thread interruptible = (main_thread == thread.get_ident()) millisecs = int(secs * 1000) -if millisecs == 0.0 or not interruptible: +if millisecs == 0 or not interruptible: rtime.sleep(secs) break -MAX = sys.maxint / 1000.0 # > 24 days +MAX = int(sys.maxint / 1000) # > 24 days if millisecs > MAX: millisecs = MAX interrupt_event = space.fromcache(State).get_interrupt_event() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Philip JenveyBranch: py3.5 Changeset: r90763:b1691349d5f1 Date: 2017-03-20 18:03 +0200 http://bitbucket.org/pypy/pypy/changeset/b1691349d5f1/ 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 @@ -76,6 +76,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 py3.5: fix translation (arigato around)
Author: Matti PicusBranch: py3.5 Changeset: r90716:e08e9c6ffbd8 Date: 2017-03-15 22:16 +0200 http://bitbucket.org/pypy/pypy/changeset/e08e9c6ffbd8/ Log:fix translation (arigato around) diff --git a/pypy/module/cpyext/modsupport.py b/pypy/module/cpyext/modsupport.py --- a/pypy/module/cpyext/modsupport.py +++ b/pypy/module/cpyext/modsupport.py @@ -23,9 +23,9 @@ Most uses of this function should be using PyModule_Create() instead; only use this if you are sure you need it.""" -modname = rffi.charp2str(module.c_m_name) +modname = rffi.charp2str(rffi.cast(rffi.CCHARP, module.c_m_name)) if module.c_m_doc: -doc = rffi.charp2str(module.c_m_doc) +doc = rffi.charp2str(rffi.cast(rffi.CCHARP, module.c_m_doc)) else: doc = None methods = module.c_m_methods ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation (errmsg must be str, not unicode)
Author: Ronan LamyBranch: py3.5 Changeset: r90105:5ddabb9320f9 Date: 2017-02-13 21:25 + http://bitbucket.org/pypy/pypy/changeset/5ddabb9320f9/ Log:fix translation (errmsg must be str, not unicode) diff --git a/pypy/module/_codecs/locale.py b/pypy/module/_codecs/locale.py --- a/pypy/module/_codecs/locale.py +++ b/pypy/module/_codecs/locale.py @@ -58,7 +58,7 @@ errorpos = rffi.cast(lltype.Signed, errorposp[0]) if errorpos == -1: raise MemoryError -errmsg = _errmsg(u"pypy_wchar2char") +errmsg = _errmsg("pypy_wchar2char") errorhandler('strict', 'filesystemencoding', errmsg, u, errorpos, errorpos + 1) return rffi.charp2str(sbuf) @@ -81,7 +81,7 @@ ubuf = pypy_char2wchar(sbuf, sizep) try: if not ubuf: -errmsg = _errmsg(u"pypy_char2wchar") +errmsg = _errmsg("pypy_char2wchar") errorhandler('strict', 'filesystemencoding', errmsg, s, 0, 1) size = rffi.cast(lltype.Signed, sizep[0]) return rawwcharp2unicoden(ubuf, size) @@ -91,7 +91,7 @@ def _errmsg(what): # I *think* that the functions in locale_codec.c don't set errno -return u"%s failed" % what +return "%s failed" % what class scoped_unicode2rawwcharp: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r89668:8a00871322e3 Date: 2017-01-18 20:03 + http://bitbucket.org/pypy/pypy/changeset/8a00871322e3/ Log:fix translation diff --git a/pypy/module/cpyext/import_.py b/pypy/module/cpyext/import_.py --- a/pypy/module/cpyext/import_.py +++ b/pypy/module/cpyext/import_.py @@ -56,6 +56,7 @@ PyObject *name, PyObject *given_globals, PyObject *locals, PyObject *given_fromlist, int level)''', cts) def PyImport_ImportModuleLevelObject(space, w_name, w_glob, w_loc, w_fromlist, level): +level = rffi.cast(lltype.Signed, level) if w_glob is None: w_glob = space.newdict() else: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Philip JenveyBranch: py3.5 Changeset: r89625:340c549c6f11 Date: 2017-01-16 21:10 -0800 http://bitbucket.org/pypy/pypy/changeset/340c549c6f11/ Log:fix translation diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py --- a/pypy/interpreter/function.py +++ b/pypy/interpreter/function.py @@ -544,7 +544,7 @@ except OperationError as e: if not e.match(space, space.w_TypeError): raise -name = '?' +name = u'?' objrepr = space.unicode_w(space.repr(self.w_instance)) s = u'' % (name, objrepr) return space.wrap(s) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r89503:73e4cf94fc54 Date: 2017-01-11 19:07 + http://bitbucket.org/pypy/pypy/changeset/73e4cf94fc54/ Log:fix translation 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 @@ -491,7 +491,8 @@ share a contiguous chunk of memory of "unsigned bytes" of the given length. Returns 0 on success and -1 (with raising an error) on error. """ -if rffi.cast(lltype.Signed, flags) & PyBUF_WRITABLE and readonly: +flags = rffi.cast(lltype.Signed, flags) +if flags & PyBUF_WRITABLE and readonly: raise oefmt(space.w_ValueError, "Object is not writable") view.c_buf = buf view.c_len = length ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation (pfff...)
Author: Ronan LamyBranch: py3.5 Changeset: r89010:3a21b9bcad6e Date: 2016-12-11 15:52 + http://bitbucket.org/pypy/pypy/changeset/3a21b9bcad6e/ Log:fix translation (pfff...) 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 @@ -493,7 +493,7 @@ This is not a complete re-implementation of the CPython API; it only provides a subset of CPython's behavior. """ -if flags & PyBUF_WRITABLE and readonly: +if rffi.cast(lltype.Signed, flags) & PyBUF_WRITABLE and readonly: raise oefmt(space.w_ValueError, "Object is not writable") view.c_buf = buf view.c_len = length ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r88034:6dd9cf87c0a7 Date: 2016-11-01 15:41 + http://bitbucket.org/pypy/pypy/changeset/6dd9cf87c0a7/ Log:fix translation diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py --- a/pypy/interpreter/astcompiler/codegen.py +++ b/pypy/interpreter/astcompiler/codegen.py @@ -578,7 +578,7 @@ self.pop_frame_block(F_BLOCK_LOOP, start) self.visit_sequence(fr.orelse) self.use_next_block(end) - + def visit_AsyncFor(self, fr): self.update_position(fr.lineno, True) b_try = self.new_block() @@ -588,21 +588,21 @@ b_try_cleanup = self.new_block() b_after_loop = self.new_block() b_after_loop_else = self.new_block() - + self.emit_jump(ops.SETUP_LOOP, b_after_loop) self.push_frame_block(F_BLOCK_LOOP, b_try) - + fr.iter.walkabout(self) self.emit_op(ops.GET_AITER) self.load_const(self.space.w_None) self.emit_op(ops.YIELD_FROM) - + self.use_next_block(b_try) # This adds another line, so each for iteration can be traced. self.lineno_set = False self.emit_jump(ops.SETUP_EXCEPT, b_except) self.push_frame_block(F_BLOCK_EXCEPT, b_try) - + self.emit_op(ops.GET_ANEXT) self.load_const(self.space.w_None) self.emit_op(ops.YIELD_FROM) @@ -610,13 +610,13 @@ self.emit_op(ops.POP_BLOCK) self.pop_frame_block(F_BLOCK_EXCEPT, b_try) self.emit_jump(ops.JUMP_FORWARD, b_after_try) - + self.use_next_block(b_except) self.emit_op(ops.DUP_TOP) self.emit_op_name(ops.LOAD_GLOBAL, self.names, "StopAsyncIteration") self.emit_op_arg(ops.COMPARE_OP, 10) self.emit_jump(ops.POP_JUMP_IF_FALSE, b_try_cleanup, True) - + self.emit_op(ops.POP_TOP) self.emit_op(ops.POP_TOP) self.emit_op(ops.POP_TOP) @@ -630,23 +630,23 @@ self.emit_op(ops.POP_TOP) self.emit_op(ops.POP_BLOCK) # for SETUP_LOOP self.emit_jump(ops.JUMP_ABSOLUTE, b_after_loop_else, True) - + self.use_next_block(b_try_cleanup) self.emit_op(ops.END_FINALLY) - + self.use_next_block(b_after_try) self.visit_sequence(fr.body) self.emit_jump(ops.JUMP_ABSOLUTE, b_try, True) - + self.emit_op(ops.POP_BLOCK) # for SETUP_LOOP self.pop_frame_block(F_BLOCK_LOOP, b_try) - + self.use_next_block(b_after_loop) self.emit_jump(ops.JUMP_ABSOLUTE, b_end, True) - + self.use_next_block(b_after_loop_else) self.visit_sequence(fr.orelse) - + self.use_next_block(b_end) def visit_While(self, wh): @@ -701,7 +701,7 @@ self.emit_op(ops.POP_TOP) if handler.name: ## generate the equivalent of: -## +## ## try: ## # body ## except type as name: @@ -960,7 +960,7 @@ def visit_AsyncWith(self, wih): self.update_position(wih.lineno, True) -self.handle_asyncwithitem(wih, 0, is_async=True) +self.handle_withitem(wih, 0, is_async=True) def visit_Raise(self, rais): self.update_position(rais.lineno, True) @@ -1008,7 +1008,7 @@ self.emit_op(ops.GET_YIELD_FROM_ITER) self.load_const(self.space.w_None) self.emit_op(ops.YIELD_FROM) - + def visit_Await(self, aw): self.update_position(aw.lineno) aw.value.walkabout(self) @@ -1147,7 +1147,7 @@ self.emit_op_arg(outer_op, elt_subitems) else: self.emit_op_arg(single_op, seen_star) - + def _visit_assignment(self, node, elts, ctx): elt_count = len(elts) if elts else 0 if ctx == ast.Store: @@ -1230,7 +1230,7 @@ self.emit_op_arg(ops.BUILD_MAP_UNPACK, oparg) containers -= (oparg - 1) is_unpacking = False - + def visit_Set(self, s): self._visit_starunpack(s, s.elts, ops.BUILD_SET, ops.BUILD_SET, ops.BUILD_SET_UNPACK) @@ -1286,7 +1286,7 @@ # If we ended up with more than one stararg, we need # to concatenate them into a single sequence. self.emit_op_arg(ops.BUILD_LIST_UNPACK, nsubargs) - + # Repeat procedure for keyword args nseen = 0 # the number of keyword arguments on the stack following if keywords is not None: @@ -1340,7 +1340,7 @@ return call.func.walkabout(self) self._make_call(0, call.args, call.keywords) - + def _call_has_no_star_args(self, call): if call.args is not None: for elt in call.args: ___ pypy-commit
[pypy-commit] pypy py3.5: Fix translation
Author: Amaury Forgeot d'ArcBranch: py3.5 Changeset: r87703:2ddf9bfa3ece Date: 2016-10-11 08:19 +0200 http://bitbucket.org/pypy/pypy/changeset/2ddf9bfa3ece/ Log:Fix translation diff --git a/pypy/module/_weakref/interp__weakref.py b/pypy/module/_weakref/interp__weakref.py --- a/pypy/module/_weakref/interp__weakref.py +++ b/pypy/module/_weakref/interp__weakref.py @@ -188,9 +188,6 @@ state = u"; to '%s'" % (typename,) return self.getrepr(space, unicode(self.typedef.name), state) -def descr_callback(self, space): -return self.w_callable - class W_Weakref(W_WeakrefBase): def __init__(self, space, w_obj, w_callable): @@ -232,6 +229,9 @@ def descr__ne__(self, space, w_ref2): return space.not_(space.eq(self, w_ref2)) +def descr_callback(self, space): +return self.w_callable + def getlifeline(space, w_obj): lifeline = w_obj.getweakref() if lifeline is None: @@ -260,7 +260,7 @@ __hash__ = interp2app(W_Weakref.descr_hash), __call__ = interp2app(W_Weakref.descr_call), __repr__ = interp2app(W_WeakrefBase.descr__repr__), -__callback__ = GetSetProperty(W_WeakrefBase.descr_callback), +__callback__ = GetSetProperty(W_Weakref.descr_callback), ) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation
Author: Amaury Forgeot d'ArcBranch: py3.5 Changeset: r87306:827ca1cc3dfb Date: 2016-09-22 09:56 +0200 http://bitbucket.org/pypy/pypy/changeset/827ca1cc3dfb/ Log:Fix translation diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -314,6 +314,7 @@ def __init__(self, space, w_ctx): self.w_ctx = w_ctx self.w_socket = None +self.w_owner = None self.ssl = lltype.nullptr(SSL.TO) self.peer_cert = lltype.nullptr(X509.TO) self.shutdown_seen_zero = False @@ -693,13 +694,14 @@ libssl_SSL_set_SSL_CTX(self.ssl, ctx.ctx) def descr_get_owner(self, space): -if self.w_owner: +if self.w_owner is not None: w_owner = self.w_owner() if w_owner: return w_owner return space.w_None def descr_set_owner(self, space, w_owner): +assert w_owner is not None self.w_owner = weakref.ref(w_owner) @@ -1282,9 +1284,9 @@ # SSLObject) that will be passed. Otherwise if there's a socket then that # will be passed. If both do not exist only then the C-level object is # passed. -if w_ssl.w_owner: +if w_ssl.w_owner is not None: w_ssl_socket = w_ssl.w_owner() -elif w_ssl.w_socket: +elif w_ssl.w_socket is not None: w_ssl_socket = w_ssl.w_socket() else: w_ssl_socket = w_ssl ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix translation
Author: Ronan LamyBranch: py3.5 Changeset: r87277:54ced20c6ee9 Date: 2016-09-21 16:13 +0100 http://bitbucket.org/pypy/pypy/changeset/54ced20c6ee9/ Log:Fix translation diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py --- a/pypy/module/__builtin__/functional.py +++ b/pypy/module/__builtin__/functional.py @@ -102,7 +102,7 @@ else: w_stop = w_length return w_start, w_stop, w_step - + min_jitdriver = jit.JitDriver(name='min', greens=['has_key', 'has_item', 'w_type'], reds='auto') max_jitdriver = jit.JitDriver(name='max', @@ -136,7 +136,7 @@ "%s() expects at least one argument", implementation_of) w_key = None -has_default = False +w_default = None if any_kwds: kwds = args.keywords for n in range(len(kwds)): @@ -144,13 +144,12 @@ w_key = args.keywords_w[n] elif kwds[n] == "default": w_default = args.keywords_w[n] -has_default = True else: raise oefmt(space.w_TypeError, "%s() got unexpected keyword argument", implementation_of) -if has_default and len(args_w) > 1: +if w_default is not None and len(args_w) > 1: raise oefmt(space.w_TypeError, "Cannot specify a default for %s() with multiple positional arguments", implementation_of) @@ -180,7 +179,7 @@ w_max_item = w_item w_max_val = w_compare_with if w_max_item is None: -if has_default: +if w_default is not None: w_max_item = w_default else: raise oefmt(space.w_ValueError, "arg is an empty sequence") @@ -420,7 +419,7 @@ def descr_repr(self, space): if not space.is_true(space.eq(self.w_step, space.newint(1))): return space.mod(space.wrap("range(%d, %d, %d)"), - space.newtuple([self.w_start, self.w_stop, + space.newtuple([self.w_start, self.w_stop, self.w_step])) else: return space.mod(space.wrap("range(%d, %d)"), @@ -433,7 +432,7 @@ "Get a range item, when known to be inside bounds" # return self.start + (i * self.step) return space.add(self.w_start, space.mul(w_index, self.w_step)) - + def _compute_item(self, space, w_index): w_zero = space.newint(0) w_index = space.index(w_index) @@ -767,7 +766,7 @@ __iter__ = interp2app(W_Map.iter_w), __next__ = interp2app(W_Map.next_w), __reduce__ = interp2app(W_Map.descr_reduce), -__doc__ = """\ +__doc__ = """\ Make an iterator that computes the function using arguments from each of the iterables. Stops when the shortest iterable is exhausted.""") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit