bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def CreateProcess(name, command_line, process_attr, thread_attr, inherit, flags, env, start_dir, startup_info): si = _STARTUPINFO() if startup_info is not None: si.dwFlags = startup_info.dwFlags si.wShowWindow = startup_info.wShowWindow if startup_info.hStdInput: si.hStdInput = startup_info.hStdInput.handle if startup_... | def CreateProcess(name, command_line, process_attr, thread_attr, inherit, flags, env, start_dir, startup_info): si = _STARTUPINFO() if startup_info is not None: si.dwFlags = startup_info.dwFlags si.wShowWindow = startup_info.wShowWindow if startup_info.hStdInput: si.hStdInput = int(startup_info.hStdInput) if startup_in... | 452,600 |
def CreateProcess(name, command_line, process_attr, thread_attr, inherit, flags, env, start_dir, startup_info): si = _STARTUPINFO() if startup_info is not None: si.dwFlags = startup_info.dwFlags si.wShowWindow = startup_info.wShowWindow if startup_info.hStdInput: si.hStdInput = startup_info.hStdInput.handle if startup_... | def CreateProcess(name, command_line, process_attr, thread_attr, inherit, flags, env, start_dir, startup_info): si = _STARTUPINFO() if startup_info is not None: si.dwFlags = startup_info.dwFlags si.wShowWindow = startup_info.wShowWindow if startup_info.hStdInput: si.hStdInput = startup_info.hStdInput.handle if startup_... | 452,601 |
def CreateProcess(name, command_line, process_attr, thread_attr, inherit, flags, env, start_dir, startup_info): si = _STARTUPINFO() if startup_info is not None: si.dwFlags = startup_info.dwFlags si.wShowWindow = startup_info.wShowWindow if startup_info.hStdInput: si.hStdInput = startup_info.hStdInput.handle if startup_... | def CreateProcess(name, command_line, process_attr, thread_attr, inherit, flags, env, start_dir, startup_info): si = _STARTUPINFO() if startup_info is not None: si.dwFlags = startup_info.dwFlags si.wShowWindow = startup_info.wShowWindow if startup_info.hStdInput: si.hStdInput = startup_info.hStdInput.handle if startup_... | 452,602 |
def WaitForSingleObject(handle, milliseconds): res = _WaitForSingleObject(handle.handle, milliseconds) if res < 0: raise WindowsError("Error") return res | def WaitForSingleObject(handle, milliseconds): res = _WaitForSingleObject(int(handle), milliseconds) if res < 0: raise WindowsError("Error") return res | 452,603 |
def GetExitCodeProcess(handle): code = _c_int() res = _GetExitCodeProcess(handle.handle, _byref(code)) if not res: raise WindowsError("Error") return code.value | def GetExitCodeProcess(handle): code = _c_int() res = _GetExitCodeProcess(int(handle), _byref(code)) if not res: raise WindowsError("Error") return code.value | 452,604 |
def test_bug_3(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] setfield_g... | def test_bug_3(self): ops = """ [p1] guard_nonnull_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] setfield_gc(p3, p2, des... | 452,605 |
def test_bug_3(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] setfield_g... | def test_bug_3(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] setfield_g... | 452,606 |
def test_bug_3(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] setfield_g... | def test_bug_3(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] setfield_g... | 452,607 |
def float_unpack(Q, size): """Convert a 32-bit or 64-bit integer created by float_pack into a Python float.""" if size == 8: MIN_EXP = -1021 # = sys.float_info.min_exp MAX_EXP = 1024 # = sys.float_info.max_exp MANT_DIG = 53 # = sys.float_info.mant_dig BITS = 64 elif size == 4: MIN_EXP = -125 # C's FLT_MIN_EXP ... | def float_unpack(Q, size): """Convert a 32-bit or 64-bit integer created by float_pack into a Python float.""" if size == 8: MIN_EXP = -1021 # = sys.float_info.min_exp MAX_EXP = 1024 # = sys.float_info.max_exp MANT_DIG = 53 # = sys.float_info.mant_dig BITS = 64 elif size == 4: MIN_EXP = -125 # C's FLT_MIN_EXP ... | 452,608 |
def note_import_star(self, imp): """Called when a star import is found.""" pass | def note_import_star(self, imp): """Called when a star import is found.""" pass | 452,609 |
def f(code, n): pc = 0 while pc < len(code): | def f(code, n): pc = 0 while pc < len(code): | 452,610 |
def f(code, n): pc = 0 while pc < len(code): | def f(code, n): pc = 0 while pc < len(code): | 452,611 |
def g(m): if m > 1000000: f('', 0) result = 0 for i in range(m): result += f('+-cl--', i) | def g(m): if m > 1000000: f('', 0) result = 0 for i in range(m): result += f('+-cl--', i) | 452,612 |
def test_mul_ovf(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_lt(i1, 5) guard_true(i3) [] i4 = int_gt(i1, -10) guard_true(i4) [] i5 = int_mul_ovf(i2, i1) guard_no_overflow() [] i6 = int_lt(i5, -2550) guard_false(i6) [] i7 = int_ge(i5, 1276) guard_false(i7) [] i8 = int_gt(i5, 126) guard_true(i8) [] jump(i0, ... | def test_mul_ovf(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_lt(i1, 5) guard_true(i3) [] i4 = int_gt(i1, -10) guard_true(i4) [] i5 = int_mul_ovf(i2, i1) guard_no_overflow() [] i6 = int_lt(i5, -2550) guard_false(i6) [] i7 = int_ge(i5, 1276) guard_false(i7) [] i8 = int_gt(i5, 126) guard_true(i8) [] jump(i0, ... | 452,613 |
def test_mul_ovf(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_lt(i1, 5) guard_true(i3) [] i4 = int_gt(i1, -10) guard_true(i4) [] i5 = int_mul_ovf(i2, i1) guard_no_overflow() [] i6 = int_lt(i5, -2550) guard_false(i6) [] i7 = int_ge(i5, 1276) guard_false(i7) [] i8 = int_gt(i5, 126) guard_true(i8) [] jump(i0, ... | def test_mul_ovf(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_lt(i1, 5) guard_true(i3) [] i4 = int_gt(i1, -10) guard_true(i4) [] i5 = int_mul_ovf(i2, i1) guard_no_overflow() [] i6 = int_lt(i5, -2550) guard_false(i6) [] i7 = int_ge(i5, 1276) guard_false(i7) [] i8 = int_gt(i5, 126) guard_true(i8) [] jump(i0, ... | 452,614 |
def test_mul_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i22 = int_add(i2, 1) i3 = int_mul_ovf(i22, i1) guard_no_overflow() [] i4 = int_lt(i3, 10) guard_true(i4) [] i5 = int_gt(i3, 2) guard_true(i5) [] i6 = int_lt(i1, 0) guard_false(i6) [] jump(i0, i1) """ expected = """ [i0, i1] i2 = int_and(i0, 255) i2... | def test_mul_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i22 = int_add(i2, 1) i3 = int_mul_ovf(i22, i1) guard_no_overflow() [] i4 = int_lt(i3, 10) guard_true(i4) [] i5 = int_gt(i3, 2) guard_true(i5) [] i6 = int_lt(i1, 0) guard_false(i6) [] jump(i0, i1) """ preamble = """ [i0, i1] i2 = int_and(i0, 255) i2... | 452,615 |
def test_mul_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i22 = int_add(i2, 1) i3 = int_mul_ovf(i22, i1) guard_no_overflow() [] i4 = int_lt(i3, 10) guard_true(i4) [] i5 = int_gt(i3, 2) guard_true(i5) [] i6 = int_lt(i1, 0) guard_false(i6) [] jump(i0, i1) """ expected = """ [i0, i1] i2 = int_and(i0, 255) i2... | def test_mul_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i22 = int_add(i2, 1) i3 = int_mul_ovf(i22, i1) guard_no_overflow() [] i4 = int_lt(i3, 10) guard_true(i4) [] i5 = int_gt(i3, 2) guard_true(i5) [] i6 = int_lt(i1, 0) guard_false(i6) [] jump(i0, i1) """ expected = """ [i0, i1] i2 = int_and(i0, 255) i2... | 452,616 |
def test_sub_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_sub_ovf(i2, i1) guard_no_overflow() [] i4 = int_le(i3, 10) guard_true(i4) [] i5 = int_ge(i3, 2) guard_true(i5) [] i6 = int_lt(i1, -10) guard_false(i6) [] i7 = int_gt(i1, 253) guard_false(i7) [] jump(i0, i1) """ expected = """ [i0, i1] i2 =... | def test_sub_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_sub_ovf(i2, i1) guard_no_overflow() [] i4 = int_le(i3, 10) guard_true(i4) [] i5 = int_ge(i3, 2) guard_true(i5) [] i6 = int_lt(i1, -10) guard_false(i6) [] i7 = int_gt(i1, 253) guard_false(i7) [] jump(i0, i1) """ preamble = """ [i0, i1] i2 =... | 452,617 |
def test_sub_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_sub_ovf(i2, i1) guard_no_overflow() [] i4 = int_le(i3, 10) guard_true(i4) [] i5 = int_ge(i3, 2) guard_true(i5) [] i6 = int_lt(i1, -10) guard_false(i6) [] i7 = int_gt(i1, 253) guard_false(i7) [] jump(i0, i1) """ expected = """ [i0, i1] i2 =... | def test_sub_ovf_before(self): ops = """ [i0, i1] i2 = int_and(i0, 255) i3 = int_sub_ovf(i2, i1) guard_no_overflow() [] i4 = int_le(i3, 10) guard_true(i4) [] i5 = int_ge(i3, 2) guard_true(i5) [] i6 = int_lt(i1, -10) guard_false(i6) [] i7 = int_gt(i1, 253) guard_false(i7) [] jump(i0, i1) """ expected = """ [i0, i1] i2 =... | 452,618 |
def QueryValueEx(space, w_hkey, w_subkey): """value,type_id = QueryValueEx(key, value_name) - Retrieves the type and data for a specified value name associated with an open registry key. | def QueryValueEx(space, w_hkey, w_subkey): """value,type_id = QueryValueEx(key, value_name) - Retrieves the type and data for a specified value name associated with an open registry key. | 452,619 |
def QueryValueEx(space, w_hkey, w_subkey): """value,type_id = QueryValueEx(key, value_name) - Retrieves the type and data for a specified value name associated with an open registry key. | def QueryValueEx(space, w_hkey, w_subkey): """value,type_id = QueryValueEx(key, value_name) - Retrieves the type and data for a specified value name associated with an open registry key. | 452,620 |
def CALL_METHOD(f, oparg, *ignored): # opargs contains the arg, and kwarg count, excluding the implicit 'self' n_args = oparg & 0xff n_kwargs = (oparg >> 8) & 0xff w_self = f.peekvalue(n_args + (2 * n_kwargs)) w_callable = f.peekvalue(n_args + (2 * n_kwargs) + 1) n = n_args + (w_self is not None) if not n_kwargs: try:... | def CALL_METHOD(f, oparg, *ignored): # opargs contains the arg, and kwarg count, excluding the implicit 'self' n_args = oparg & 0xff n_kwargs = (oparg >> 8) & 0xff w_self = f.peekvalue(n_args + (2 * n_kwargs)) w_callable = f.peekvalue(n_args + (2 * n_kwargs) + 1) n = n_args + (w_self is not None) if not n_kwargs: try:... | 452,621 |
def _emit_copystrcontent(self, op, regalloc, fcond, is_unicode): # compute the source address args = list(op.getarglist()) base_loc, box = self._ensure_value_is_boxed(args[0], regalloc, args) args.append(box) ofs_loc, box = self._ensure_value_is_boxed(args[2], regalloc, args) args.append(box) assert args[0] is not args... | def _emit_copystrcontent(self, op, regalloc, fcond, is_unicode): # compute the source address args = list(op.getarglist()) base_loc, box = self._ensure_value_is_boxed(args[0], regalloc, args) args.append(box) ofs_loc, box = self._ensure_value_is_boxed(args[2], regalloc, args) args.append(box) assert args[0] is not args... | 452,622 |
def _load_address(self, sizereg, baseofs, scale, result, baseloc=None): if baseloc is not None: assert baseloc.is_reg() self.mc.MOV_rr(result.value, baseloc.value) else: self.mc.MOV_ri(result.value, 0) assert sizereg.is_reg() if scale > 0: self.mc.LSL_ri(r.ip.value, sizereg.value, scale) else: self.mc.MOV_rr(r.ip.value... | def _load_address(self, sizereg, baseofs, scale, result, baseloc=None): if baseloc is not None: assert baseloc.is_reg() self.mc.MOV_rr(result.value, baseloc.value) else: self.mc.MOV_ri(result.value, 0) assert sizereg.is_reg() if scale > 0: self.mc.LSL_ri(r.ip.value, sizereg.value, scale) else: self.mc.MOV_rr(r.ip.value... | 452,623 |
def _gen_address_inside_string(self, baseloc, ofsloc, resloc, is_unicode): cpu = self.cpu if is_unicode: ofs_items, _, _ = symbolic.get_array_token(rstr.UNICODE, self.cpu.translate_support_code) scale = self._get_unicode_item_scale() else: ofs_items, itemsize, _ = symbolic.get_array_token(rstr.STR, self.cpu.translate_s... | def _gen_address_inside_string(self, baseloc, ofsloc, resloc, is_unicode): cpu = self.cpu if is_unicode: ofs_items, _, _ = symbolic.get_array_token(rstr.UNICODE, self.cpu.translate_support_code) scale = self._get_unicode_item_scale() else: ofs_items, itemsize, _ = symbolic.get_array_token(rstr.STR, self.cpu.translate_s... | 452,624 |
def __init__(self, space, pto, method_name, wrapper_func, wrapper_func_kwds, doc, func): self.space = space self.method_name = method_name self.wrapper_func = wrapper_func assert type(wrapper_func_kwds) is not str self.wrapper_func_kwds = wrapper_func_kwds self.doc = doc self.func = func pyo = rffi.cast(PyObject, pto) ... | def __init__(self, space, pto, method_name, wrapper_func, wrapper_func_kwds, doc, func): self.space = space self.method_name = method_name self.wrapper_func = wrapper_func assert not isinstance(wrapper_func_kwds, str) self.wrapper_func_kwds = wrapper_func_kwds self.doc = doc self.func = func pyo = rffi.cast(PyObject, p... | 452,625 |
def id_or_identityhash(self, gcobj, special_case_prebuilt): """Implement the common logic of id() and identityhash() of an object, given as a GCREF. """ obj = llmemory.cast_ptr_to_adr(gcobj) # if self.is_valid_gc_object(obj): if self.is_in_nursery(obj): # # The object is not a tagged pointer, and it is still in the # n... | def id_or_identityhash(self, gcobj, special_case_prebuilt): """Implement the common logic of id() and identityhash() of an object, given as a GCREF. """ obj = llmemory.cast_ptr_to_adr(gcobj) # if self.is_valid_gc_object(obj): if self.is_in_nursery(obj): # # The object is not a tagged pointer, and it is still in the # n... | 452,626 |
def id_or_identityhash(self, gcobj, special_case_prebuilt): """Implement the common logic of id() and identityhash() of an object, given as a GCREF. """ obj = llmemory.cast_ptr_to_adr(gcobj) # if self.is_valid_gc_object(obj): if self.is_in_nursery(obj): # # The object is not a tagged pointer, and it is still in the # n... | def id_or_identityhash(self, gcobj, special_case_prebuilt): """Implement the common logic of id() and identityhash() of an object, given as a GCREF. """ obj = llmemory.cast_ptr_to_adr(gcobj) # if self.is_valid_gc_object(obj): if self.is_in_nursery(obj): # # The object is not a tagged pointer, and it is still in the # n... | 452,627 |
def check_and_print_leaks(self): # check for sane refcnts leaking = False state = self.space.fromcache(State) import gc gc.collect() lost_objects_w = identity_dict() lost_objects_w.update((key, None) for key in self.frozen_refcounts.keys()) for w_obj, obj in state.py_objects_w2r.iteritems(): base_refcnt = self.frozen_r... | def check_and_print_leaks(self): # check for sane refcnts leaking = False state = self.space.fromcache(State) import gc gc.collect() lost_objects_w = identity_dict() lost_objects_w.update((key, None) for key in self.frozen_refcounts.keys()) for w_obj, obj in state.py_objects_w2r.iteritems(): base_refcnt = self.frozen_r... | 452,628 |
def test_bound_strlen(self): ops = """ [p0] i0 = strlen(p0) i1 = int_ge(i0, 0) guard_true(i1) [] jump(p0) """ # The dead strlen will be eliminated be the backend. expected = """ [p0] i0 = strlen(p0) jump(p0) """ self.optimize_strunicode_loop(ops, expected) | def test_bound_strlen(self): ops = """ [p0] i0 = strlen(p0) i1 = int_ge(i0, 0) guard_true(i1) [] jump(p0) """ # The dead strlen will be eliminated be the backend. expected = """ [p0] i0 = strlen(p0) jump(p0) """ self.optimize_strunicode_loop(ops, expected) | 452,629 |
def test_call_to_c_function(self): from pypy.rlib.libffi import CDLL, types, ArgChain libc = CDLL('libc.so.6') c_tolower = libc.getpointer('tolower', [types.uchar], types.sint) argchain = ArgChain().arg(ord('A')) assert c_tolower.call(argchain, rffi.INT) == ord('a') | def test_call_to_c_function(self): from pypy.rlib.libffi import CDLL, types, ArgChain from pypy.rpython.lltypesystem.ll2ctypes import libc_name libc = CDLL(libc_name) c_tolower = libc.getpointer('tolower', [types.uchar], types.sint) argchain = ArgChain().arg(ord('A')) assert c_tolower.call(argchain, rffi.INT) == ord('a... | 452,630 |
def binary_insn(self, line): match = self.r_binaryinsn.match(line) if not match: raise UnrecognizedOperation(line) source = match.group("source") target = match.group("target") if self.r_localvar.match(target): return InsnSetLocal(target, [source]) elif target == self.ESP: raise UnrecognizedOperation(line) else: return... | def binary_insn(self, line): match = self.r_binaryinsn.match(line) if not match: raise UnrecognizedOperation(line) source = match.group("source") target = match.group("target") if self.r_localvar.match(target): return InsnSetLocal(target, [source]) elif target == self.ESP: raise UnrecognizedOperation(line) else: return... | 452,631 |
def raises(ExpectedException, *args, **kwargs): """ raise AssertionError, if target code does not raise the expected exception. """ __tracebackhide__ = True assert args if isinstance(args[0], str): code, = args assert isinstance(code, str) frame = sys._getframe(1) loc = frame.f_locals.copy() loc.update(kwargs) #print "... | def raises(ExpectedException, *args, **kwargs): """ raise AssertionError, if target code does not raise the expected exception. """ __tracebackhide__ = True assert args if isinstance(args[0], str): code, = args assert isinstance(code, str) frame = sys._getframe(1) loc = frame.f_locals.copy() loc.update(kwargs) #print "... | 452,632 |
def analyze_simple_operation(self, op): return op.opname in ('jit_force_virtualizable', 'jit_force_virtual') | def analyze_simple_operation(self, op): return op.opname in ('jit_force_virtualizable', 'jit_force_virtual') | 452,633 |
def callinfo_for_oopspec(oopspecindex): """A function that returns the calldescr and the function address (as an int) of one of the OS_XYZ functions defined above. Don't use this if there might be several implementations of the same OS_XYZ specialized by type, e.g. OS_ARRAYCOPY.""" return _callinfo_for_oopspec[oopspeci... | def callinfo_for_oopspec(oopspecindex): """A function that returns the calldescr and the function address (as an int) of one of the OS_XYZ functions defined above. Don't use this if there might be several implementations of the same OS_XYZ specialized by type, e.g. OS_ARRAYCOPY.""" try: return _callinfo_for_oopspec[oop... | 452,634 |
def CALL_METHOD(f, oparg, *ignored): # opargs contains the arg, and kwarg count, excluding the implicit 'self' n_args = oparg & 0xff n_kwargs = (oparg >> 8) & 0xff w_self = f.peekvalue(n_args + (2 * n_kwargs)) w_callable = f.peekvalue(n_args + (2 * n_kwargs) + 1) n = n_args + (w_self is not None) if not n_kwargs: try:... | def CALL_METHOD(f, oparg, *ignored): # opargs contains the arg, and kwarg count, excluding the implicit 'self' n_args = oparg & 0xff n_kwargs = (oparg >> 8) & 0xff w_self = f.peekvalue(n_args + (2 * n_kwargs)) w_callable = f.peekvalue(n_args + (2 * n_kwargs) + 1) n = n_args + (w_self is not None) if not n_kwargs: try:... | 452,635 |
def test_new_exception(self): skip("not working yet") mod = self.import_extension('foo', [ ('newexc', 'METH_VARARGS', ''' char *name = PyString_AsString(PyTuple_GetItem(args, 0)); return PyExc_NewException(name, PyTuple_GetItem(args, 1), PyTuple_GetItem(args, 2)); ''' ), ]) raises(SystemError, mod.newexc, "name", Excep... | def test_new_exception(self): mod = self.import_extension('foo', [ ('newexc', 'METH_VARARGS', ''' char *name = PyString_AsString(PyTuple_GetItem(args, 0)); return PyExc_NewException(name, PyTuple_GetItem(args, 1), PyTuple_GetItem(args, 2)); ''' ), ]) raises(SystemError, mod.newexc, "name", Exception, {}) | 452,636 |
def test_new_exception(self): skip("not working yet") mod = self.import_extension('foo', [ ('newexc', 'METH_VARARGS', ''' char *name = PyString_AsString(PyTuple_GetItem(args, 0)); return PyExc_NewException(name, PyTuple_GetItem(args, 1), PyTuple_GetItem(args, 2)); ''' ), ]) raises(SystemError, mod.newexc, "name", Excep... | def test_new_exception(self): skip("not working yet") mod = self.import_extension('foo', [ ('newexc', 'METH_VARARGS', ''' char *name = PyString_AsString(PyTuple_GetItem(args, 0)); return PyErr_NewException(name, PyTuple_GetItem(args, 1), PyTuple_GetItem(args, 2)); ''' ), ]) raises(SystemError, mod.newexc, "name", Excep... | 452,637 |
def bindinputargs(self, graph, block, inputcells, called_from_graph=None): if 'getitem__Array' in graph.name: if len(inputcells) > 2 and isinstance(inputcells[1], annmodel.SomeInstance) and 'Base' in str(inputcells[1].classdef): import pdb pdb.set_trace() print graph print inputcells # Create the initial bindings for t... | def bindinputargs(self, graph, block, inputcells, called_from_graph=None): # Create the initial bindings for the input args of a block. assert len(block.inputargs) == len(inputcells) where = (graph, block, None) for a, cell in zip(block.inputargs, inputcells): self.setbinding(a, cell, called_from_graph, where=where) se... | 452,638 |
def test_short_result_of_call_direct(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.INT... | def test_short_result_of_call_direct(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.INT... | 452,639 |
def test_short_result_of_call_direct(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.INT... | def test_short_result_of_call_direct(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.INT... | 452,640 |
def test_short_result_of_call_compiled(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.I... | def test_short_result_of_call_compiled(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.I... | 452,641 |
def test_short_result_of_call_compiled(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.I... | def test_short_result_of_call_compiled(self): # Test that calling a function that returns a CHAR, SHORT or INT, # signed or unsigned, properly gets zero-extended or sign-extended. from pypy.translator.tool.cbuild import ExternalCompilationInfo for RESTYPE in [rffi.SIGNEDCHAR, rffi.UCHAR, rffi.SHORT, rffi.USHORT, rffi.I... | 452,642 |
def test_dir_structure(test='test'): # make sure we have sort of pypy-c pypy_c = py.path.local(pypydir).join('translator', 'goal', 'pypy-c') if not pypy_c.check(): os.system("echo faked_pypy_c> %s" % (pypy_c,)) fake_pypy_c = True else: fake_pypy_c = False try: builddir = package(py.path.local(pypydir).dirpath(), test) ... | def test_dir_structure(test='test'): # make sure we have sort of pypy-c pypy_c = py.path.local(pypydir).join('translator', 'goal', 'pypy-c') if not pypy_c.check(): os.system("echo faked_pypy_c> %s" % (pypy_c,)) fake_pypy_c = True else: fake_pypy_c = False try: builddir = package(py.path.local(pypydir).dirpath(), test) ... | 452,643 |
def heuristic(graph): for block in graph.iterblocks(): for op in block.operations: if op.opname in ('malloc',): return inline.inlining_heuristic(graph) return sys.maxint, False | def heuristic(graph): for block in graph.iterblocks(): for op in block.operations: if op.opname in ('malloc',): return inline.inlining_heuristic(graph) return sys.maxint, False | 452,644 |
def optimize_loop(self, ops, spectext, optops): loop = self.parse(ops) # self.loop = loop metainterp_sd = FakeMetaInterpStaticData(self.cpu) if hasattr(self, 'vrefinfo'): metainterp_sd.virtualref_info = self.vrefinfo # # XXX list the exact optimizations that are needed for each test from pypy.jit.metainterp.optimizeopt... | def optimize_loop(self, ops, spectext, optops): loop = self.parse(ops) # self.loop = loop metainterp_sd = FakeMetaInterpStaticData(self.cpu) if hasattr(self, 'vrefinfo'): metainterp_sd.virtualref_info = self.vrefinfo # # XXX list the exact optimizations that are needed for each test from pypy.jit.metainterp.optimizeopt... | 452,645 |
def test_split_one_loop(self): real_loops = [FinalBlock(preparse(""" p21 = getfield_gc(p4, descr=<GcPtrFieldDescr 16>) guard_class(p4, 141310752, descr=<Guard51>) [p0, p1] """), None), FinalBlock(preparse(""" p60 = getfield_gc(p4, descr=<GcPtrFieldDescr 16>) guard_nonnull(p60, descr=<Guard5>) [p0, p1] """), None)] spli... | def test_split_one_loop(self): real_loops = [FinalBlock(preparse(""" p21 = getfield_gc(p4, descr=<GcPtrFieldDescr 16>) guard_class(p4, 141310752, descr=<Guard51>) [p0, p1] """), None), FinalBlock(preparse(""" p60 = getfield_gc(p4, descr=<GcPtrFieldDescr 16>) guard_nonnull(p60, descr=<Guard5>) [p0, p1] """), None)] spli... | 452,646 |
def test_postparse(self): real_loops = [FinalBlock("debug_merge_point('<code object _runCallbacks, file '/tmp/x/twisted-trunk/twisted/internet/defer.py', line 357> #40 POP_TOP')", None)] postprocess(real_loops) assert real_loops[0].content.startswith("_runCallbacks, file '/tmp/x/twisted-trunk/twisted/internet/defer.py'... | def test_postparse(self): real_loops = [FinalBlock("debug_merge_point('<code object _runCallbacks, file '/tmp/x/twisted-trunk/twisted/internet/defer.py', line 357> #40 POP_TOP')", None)] postprocess(real_loops) assert real_loops[0].content.startswith("_runCallbacks, file '/tmp/x/twisted-trunk/twisted/internet/defer.py'... | 452,647 |
def unknown_fmtchar(self): space = self.space c = self.fmt[self.fmtpos - 1] if do_unicode: w_defaultencoding = space.call_function( space.sys.get('getdefaultencoding')) w_s = space.call_method(space.wrap(c), "encode", w_defaultencoding, space.wrap('replace')) s = space.str_w(w_s) else: s = c msg = "unsupported format c... | def unknown_fmtchar(self): space = self.space c = self.fmt[self.fmtpos - 1] if do_unicode: w_defaultencoding = space.call_function( space.sys.get('getdefaultencoding')) w_s = space.call_method(space.wrap(c), "encode", w_defaultencoding, space.wrap('replace')) s = space.str_w(w_s) else: s = c msg = "unsupported format c... | 452,648 |
def __init__(self, color=None, width=None, block='█', empty=' '): """ color -- color name (BLUE GREEN CYAN RED MAGENTA YELLOW WHITE BLACK) width -- bar width (optinal) block -- progress display character (default '█') empty -- bar display character (default ' ') """ if color: self.color = getattr(terminal, color.upper(... | def __init__(self, color=None, width=None, block='.', empty=' '): """ color -- color name (BLUE GREEN CYAN RED MAGENTA YELLOW WHITE BLACK) width -- bar width (optinal) block -- progress display character (default '█') empty -- bar display character (default ' ') """ if color: self.color = getattr(terminal, color.upper(... | 452,649 |
def __init__(self, color=None, width=None, block='█', empty=' '): """ color -- color name (BLUE GREEN CYAN RED MAGENTA YELLOW WHITE BLACK) width -- bar width (optinal) block -- progress display character (default '█') empty -- bar display character (default ' ') """ if color: self.color = getattr(terminal, color.upper(... | def __init__(self, color=None, width=None, block='█', empty=' '): """ color -- color name (BLUE GREEN CYAN RED MAGENTA YELLOW WHITE BLACK) width -- bar width (optinal) block -- progress display character (default '.') empty -- bar display character (default ' ') """ if color: self.color = getattr(terminal, color.upper(... | 452,650 |
def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | 452,651 |
def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | 452,652 |
def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | 452,653 |
def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | def float_as_integer_ratio__Float(space, w_float): value = w_float.floatval if isinf(value): w_msg = space.wrap("cannot pass infinity to as_integer_ratio()") raise OperationError(space.w_OverflowError, w_msg) elif isnan(value): w_msg = space.wrap("cannot pass nan to as_integer_ratio()") raise OperationError(space.w_Val... | 452,654 |
def __init__(self, config, read_from_env=False, nursery_size=32*WORD, page_size=16*WORD, arena_size=64*WORD, small_request_threshold=5*WORD, major_collection_threshold=2.5, growth_rate_max=2.5, # for tests card_page_indices=0, large_object=8*WORD, large_object_gcptrs=10*WORD, ArenaCollectionClass=None, **kwds): Movin... | def __init__(self, config, read_from_env=False, nursery_size=32*WORD, page_size=16*WORD, arena_size=64*WORD, small_request_threshold=5*WORD, major_collection_threshold=2.5, growth_rate_max=2.5, # for tests card_page_indices=0, large_object=8*WORD, large_object_gcptrs=10*WORD, ArenaCollectionClass=None, **kwds): Movin... | 452,655 |
def set_major_threshold_from(self, threshold, reserving_size=0): # Set the next_major_collection_threshold. threshold_max = (self.next_major_collection_threshold * self.growth_rate_max) if self.max_delta > 0.0: threshold_max = min(threshold_max, self.next_major_collection_threshold + self.max_delta) if threshold > thre... | def set_major_threshold_from(self, threshold, reserving_size=0): # Set the next_major_collection_threshold. threshold_max = (self.next_major_collection_threshold * self.growth_rate_max) if threshold > threshold_max: threshold = threshold_max # threshold += reserving_size if threshold < self.min_heap_size: threshold = s... | 452,656 |
def major_collection(self, reserving_size=0): """Do a major collection. Only for when the nursery is empty.""" # debug_start("gc-collect") debug_print() debug_print(".----------- Full collection ------------------") debug_print("| used before collection:") debug_print("| in ArenaCollection: ", self.ac.tot... | def major_collection(self, reserving_size=0): """Do a major collection. Only for when the nursery is empty.""" # debug_start("gc-collect") debug_print() debug_print(".----------- Full collection ------------------") debug_print("| used before collection:") debug_print("| in ArenaCollection: ", self.ac.tot... | 452,657 |
def test_strftime_ext(self): import time as rctime | def test_strftime_ext(self): import time as rctime | 452,658 |
def hexescape(builder, s, pos, digits, encoding, errorhandler, message, errors): import sys chr = 0 if pos + digits > len(s): message = "end of string in escape sequence" res, pos = errorhandler(errors, "unicodeescape", message, s, pos-2, len(s)) builder.append(res) else: try: chr = r_uint(int(s[pos:pos+digits], 16)) e... | def hexescape(builder, s, pos, digits, encoding, errorhandler, message, errors): import sys chr = 0 if pos + digits > len(s): message = "end of string in escape sequence" res, pos = errorhandler(errors, "unicodeescape", message, s, pos-2, len(s)) builder.append(res) else: try: chr = r_uint(int(s[pos:pos+digits], 16)) e... | 452,659 |
def hexescape(builder, s, pos, digits, encoding, errorhandler, message, errors): import sys chr = 0 if pos + digits > len(s): message = "end of string in escape sequence" res, pos = errorhandler(errors, "unicodeescape", message, s, pos-2, len(s)) builder.append(res) else: try: chr = r_uint(int(s[pos:pos+digits], 16)) e... | def hexescape(builder, s, pos, digits, encoding, errorhandler, message, errors): import sys chr = 0 if pos + digits > len(s): message = "end of string in escape sequence" res, pos = errorhandler(errors, "unicodeescape", message, s, pos-2, len(s)) builder.append(res) else: try: chr = r_uint(int(s[pos:pos+digits], 16)) e... | 452,660 |
def str_decode_unicode_escape(s, size, errors, final=False, errorhandler=False, unicodedata_handler=None): if errorhandler is None: errorhandler = raise_unicode_exception_decode if size == 0: return u'', 0 builder = UnicodeBuilder(size) pos = 0 while pos < size: ch = s[pos] # Non-escape characters are interpreted as... | def str_decode_unicode_escape(s, size, errors, final=False, errorhandler=False, unicodedata_handler=None): if errorhandler is None: errorhandler = raise_unicode_exception_decode if size == 0: return u'', 0 builder = UnicodeBuilder(size) pos = 0 while pos < size: ch = s[pos] # Non-escape characters are interpreted as... | 452,661 |
def __init__(self, *args): if args: raise Exception | def __init__(self, *args): if args: raise Exception | 452,662 |
def walker(insn, locs): sources = [] for loc in locs: for s in insn.all_sources_of(loc): sources.append(s) for source in sources: m = re.match("DWORD PTR " + self.LABEL, source) if m: reg.append(m.group(1)) if reg: return yield tuple(sources) | def walker(insn, locs): sources = [] for loc in locs: for s in insn.all_sources_of(loc): sources.append(s) for source in sources: m = re.match("DWORD PTR " + self.LABEL, source) if m: reg.append(m.group(1)) if reg: return yield tuple(sources) | 452,663 |
def f(self, op, regalloc, fcond): a0 = op.getarg(0) a1 = op.getarg(1) arg1 = regalloc.make_sure_var_in_reg(a0, selected_reg=r.r0, imm_fine=False) arg2 = regalloc.make_sure_var_in_reg(a1, [a0], selected_reg=r.r1, imm_fine=False) assert arg1 == r.r0 assert arg2 == r.r1 res = regalloc.force_allocate_reg(op.result, selecte... | def f(self, op, regalloc, fcond): a0 = op.getarg(0) a1 = op.getarg(1) arg1 = regalloc.make_sure_var_in_reg(a0, selected_reg=r.r0, imm_fine=False) arg2 = regalloc.make_sure_var_in_reg(a1, [a0], selected_reg=r.r1, imm_fine=False) assert arg1 == r.r0 assert arg2 == r.r1 regalloc.before_call() getattr(self.mc, opname)(fcon... | 452,664 |
def _parse_spec(self, default_type, default_align): space = self.space self._fill_char = self._lit("\0") self._align = default_align self._alternate = False self._sign = "\0" self._thousands_sep = False self._precision = -1 presentation_type = default_type spec = self.spec if not spec: return True length = len(spec) i ... | def _parse_spec(self, default_type, default_align): space = self.space self._fill_char = self._lit("\0") self._align = default_align self._alternate = False self._sign = "\0" self._thousands_sep = False self._precision = -1 the_type = default_type spec = self.spec if not spec: return True length = len(spec) i = 0 got_a... | 452,665 |
def _parse_spec(self, default_type, default_align): space = self.space self._fill_char = self._lit("\0") self._align = default_align self._alternate = False self._sign = "\0" self._thousands_sep = False self._precision = -1 presentation_type = default_type spec = self.spec if not spec: return True length = len(spec) i ... | def _parse_spec(self, default_type, default_align): space = self.space self._fill_char = self._lit("\0") self._align = default_align self._alternate = False self._sign = "\0" self._thousands_sep = False self._precision = -1 presentation_type = default_type spec = self.spec if not spec: return True length = len(spec) i ... | 452,666 |
def _parse_spec(self, default_type, default_align): space = self.space self._fill_char = self._lit("\0")[0] self._align = default_align self._alternate = False self._sign = "\0" self._thousands_sep = False self._precision = -1 the_type = default_type spec = self.spec if not spec: return True length = len(spec) i = 0 go... | def _parse_spec(self, default_type, default_align): space = self.space self._fill_char = self._lit("\0")[0] self._align = default_align self._alternate = False self._sign = "\0" self._thousands_sep = False self._precision = -1 the_type = default_type spec = self.spec if not spec: return True length = len(spec) i = 0 go... | 452,667 |
def emit_op_call(self, op, regalloc, fcond): locs = [] # all arguments past the 4th go on the stack # XXX support types other than int (one word types) if op.numargs() > 5: stack_args = op.numargs() - 5 n = stack_args*WORD self._adjust_sp(n, fcond=fcond) for i in range(5, op.numargs()): reg = regalloc.make_sure_var_in_... | def emit_op_call(self, op, regalloc, fcond): locs = [] # all arguments past the 4th go on the stack # XXX support types other than int (one word types) if op.numargs() > 5: stack_args = op.numargs() - 5 n = stack_args*WORD self._adjust_sp(n, regalloc, fcond=fcond) for i in range(5, op.numargs()): reg = regalloc.make_su... | 452,668 |
def _getfuncptr(self, argtypes, restype, thisarg=None): if self._ptr is not None: return self._ptr if restype is None or not isinstance(restype, _CDataMeta): import ctypes restype = ctypes.c_int argshapes = [arg._ffiargshape for arg in argtypes] resshape = restype._ffiargshape if self._buffer is not None: ptr = _rawffi... | def _getfuncptr(self, argtypes, restype, thisarg=None): if self._ptr is not None and argtypes is self._argtypes_: return self._ptr if restype is None or not isinstance(restype, _CDataMeta): import ctypes restype = ctypes.c_int argshapes = [arg._ffiargshape for arg in argtypes] resshape = restype._ffiargshape if self._b... | 452,669 |
def PyMember_GetOne(space, obj, w_member): addr = rffi.cast(ADDR, obj) addr += w_member.c_offset member_type = rffi.cast(lltype.Signed, w_member.c_type) for converter in integer_converters: typ, lltyp, _ = converter if typ == member_type: result = rffi.cast(rffi.CArrayPtr(lltyp), addr) if lltyp is rffi.FLOAT: w_result... | def PyMember_GetOne(space, obj, w_member): addr = rffi.cast(ADDR, obj) addr += w_member.c_offset member_type = rffi.cast(lltype.Signed, w_member.c_type) for converter in integer_converters: typ, lltyp, _ = converter if typ == member_type: result = rffi.cast(rffi.CArrayPtr(lltyp), addr) if lltyp is rffi.FLOAT: w_result... | 452,670 |
def closed_get(space, self): return space.w_bool(not self.is_valid()) | def closed_get(space, self): return space.w_bool(not self.is_valid()) | 452,671 |
def readable_get(space, self): return space.w_bool(self.flags & READABLE) | def readable_get(space, self): return space.w_bool(self.flags & READABLE) | 452,672 |
def writable_get(space, self): return space.w_bool(self.flags & WRITABLE) | def writable_get(space, self): return space.w_bool(self.flags & WRITABLE) | 452,673 |
def recv_bytes(self, space, maxlength=PY_SSIZE_T_MAX): self._check_readable(space) if maxlength < 0: raise OperationError(space.w_ValueError, space.wrap("maxlength < 0")) | def recv_bytes(self, space, maxlength=PY_SSIZE_T_MAX): self._check_readable(space) if maxlength < 0: raise OperationError(space.w_ValueError, space.wrap("maxlength < 0")) | 452,674 |
def recv_bytes_into(self, space, w_buffer, offset=0): rwbuffer = space.rwbuffer_w(w_buffer) length = rwbuffer.getlength() | def recv_bytes_into(self, space, w_buffer, offset=0): rwbuffer = space.rwbuffer_w(w_buffer) length = rwbuffer.getlength() | 452,675 |
def recv_bytes_into(self, space, w_buffer, offset=0): rwbuffer = space.rwbuffer_w(w_buffer) length = rwbuffer.getlength() | def recv_bytes_into(self, space, w_buffer, offset=0): rwbuffer = space.rwbuffer_w(w_buffer) length = rwbuffer.getlength() | 452,676 |
def recv(self, space): self._check_readable(space) | def recv(self, space): self._check_readable(space) | 452,677 |
def recv(self, space): self._check_readable(space) | def recv(self, space): self._check_readable(space) | 452,678 |
def descr_new(space, w_subtype, fd, readable=True, writable=True): flags = (readable and READABLE) | (writable and WRITABLE) | def descr_new_file(space, w_subtype, fd, readable=True, writable=True): flags = (readable and READABLE) | (writable and WRITABLE) | 452,679 |
def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(rffi.cast(rffi.CCHARP, length_ptr), 4) length = length_ptr[0] if length > maxlength: return MP_BAD_MESSAGE_LENGTH | def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(space, rffi.cast(rffi.CCHARP, length_ptr), 4) length = intmask(length_ptr[0]) if length > maxlength: return MP_BAD_MESSAGE_LENGTH | 452,680 |
def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(rffi.cast(rffi.CCHARP, length_ptr), 4) length = length_ptr[0] if length > maxlength: return MP_BAD_MESSAGE_LENGTH | def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(rffi.cast(rffi.CCHARP, length_ptr), 4) length = length_ptr[0] if length > maxlength: return MP_BAD_MESSAGE_LENGTH | 452,681 |
def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(rffi.cast(rffi.CCHARP, length_ptr), 4) length = length_ptr[0] if length > maxlength: return MP_BAD_MESSAGE_LENGTH | def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(rffi.cast(rffi.CCHARP, length_ptr), 4) length = length_ptr[0] if length > maxlength: return MP_BAD_MESSAGE_LENGTH | 452,682 |
def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(rffi.cast(rffi.CCHARP, length_ptr), 4) length = length_ptr[0] if length > maxlength: return MP_BAD_MESSAGE_LENGTH | def do_recv_string(self, space, maxlength): length_ptr = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 1, flavor='raw') self._recvall(rffi.cast(rffi.CCHARP, length_ptr), 4) length = length_ptr[0] if length > maxlength: return MP_BAD_MESSAGE_LENGTH | 452,683 |
def _recvall(self, buffer, length): remaining = length while remaining > 0: try: data = os.read(self.fd, remaining) except OSError, e: raise wrap_oserror(space, e) count = len(data) if count == 0: if remaining == length: return MP_END_OF_FILE else: return MP_EARLY_END_OF_FILE # XXX inefficient for i in range(count): bu... | def _recvall(self, space, buffer, length): length = intmask(length) remaining = length while remaining > 0: try: data = os.read(self.fd, remaining) except OSError, e: raise wrap_oserror(space, e) count = len(data) if count == 0: if remaining == length: return MP_END_OF_FILE else: return MP_EARLY_END_OF_FILE # XXX ineff... | 452,684 |
def _recvall(self, buffer, length): remaining = length while remaining > 0: try: data = os.read(self.fd, remaining) except OSError, e: raise wrap_oserror(space, e) count = len(data) if count == 0: if remaining == length: return MP_END_OF_FILE else: return MP_EARLY_END_OF_FILE # XXX inefficient for i in range(count): bu... | def _recvall(self, buffer, length): remaining = length while remaining > 0: try: data = os.read(self.fd, remaining) except OSError, e: raise wrap_oserror(space, e) count = len(data) if count == 0: if remaining == length: raise mp_error(space, MP_END_OF_FILE) else: return MP_EARLY_END_OF_FILE # XXX inefficient for i in ... | 452,685 |
def _recvall(self, buffer, length): remaining = length while remaining > 0: try: data = os.read(self.fd, remaining) except OSError, e: raise wrap_oserror(space, e) count = len(data) if count == 0: if remaining == length: return MP_END_OF_FILE else: return MP_EARLY_END_OF_FILE # XXX inefficient for i in range(count): bu... | def _recvall(self, buffer, length): remaining = length while remaining > 0: try: data = os.read(self.fd, remaining) except OSError, e: raise wrap_oserror(space, e) count = len(data) if count == 0: if remaining == length: return MP_END_OF_FILE else: raise mp_error(space, MP_EARLY_END_OF_FILE) # XXX inefficient for i in ... | 452,686 |
W_FileConnection.typedef = TypeDef( 'Connection', base_typedef, __new__ = interp2app(W_FileConnection.descr_new.im_func), fileno = interp2app(W_FileConnection.fileno), | W_FileConnection.typedef = TypeDef( 'Connection', W_BaseConnection.typedef, __new__ = interp2app(W_FileConnection.descr_new_file.im_func), fileno = interp2app(W_FileConnection.fileno), | 452,687 |
def descr_new(space, w_subtype, w_handle, readable=True, writable=True): from pypy.module._multiprocessing.interp_win32 import handle_w handle = handle_w(space, w_handle) flags = (readable and READABLE) | (writable and WRITABLE) | def descr_new_pipe(space, w_subtype, w_handle, readable=True, writable=True): from pypy.module._multiprocessing.interp_win32 import handle_w handle = handle_w(space, w_handle) flags = (readable and READABLE) | (writable and WRITABLE) | 452,688 |
def do_send_string(self, space, buffer, offset, size): from pypy.module._multiprocessing.interp_win32 import ( _WriteFile, ERROR_NO_SYSTEM_RESOURCES) from pypy.rlib import rwin32 | def do_send_string(self, space, buffer, offset, size): from pypy.module._multiprocessing.interp_win32 import ( _WriteFile, ERROR_NO_SYSTEM_RESOURCES) from pypy.rlib import rwin32 | 452,689 |
def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 | def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 | 452,690 |
def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 | def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 | 452,691 |
def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 | def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 | 452,692 |
def _variant(**kwargs): txt = kwargs[self.format] print >> output, "\t%s" % txt | def _variant(**kwargs): txt = kwargs[self.format] print >> output, "\t%s" % txt | 452,693 |
def _get_str(self): return self.val | def _get_str(self): return self.val | 452,694 |
def _get_str(self): return self.val | def _get_str(self): return self.val | 452,695 |
def setup(self): """Called at run-time to initialize the GC.""" # # Hack: MovingGCBase.setup() sets up stuff related to id(), which # we implement differently anyway. So directly call GCBase.setup(). GCBase.setup(self) # # A list of all raw_malloced objects (the objects too large) self.rawmalloced_objects = self.Addre... | def setup(self): """Called at run-time to initialize the GC.""" # # Hack: MovingGCBase.setup() sets up stuff related to id(), which # we implement differently anyway. So directly call GCBase.setup(). GCBase.setup(self) # # A list of all raw_malloced objects (the objects too large) self.rawmalloced_objects = self.Addre... | 452,696 |
def setup(self): """Called at run-time to initialize the GC.""" # # Hack: MovingGCBase.setup() sets up stuff related to id(), which # we implement differently anyway. So directly call GCBase.setup(). GCBase.setup(self) # # A list of all raw_malloced objects (the objects too large) self.rawmalloced_objects = self.Addre... | def setup(self): """Called at run-time to initialize the GC.""" # # Hack: MovingGCBase.setup() sets up stuff related to id(), which # we implement differently anyway. So directly call GCBase.setup(). GCBase.setup(self) # # A list of all raw_malloced objects (the objects too large) self.rawmalloced_objects = self.Addre... | 452,697 |
def PyFile_AsFile(space, p): """Return the file object associated with p as a FILE*. If the caller will ever use the returned FILE* object while the GIL is released it must also call the PyFile_IncUseCount() and PyFile_DecUseCount() functions described below as appropriate.""" raise NotImplementedError | def PyFile_AsFile(space, p): """Return the file object associated with p as a FILE*. If the caller will ever use the returned FILE* object while the GIL is released it must also call the PyFile_IncUseCount() and PyFile_DecUseCount() functions described below as appropriate.""" raise NotImplementedError | 452,698 |
def optimize_loop(self, ops, spectext, optops, checkspecnodes=True): loop = self.parse(ops) # if checkspecnodes: # verify that 'spectext' is indeed what optimizefindnode would # compute for this loop cpu = self.cpu perfect_specialization_finder = PerfectSpecializationFinder(cpu) perfect_specialization_finder.find_nodes... | def optimize_loop(self, ops, spectext, optops, checkspecnodes=True, expected_preamble=None): loop = self.parse(ops) # if checkspecnodes: # verify that 'spectext' is indeed what optimizefindnode would # compute for this loop cpu = self.cpu perfect_specialization_finder = PerfectSpecializationFinder(cpu) perfect_speciali... | 452,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.