rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
'Connection', base_typedef, __new__ = interp2app(W_FileConnection.descr_new.im_func), | 'Connection', W_BaseConnection.typedef, __new__ = interp2app(W_FileConnection.descr_new_file.im_func), | W_FileConnection.typedef = TypeDef( 'Connection', base_typedef, __new__ = interp2app(W_FileConnection.descr_new.im_func), fileno = interp2app(W_FileConnection.fileno), |
def descr_new(space, w_subtype, w_handle, readable=True, writable=True): | def descr_new_pipe(space, w_subtype, w_handle, readable=True, writable=True): | 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) |
raise operrfmt( | raise operationerrfmt( | 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 |
return read_ptr[0], None | return read_ptr[0], lltype.nullptr(rffi.CCHARP.TO) | def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 |
return MP_BAD_MESSAGE_LENGTH | return MP_BAD_MESSAGE_LENGTH, lltype.nullptr(rffi.CCHARP.TO) | def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 |
return MP_STANDARD_ERROR, None | return MP_STANDARD_ERROR, lltype.nullptr(rffi.CCHARP.TO) | def do_recv_string(self, space, maxlength): from pypy.module._multiprocessing.interp_win32 import ( _ReadFile) from pypy.rlib import rwin32 |
elif self.format == 'elf64': | elif self.format in ('elf64', 'darwin64'): | def _variant(**kwargs): txt = kwargs[self.format] print >> output, "\t%s" % txt |
ResOperation(rop.DEBUG_MERGE_POINT, [FakeString("hello")], None), | ResOperation(rop.DEBUG_MERGE_POINT, [FakeString("hello"), 0], None), | def _get_str(self): return self.val |
ResOperation(rop.DEBUG_MERGE_POINT, [FakeString("bye")], None), | ResOperation(rop.DEBUG_MERGE_POINT, [FakeString("bye"), 0], None), | def _get_str(self): return self.val |
minsize = 2 * (self.nonlarge_max + 1) | minsize = int(1.9 * self.nonlarge_max) if we_are_translated(): minsize = (minsize + 4095) & ~4095 | 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... |
FILE = rffi.VOIDP_real.TO FILEP = lltype.Ptr(FILE) | 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 optimize_loop(self, ops, spectext, optops, checkspecnodes=True): | def optimize_loop(self, ops, spectext, optops, checkspecnodes=True, expected_preamble=None): | 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... |
[i] i0 = int_sub(i, 1) guard_value(i0, 0) [i0] jump(i) """ expected = """ [i] i0 = int_sub(i, 1) guard_value(i0, 0) [i0] jump(1) """ self.optimize_loop(ops, 'Not', expected) | [] f = escape() f0 = float_sub(f, 1.0) guard_value(f0, 0.0) [f0] escape(f) jump() """ self.optimize_loop(ops, '', ops) | def test_simple(self): ops = """ [i] i0 = int_sub(i, 1) guard_value(i0, 0) [i0] jump(i) """ expected = """ [i] i0 = int_sub(i, 1) guard_value(i0, 0) [i0] jump(1) """ self.optimize_loop(ops, 'Not', expected) |
expected = """ | preamble = """ | def test_remove_guard_class_1(self): ops = """ [p0] guard_class(p0, ConstClass(node_vtable)) [] guard_class(p0, ConstClass(node_vtable)) [] jump(p0) """ expected = """ [p0] guard_class(p0, ConstClass(node_vtable)) [] jump(p0) """ self.optimize_loop(ops, 'Not', expected) |
self.optimize_loop(ops, 'Not', expected) | expected = """ [p0] jump(p0) """ self.optimize_loop(ops, 'Not', expected, expected_preamble=preamble) | def test_remove_guard_class_1(self): ops = """ [p0] guard_class(p0, ConstClass(node_vtable)) [] guard_class(p0, ConstClass(node_vtable)) [] jump(p0) """ expected = """ [p0] guard_class(p0, ConstClass(node_vtable)) [] jump(p0) """ self.optimize_loop(ops, 'Not', expected) |
[i0, i1] | [] i0 = escape() i1 = escape() | def test_bound_eq(self): ops = """ [i0, i1] i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] i4 = int_lt(i1, 5) guard_true(i4) [] jump(i0, i1) """ expected = """ [i0, i1] i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] jump(i0, i1) """ self.optimize_loop(ops, 'Not, N... |
jump(i0, i1) """ expected = """ [i0, i1] | jump() """ expected = """ [] i0 = escape() i1 = escape() | def test_bound_eq(self): ops = """ [i0, i1] i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] i4 = int_lt(i1, 5) guard_true(i4) [] jump(i0, i1) """ expected = """ [i0, i1] i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] jump(i0, i1) """ self.optimize_loop(ops, 'Not, N... |
jump(i0, i1) """ self.optimize_loop(ops, 'Not, Not', expected) | jump() """ self.optimize_loop(ops, '', expected) | def test_bound_eq(self): ops = """ [i0, i1] i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] i4 = int_lt(i1, 5) guard_true(i4) [] jump(i0, i1) """ expected = """ [i0, i1] i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] jump(i0, i1) """ self.optimize_loop(ops, 'Not, N... |
[i0] | [] i0 = escape() | def test_bound_eq_const(self): ops = """ [i0] i1 = int_eq(i0, 7) guard_true(i1) [] i2 = int_add(i0, 3) jump(i2) """ expected = """ [i0] i1 = int_eq(i0, 7) guard_true(i1) [] jump(10) |
jump(i2) """ expected = """ [i0] | escape(i2) jump() """ expected = """ [] i0 = escape() | def test_bound_eq_const(self): ops = """ [i0] i1 = int_eq(i0, 7) guard_true(i1) [] i2 = int_add(i0, 3) jump(i2) """ expected = """ [i0] i1 = int_eq(i0, 7) guard_true(i1) [] jump(10) |
jump(10) """ self.optimize_loop(ops, 'Not', expected) | escape(10) jump() """ self.optimize_loop(ops, '', expected) | def test_bound_eq_const(self): ops = """ [i0] i1 = int_eq(i0, 7) guard_true(i1) [] i2 = int_add(i0, 3) jump(i2) """ expected = """ [i0] i1 = int_eq(i0, 7) guard_true(i1) [] jump(10) |
"guard_isnull", | def main(n): s = 0 for i in range(n): s += g(n)[i] return s | |
def LOOKUP_METHOD(self, nameindex, next_instr): space = self.space w_obj = self.popvalue() w_name = self.getname_w(nameindex) w_value = space.getattr(w_obj, w_name) self.pushvalue(w_value) def CALL_METHOD(self, nargs, next_instr): w_callable = self.peekvalue(nargs) try: w_result = self.space.call_valuestack(w_calla... | LOOKUP_METHOD = LOAD_ATTR CALL_METHOD = CALL_FUNCTION | def LOOKUP_METHOD(self, nameindex, next_instr): # overridden by faster version in the standard object space. space = self.space w_obj = self.popvalue() w_name = self.getname_w(nameindex) w_value = space.getattr(w_obj, w_name) self.pushvalue(w_value) |
'pypy\\lib\\_pypy_interact.py' in r.lower()) and | r'pypy\\lib\\_pypy_interact.py' in r.lower()) and | def test_repr(self): import sys r = repr(sys) assert r == "<module 'sys' (built-in)>" import _pypy_interact # known to be in pypy/lib r = repr(_pypy_interact) assert (r.startswith("<module '_pypy_interact' from ") and ('pypy/lib/_pypy_interact.py' in r or 'pypy\\lib\\_pypy_interact.py' in r.lower()) and r.endswith('>'... |
if argtype._ffishape == 'u': | if argtype._ffishape == 'u' or argtype._ffishape == 'c': | def _unwrap_args(self, argtypes, args): """ Convert from ctypes high-level values to low-level values suitables to be passed to _ffi """ assert len(argtypes) == len(args) newargs = [] # XXX: investigate the difference between _ffishape and _ffiargshape for argtype, arg in zip(argtypes, args): if argtype._ffishape == 'u... |
rstack.resume_point("CALL_METHOD", f, w_self, n_args, returns=w_result) | 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:... | |
self.cpu.assembler.setup() | self.cpu.assembler.setup_once() | def f(size): allocs.insert(0, size) buf = ctypes.create_string_buffer(size) all.append(buf) return ctypes.cast(buf, ctypes.c_void_p).value |
self.check_tree_loop_count(2) | if self.optimizer == OPTIMIZER_SIMPLE: self.check_tree_loop_count(1) else: self.check_tree_loop_count(2) | def f(y): state = State() x = 0 while y > 0: myjitdriver.can_enter_jit(x=x, y=y, state=state) myjitdriver.jit_merge_point(x=x, y=y, state=state) x += state.externfn(y)() y -= 1 return x |
self.cbcalled = 0 def callback(self, ref): self.cbcalled += 1 class ReferencesTestCase(TestBase): def test_basic_ref(self): self.check_basic_ref(C) self.check_basic_ref(create_function) self.check_basic_ref(create_bound_method) self.check_basic_ref(create_unbound_method) o = C() wr = weakref.ref(o) repr(wr) del... | self.items = [SomeClass(c) for c in ('a', 'b', 'c')] self.items2 = [SomeClass(c) for c in ('x', 'y', 'z')] self.letters = [SomeClass(c) for c in string.ascii_letters] self.s = WeakSet(self.items) self.d = dict.fromkeys(self.items) self.obj = SomeClass('F') self.fs = WeakSet([self.obj]) def test_methods(self): weaksetm... | def setUp(self): self.cbcalled = 0 |
r = weakref.ref(Exception) self.assertRaises(TypeError, r.__init__, 0, 0, 0, 0, 0) gc_collect() def test_classes(self): class A(object): pass class B: pass l = [] weakref.ref(int) a = weakref.ref(A, l.append) A = None gc_collect() self.assertEqual(a(), None) self.assertEqual(l, [a]) b = weakref.ref(B, l.append) B =... | s = WeakSet() s.__init__(self.items) self.assertEqual(s, self.s) s.__init__(self.items2) self.assertEqual(s, WeakSet(self.items2)) self.assertRaises(TypeError, s.__init__, s, 2); self.assertRaises(TypeError, s.__init__, 1); def test_constructor_identity(self): s = WeakSet(self.items) t = WeakSet(s) self.assertNotEqual... | def test_init(self): # Issue 3634 # <weakref to class>.__init__() doesn't check errors correctly r = weakref.ref(Exception) self.assertRaises(TypeError, r.__init__, 0, 0, 0, 0, 0) # No exception should be raised here gc_collect() |
test_main() | test_main(verbose=True) | def test_main(): test_support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, SubclassableWeakrefTestCase, ) test_support.run_doctest(sys.modules[__name__]) |
assert exc.msg == "EOF in multi-line statement" | assert exc.msg == "parenthesis is never closed" | def test_syntax_error(self): parse = self.parse exc = py.test.raises(SyntaxError, parse, "name another for").value assert exc.msg == "invalid syntax" assert exc.lineno == 1 assert exc.offset == 5 assert exc.text.startswith("name another for") exc = py.test.raises(SyntaxError, parse, "x = \"blah\n\n\n").value assert exc... |
return space.wrap(_strcoll(rffi.str2charp(s1), rffi.str2charp(s2))) | s1_c = rffi.str2charp(s1) s2_c = rffi.str2charp(s2) try: return space.wrap(_strcoll(s1_c, s2_c)) finally: rffi.free_charp(s1_c) rffi.free_charp(s2_c) | def strcoll(space, w_s1, w_s2): "string,string -> int. Compares two strings according to the locale." if space.is_true(space.isinstance(w_s1, space.w_str)) and \ space.is_true(space.isinstance(w_s2, space.w_str)): s1, s2 = space.str_w(w_s1), space.str_w(w_s2) return space.wrap(_strcoll(rffi.str2charp(s1), rffi.str2ch... |
result = _wcscoll(s1_c, s2_c) | try: result = _wcscoll(s1_c, s2_c) finally: rffi.free_wcharp(s1_c) rffi.free_wcharp(s2_c) | def strcoll(space, w_s1, w_s2): "string,string -> int. Compares two strings according to the locale." if space.is_true(space.isinstance(w_s1, space.w_str)) and \ space.is_true(space.isinstance(w_s2, space.w_str)): s1, s2 = space.str_w(w_s1), space.str_w(w_s2) return space.wrap(_strcoll(rffi.str2charp(s1), rffi.str2ch... |
n2 = _strxfrm(buf, rffi.str2charp(s), n1) + 1 | s_c = rffi.str2charp(s) try: n2 = _strxfrm(buf, s_c, n1) + 1 finally: rffi.free_charp(s_c) | def strxfrm(space, s): "string -> string. Returns a string that behaves for cmp locale-aware." n1 = len(s) + 1 buf = lltype.malloc(rffi.CCHARP.TO, n1, flavor="raw", zero=True) n2 = _strxfrm(buf, rffi.str2charp(s), n1) + 1 if n2 > n1: # more space needed lltype.free(buf, flavor="raw") buf = lltype.malloc(rffi.CCHARP.TO... |
_strxfrm(buf, rffi.str2charp(s), n2) | s_c = rffi.str2charp(s) try: _strxfrm(buf, s_c, n2) finally: rffi.free_charp(s_c) | def strxfrm(space, s): "string -> string. Returns a string that behaves for cmp locale-aware." n1 = len(s) + 1 buf = lltype.malloc(rffi.CCHARP.TO, n1, flavor="raw", zero=True) n2 = _strxfrm(buf, rffi.str2charp(s), n1) + 1 if n2 > n1: # more space needed lltype.free(buf, flavor="raw") buf = lltype.malloc(rffi.CCHARP.TO... |
return space.wrap(rffi.charp2str(_gettext(rffi.str2charp(msg)))) | msg_c = rffi.str2charp(msg) try: return space.wrap(rffi.charp2str(_gettext(msg_c))) finally: rffi.free_charp(msg_c) | def gettext(space, msg): """gettext(msg) -> string Return translation of msg.""" return space.wrap(rffi.charp2str(_gettext(rffi.str2charp(msg)))) |
result = _dgettext(domain, rffi.str2charp(msg)) | msg_c = rffi.str2charp(msg) try: result = _dgettext(domain, msg_c) finally: rffi.free_charp(msg_c) | def dgettext(space, w_domain, msg): """dgettext(domain, msg) -> string Return translation of msg in domain.""" if space.is_w(w_domain, space.w_None): domain = None result = _dgettext(domain, rffi.str2charp(msg)) else: domain = space.str_w(w_domain) result = _dgettext(rffi.str2charp(domain), rffi.str2charp(msg)) |
result = _dgettext(rffi.str2charp(domain), rffi.str2charp(msg)) | domain_c = rffi.str2charp(domain) msg_c = rffi.str2charp(msg) try: result = _dgettext(domain_c, msg_c) finally: rffi.free_charp(domain_c) rffi.free_charp(msg_c) | def dgettext(space, w_domain, msg): """dgettext(domain, msg) -> string Return translation of msg in domain.""" if space.is_w(w_domain, space.w_None): domain = None result = _dgettext(domain, rffi.str2charp(msg)) else: domain = space.str_w(w_domain) result = _dgettext(rffi.str2charp(domain), rffi.str2charp(msg)) |
result = _dcgettext(domain, rffi.str2charp(msg), rffi.cast(rffi.INT, category)) | msg_c = rffi.str2charp(msg) try: result = _dcgettext(domain, msg_c, rffi.cast(rffi.INT, category)) finally: rffi.free_charp(msg_c) | def dcgettext(space, w_domain, msg, category): """dcgettext(domain, msg, category) -> string Return translation of msg in domain and category.""" |
result = _dcgettext(rffi.str2charp(domain), rffi.str2charp(msg), rffi.cast(rffi.INT, category)) | domain_c = rffi.str2charp(domain) msg_c = rffi.str2charp(msg) try: result = _dcgettext(domain_c, msg_c, rffi.cast(rffi.INT, category)) finally: rffi.free_charp(domain_c) rffi.free_charp(msg_c) | def dcgettext(space, w_domain, msg, category): """dcgettext(domain, msg, category) -> string Return translation of msg in domain and category.""" |
result = _textdomain(rffi.str2charp(domain)) | domain_c = rffi.str2charp(domain) try: result = _textdomain(domain_c) finally: rffi.free_charp(domain_c) | def textdomain(space, w_domain): """textdomain(domain) -> string Set the C library's textdomain to domain, returning the new domain.""" |
dirname = _bindtextdomain(rffi.str2charp(domain), dir) | domain_c = rffi.str2charp(domain) try: dirname = _bindtextdomain(domain_c, dir) finally: rffi.free_charp(domain_c) | def bindtextdomain(space, domain, w_dir): """bindtextdomain(domain, dir) -> string Bind the C library's domain to dir.""" |
dirname = _bindtextdomain(rffi.str2charp(domain), rffi.str2charp(dir)) | domain_c = rffi.str2charp(domain) dir_c = rffi.str2charp(dir) try: dirname = _bindtextdomain(domain_c, dir_c) finally: rffi.free_charp(domain_c) rffi.free_charp(dir_c) | def bindtextdomain(space, domain, w_dir): """bindtextdomain(domain, dir) -> string Bind the C library's domain to dir.""" |
result = _bind_textdomain_codeset( rffi.str2charp(domain), codeset) | domain_c = rffi.str2charp(domain) try: result = _bind_textdomain_codeset(domain_c, codeset) finally: rffi.free_charp(domain_c) | def bind_textdomain_codeset(space, domain, w_codeset): """bind_textdomain_codeset(domain, codeset) -> string Bind the C library's domain to codeset.""" |
result = _bind_textdomain_codeset(rffi.str2charp(domain), rffi.str2charp(codeset)) | domain_c = rffi.str2charp(domain) codeset_c = rffi.str2charp(codeset) try: result = _bind_textdomain_codeset(domain_c, codeset_c) finally: rffi.free_charp(domain_c) rffi.free_charp(codeset_c) | def bind_textdomain_codeset(space, domain, w_codeset): """bind_textdomain_codeset(domain, codeset) -> string Bind the C library's domain to codeset.""" |
if str(exc) == excmsg: | if excmsg is None or str(exc) == excmsg: | def test_exc(formatstr, args, exception, excmsg): try: testformat(formatstr, args) except exception, exc: if str(exc) == excmsg: if verbose: print "yes" else: if verbose: print 'no' print 'Unexpected ', exception, ':', repr(str(exc)) except: if verbose: print 'no' print 'Unexpected exception' raise else: raise TestFail... |
test_exc('%d', '1', TypeError, "int argument required") test_exc('%g', '1', TypeError, "float argument required") | test_exc('%d', '1', TypeError, None) test_exc('%g', '1', TypeError, None) | def test_exc(formatstr, args, exception, excmsg): try: testformat(formatstr, args) except exception, exc: if str(exc) == excmsg: if verbose: print "yes" else: if verbose: print 'no' print 'Unexpected ', exception, ':', repr(str(exc)) except: if verbose: print 'no' print 'Unexpected exception' raise else: raise TestFail... |
code = [0] * n for i in range(n): x = space.uint_w(space.getitem(w_code, space.wrap(i))) code[i] = intmask(x) | code = [intmask(space.uint_w(space.getitem(w_code, space.wrap(i)))) for i in range(n)] | def SRE_Pattern__new__(space, w_subtype, w_pattern, flags, w_code, groups=0, w_groupindex=None, w_indexgroup=None): n = space.int_w(space.len(w_code)) code = [0] * n for i in range(n): x = space.uint_w(space.getitem(w_code, space.wrap(i))) code[i] = intmask(x) # w_srepat = space.allocate_instance(W_SRE_Pattern, w_subty... |
box.unique = UNIQUE_NO | def mark_escaped(self): # invariant: if escaped=True, then dependencies is None if not self.escaped: self.escaped = True if self.dependencies is not None: deps = self.dependencies self.dependencies = None for box in deps: box.mark_escaped() # see test_find_nodes_store_into_loop_constant_1 for this: box.unique = UNIQUE_... | |
if tc in 'IL': | if tc == 'L': | def test_array_sum(self): for tc, maxops in zip('bhilBHILfd', (38,) * 6 + (40, 40, 41, 38)): res = 19352859 if tc in 'IL': res = long(res) elif tc in 'fd': res = float(res) self.run_source(''' from array import array |
elif tc == 'I' and sys.maxint == 2147483647: res = long(res) | def test_array_sum(self): for tc, maxops in zip('bhilBHILfd', (38,) * 6 + (40, 40, 41, 38)): res = 19352859 if tc in 'IL': res = long(res) elif tc in 'fd': res = float(res) self.run_source(''' from array import array | |
if tc in 'IL': | if tc == 'L': | def test_array_intimg(self): # XXX this test is way too imprecise in what it is actually testing # it should count the number of guards instead for tc, maxops in zip('ilILd', (67, 67, 70, 70, 61)): print print '='*65 print '='*20, 'running test for tc=%r' % (tc,), '='*20 res = 73574560 if tc in 'IL': res = long(res) el... |
elif tc == 'I' and sys.maxint == 2147483647: res = long(res) | def test_array_intimg(self): # XXX this test is way too imprecise in what it is actually testing # it should count the number of guards instead for tc, maxops in zip('ilILd', (67, 67, 70, 70, 61)): print print '='*65 print '='*20, 'running test for tc=%r' % (tc,), '='*20 res = 73574560 if tc in 'IL': res = long(res) el... | |
filename = '<codegen %s:%d>' % (fn, lineno) | filename = base + '%s:%d>' % (fn, lineno) | def compile(self, filename=None, mode='exec', flag=generators.compiler_flag, dont_inherit=0, _genframe=None): """ return compiled code object. if filename is None invent an artificial filename which displays the source/line position of the caller frame. """ if not filename or py.path.local(filename).check(file=0): if _... |
filename = '<codegen %r %s:%d>' % (filename, fn, lineno) | filename = base + '%r %s:%d>' % (filename, fn, lineno) | def compile(self, filename=None, mode='exec', flag=generators.compiler_flag, dont_inherit=0, _genframe=None): """ return compiled code object. if filename is None invent an artificial filename which displays the source/line position of the caller frame. """ if not filename or py.path.local(filename).check(file=0): if _... |
self.mc.CMP_rr(l0.value, l1.getint()) | self.mc.CMP_ri(l0.value, l1.getint()) | def emit_op_guard_value(self, op, regalloc, fcond): a0 = op.getarg(0) a1 = op.getarg(1) l0 = regalloc.make_sure_var_in_reg(a0, imm_fine=False) l1 = regalloc.make_sure_var_in_reg(a1) if l1.is_imm(): self.mc.CMP_rr(l0.value, l1.getint()) else: self.mc.CMP_rr(l0.value, l1.value) regalloc.possibly_free_vars_for_op(op) retu... |
value &= BIT_MASK(numbits - 1) | value &= rffi.cast(ll_t, BIT_MASK(numbits - 1)) | def cast_pos(self, i, ll_t): pos = rffi.ptradd(self.ll_buffer, self.shape.ll_positions[i]) TP = lltype.Ptr(rffi.CArray(ll_t)) value = rffi.cast(TP, pos)[0] # Handle bitfields for c in unroll_letters_for_numbers: if LL_TYPEMAP[c] is ll_t and self.shape.ll_bitsizes: bitsize = self.shape.ll_bitsizes[i] numbits = NUM_BITS... |
value &= BIT_MASK(numbits) | value &= rffi.cast(ll_t, BIT_MASK(numbits)) | def cast_pos(self, i, ll_t): pos = rffi.ptradd(self.ll_buffer, self.shape.ll_positions[i]) TP = lltype.Ptr(rffi.CArray(ll_t)) value = rffi.cast(TP, pos)[0] # Handle bitfields for c in unroll_letters_for_numbers: if LL_TYPEMAP[c] is ll_t and self.shape.ll_bitsizes: bitsize = self.shape.ll_bitsizes[i] numbits = NUM_BITS... |
space = gettestobjspace(usemodules=('_stackless',)) | space = gettestobjspace(usemodules=('_stackless','_socket')) | def setup_class(cls): space = gettestobjspace(usemodules=('_stackless',)) cls.space = space # cannot test the unpickle part on top of py.py cls.w_can_unpickle = space.wrap(bool(option.runappdirect)) |
return | return 0 | def PyType_Ready(space, pto): if pto.c_tp_flags & Py_TPFLAGS_READY: return assert pto.c_tp_flags & Py_TPFLAGS_READYING == 0 pto.c_tp_flags |= Py_TPFLAGS_READYING try: type_realize(space, rffi.cast(PyObject, pto)) pto.c_tp_flags |= Py_TPFLAGS_READY finally: pto.c_tp_flags &= ~Py_TPFLAGS_READYING return 0 |
n = self._write(space, data[written:size - written]) | n = self._write(space, data[written:]) | def write_w(self, space, w_data): self._check_closed(space, "write to closed file") data = space.str_w(w_data) size = len(data) |
self.staticdata.log('cancelled, going on...') | self.staticdata.log('cancelled, tracing more...') | def reached_loop_header(self, greenboxes, redboxes): duplicates = {} self.remove_consts_and_duplicates(redboxes, len(redboxes), duplicates) live_arg_boxes = greenboxes + redboxes if self.jitdriver_sd.virtualizable_info is not None: # we use pop() to remove the last item, which is the virtualizable # itself self.remove_... |
self.check_loop_count(2) self.check_tree_loop_count(2) | if self.optimizer == OPTIMIZER_FULL: self.check_loop_count(2) self.check_tree_loop_count(2) else: self.check_loop_count(2) self.check_tree_loop_count(1) | def f(x, y): z = Z(y) while x > 0: myjitdriver.can_enter_jit(x=x, z=z) myjitdriver.jit_merge_point(x=x, z=z) if x % 5 != 0: externfn(z) z = Z(z.elem + 1) x -= 1 return z.elem |
if endian < 0: pendian[0] = -1 elif endian > 0: pendian[0] = 1 else: pendian[0] = 0 | pendian[0] = rffi.cast(rffi.INT, value) | def test(encoded, endian, realendian=None): encoded_charp = rffi.str2charp(encoded) strict_charp = rffi.str2charp("strict") if endian is not None: pendian = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') if endian < 0: pendian[0] = -1 elif endian > 0: pendian[0] = 1 else: pendian[0] = 0 else: pendian = None |
errcode = g_gettimeofday(t) | errcode = c_gettimeofday(t) | def time_time_llimpl(): void = lltype.nullptr(rffi.VOIDP.TO) result = -1.0 if self.HAVE_GETTIMEOFDAY: t = lltype.malloc(self.TIMEVAL, flavor='raw') |
'int', descr=descr) | 'void', descr=descr) | def test_raw_malloced_setarrayitem(self): ARRAY = rffi.CArray(lltype.Signed) descr = self.cpu.arraydescrof(ARRAY) a = lltype.malloc(ARRAY, 10, flavor='raw') addr = llmemory.cast_ptr_to_adr(a) abox = BoxInt(heaptracker.adr2int(addr)) self.execute_operation(rop.SETARRAYITEM_RAW, [abox, BoxInt(5), BoxInt(12345)], 'int', d... |
cmd = "%s %s %d %s %s %s %s %s" %( | cmd = "%s %s %d %s -S %s %s %s %s" %( | def getinvocation(self, regrtest): fspath = regrtest.getfspath() python = sys.executable pypy_script = pypydir.join('bin', 'py.py') alarm_script = pypydir.join('tool', 'alarm.py') if sys.platform == 'win32': watchdog_name = 'watchdog_nt.py' else: watchdog_name = 'watchdog.py' watchdog_script = pypydir.join('tool', watc... |
"<_rawffi.Array '?' (%d, %d)>" % (4*lsize, lsize)) | "<_rawffi.Array '\0' (%d, %d)>" % (4*lsize, lsize)) | def test_repr(self): import _rawffi, struct isize = struct.calcsize("i") lsize = struct.calcsize("l") assert (repr(_rawffi.Array('i')) == "<_rawffi.Array 'i' (%d, %d)>" % (isize, isize)) |
'large_object_gcptrs': 10*WORD, | def test_malloc_nonmovable_fixsize(self): py.test.skip("not supported") | |
py.test.skip("XXX this needs to be fixed, maybe") class X: def m(self): return 3 def f(): x = X() return x.m() pypy_code = 't\x00\x00\x83\x00\x00}\x00\x00|\x00\x00\x91\x02\x00\x92\x00\x00Sd\x00\x00S' new_c = self.monkey_patch_code(f.func_code, 3, 3, pypy_code, ('X', 'x', 'm'), ('x',)) f2 = new.function(new_c, locals... | flow_meth_names = flowcontext.FlowSpaceFrame.opcode_method_names pyframe_meth_names = PyFrame.opcode_method_names for name in ['CALL_METHOD', 'LOOKUP_METHOD']: num = bytecode_spec.opmap[name] locals()['old_' + name] = flow_meth_names[num] flow_meth_names[num] = pyframe_meth_names[num] try: class X: def m(self): return ... | def test_callmethod_opcode(self): """ Tests code generated by pypy-c compiled with CALL_METHOD bytecode """ py.test.skip("XXX this needs to be fixed, maybe") class X: def m(self): return 3 |
i = 0 | i = 1 | def portal(codeno, j): i = 0 while 1: driver.jit_merge_point(codeno=codeno, i=i, j=j) if i == 1: if j == 0: return portal(2, j - 1) elif i == 3: return i += 1 driver.can_enter_jit(codeno=codeno, i=i, j=j) |
if i == 1: | if (i >> 1) == 1: | def portal(codeno, j): i = 0 while 1: driver.jit_merge_point(codeno=codeno, i=i, j=j) if i == 1: if j == 0: return portal(2, j - 1) elif i == 3: return i += 1 driver.can_enter_jit(codeno=codeno, i=i, j=j) |
elif i == 3: | elif i == 5: | def portal(codeno, j): i = 0 while 1: driver.jit_merge_point(codeno=codeno, i=i, j=j) if i == 1: if j == 0: return portal(2, j - 1) elif i == 3: return i += 1 driver.can_enter_jit(codeno=codeno, i=i, j=j) |
portal(2, 50) | portal(2, 5) | def portal(codeno, j): i = 0 while 1: driver.jit_merge_point(codeno=codeno, i=i, j=j) if i == 1: if j == 0: return portal(2, j - 1) elif i == 3: return i += 1 driver.can_enter_jit(codeno=codeno, i=i, j=j) |
self.meta_interp(portal, [2, 20], inline=True) self.check_loops(call_assembler=1, call_may_force=0, | self.meta_interp(portal, [2, 5], inline=True) self.check_loops(call_assembler=2, call_may_force=0, | def my_ctc(*args): looptoken = original_ctc(*args) trace.append(looptoken) return looptoken |
expected = """ | preamble = """ | def test_duplicate_setfield_4(self): ops = """ [p1, i1, i2, p3] setfield_gc(p1, i1, descr=valuedescr) # # some operations on which the above setfield_gc cannot have effect i3 = getarrayitem_gc_pure(p3, 1, descr=arraydescr) i4 = getarrayitem_gc(p3, i3, descr=arraydescr) i5 = int_add(i3, i4) setarrayitem_gc(p3, 0, i5, de... |
jump(p1, i1, i2, p3) """ self.optimize_loop(ops, 'Not, Not, Not, Not', expected) | jump(p1, i1, i2, p3, i3) """ expected = """ [p1, i1, i2, p3, i3] i4 = getarrayitem_gc(p3, i3, descr=arraydescr) i5 = int_add(i3, i4) setarrayitem_gc(p3, 0, i5, descr=arraydescr) setfield_gc(p1, i2, descr=valuedescr) setfield_gc(p1, i4, descr=nextdescr) jump(p1, i1, i2, p3, i3) """ self.optimize_loop(ops, 'Not, Not, N... | def test_duplicate_setfield_4(self): ops = """ [p1, i1, i2, p3] setfield_gc(p1, i1, descr=valuedescr) # # some operations on which the above setfield_gc cannot have effect i3 = getarrayitem_gc_pure(p3, 1, descr=arraydescr) i4 = getarrayitem_gc(p3, i3, descr=arraydescr) i5 = int_add(i3, i4) setarrayitem_gc(p3, 0, i5, de... |
import py; py.test.skip("Disabled for now, sorry") | def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE, space_size=4096): import py; py.test.skip("Disabled for now, sorry") self.param_space_size = space_size MovingGCBase.__init__(self, config, chunk_size) | |
if self.config.gcconfig.debugprint: self.program_start_time = time.time() | self.program_start_time = time.time() | def setup(self): self.space_size = self.param_space_size self.next_collect_after = self.param_space_size/2 # whatever... |
if self.config.gcconfig.debugprint: llop.debug_print(lltype.Void) llop.debug_print(lltype.Void, ".----------- Full collection ------------------") | if have_debug_prints(): debug_start("gc-collect") debug_print() debug_print(".----------- Full collection ------------------") | def debug_collect_start(self): if self.config.gcconfig.debugprint: llop.debug_print(lltype.Void) llop.debug_print(lltype.Void, ".----------- Full collection ------------------") start_time = time.time() return start_time |
return start_time | return start_time return -1 | def debug_collect_start(self): if self.config.gcconfig.debugprint: llop.debug_print(lltype.Void) llop.debug_print(lltype.Void, ".----------- Full collection ------------------") start_time = time.time() return start_time |
if self.config.gcconfig.debugprint: | if start_time != -1: | def debug_collect_finish(self, start_time): if self.config.gcconfig.debugprint: end_time = time.time() elapsed_time = end_time - start_time self.total_collection_time += elapsed_time self.total_collection_count += 1 total_program_time = end_time - self.program_start_time ct = self.total_collection_time cc = self.total_... |
llop.debug_print(lltype.Void, "| number of collections so far ", cc) llop.debug_print(lltype.Void, "| total collections per second: ", cc / total_program_time) llop.debug_print(lltype.Void, "| total time in markcompact-collect: ", ct, "seconds") llop.debug_print(lltype.Void, "| percentage collection<->total ... | debug_print("| number of collections so far ", cc) debug_print("| total collections per second: ", cc / total_program_time) debug_print("| total time in markcompact-collect: ", ct, "seconds") debug_print("| percentage collection<->total time:", ct * 100.0 / total_program_time, "%") debug_print("`------------... | def debug_collect_finish(self, start_time): if self.config.gcconfig.debugprint: end_time = time.time() elapsed_time = end_time - start_time self.total_collection_time += elapsed_time self.total_collection_count += 1 total_program_time = end_time - self.program_start_time ct = self.total_collection_time cc = self.total_... |
self._emit_call(descr._arm_direct_bootstrap_code, op.getarglist(), regalloc, fcond, resbox) | self._emit_call(descr._arm_direct_bootstrap_code, op.getarglist(), regalloc, fcond, result=resbox) | def emit_guard_call_assembler(self, op, guard_op, regalloc, fcond): faildescr = guard_op.getdescr() fail_index = self.cpu.get_fail_descr_number(faildescr) self._write_fail_index(fail_index, regalloc) |
c = stdoutcapture.Capture(mixed_out_err = True) | def build(self, noerr=False): basename = self.outputfilename.new(ext='') data = '' try: saved_environ = os.environ.copy() try: c = stdoutcapture.Capture(mixed_out_err = True) self._build() finally: # workaround for a distutils bugs where some env vars can # become longer and longer every time it is used for key, value ... | |
counter = 0 | counter = 1 | def splitloops(loops): real_loops = [] counter = 0 for loop in loops: firstline = loop[:loop.find("\n")] counter += loop.count("\n") m = re.match('# Loop (\d+)', firstline) if m: no = int(m.group(1)) assert len(real_loops) == no real_loops.append(FinalBlock(loop, None)) real_loops[-1].startlineno = counter else: m = re... |
counter += loop.count("\n") | def splitloops(loops): real_loops = [] counter = 0 for loop in loops: firstline = loop[:loop.find("\n")] counter += loop.count("\n") m = re.match('# Loop (\d+)', firstline) if m: no = int(m.group(1)) assert len(real_loops) == no real_loops.append(FinalBlock(loop, None)) real_loops[-1].startlineno = counter else: m = re... | |
m = re.search("debug_merge_point\('<code object (.*?)>", loop.content) | m = re.search("debug_merge_point\('<code object (.*?)> (.*?)'", loop.content) | def postprocess_loop(loop, loops, memo): if loop in memo: return memo.add(loop) if loop is None: return m = re.search("debug_merge_point\('<code object (.*?)>", loop.content) if m is None: name = '?' else: name = m.group(1) opsno = loop.content.count("\n") lastline = loop.content[loop.content.rfind("\n", 0, len(loop.co... |
name = m.group(1) | name = m.group(1) + " " + m.group(2) | def postprocess_loop(loop, loops, memo): if loop in memo: return memo.add(loop) if loop is None: return m = re.search("debug_merge_point\('<code object (.*?)>", loop.content) if m is None: name = '?' else: name = m.group(1) opsno = loop.content.count("\n") lastline = loop.content[loop.content.rfind("\n", 0, len(loop.co... |
dll = goal_dir.join('libpypy-c.exe.dll') | dll = goal_dir / 'libpypy-c.dll' | def filenames_from_platform(platform): if platform == 'win32': files = [goal_dir / 'pypy-c.exe'] dll = goal_dir.join('libpypy-c.exe.dll') if dll.check(): files.append(dll) else: files = [goal_dir / 'pypy-c'] for file in files: if not file.check(): print "Necessary file (%s) missing, build pypy" % file sys.exit(1) retur... |
elif arg == '-O': | elif arg == '-O' or arg == '-OO': | def parse_command_line(argv): go_interactive = False run_command = False import_site = True i = 0 run_module = False run_stdin = False warnoptions = [] unbuffered = False while i < len(argv): arg = argv[i] if not arg.startswith('-'): break if arg == '-i': go_interactive = True elif arg.startswith('-c'): cmd, i = get_ar... |
s = py.path.local(__file__).read() | filename = __file__ if filename.lower().endswith('.pyc'): filename = filename[:-1] s = py.path.local(filename).read() | def test_parse_this(self): s = py.path.local(__file__).read() t = self.parse(s) t = self.ToAST.transform(t) |
if prefix and len(name) != len(filename): | if prefix and not prefix.endswith(ZIPSEP): | def descr_new_zipimporter(space, w_type, name): w = space.wrap w_ZipImportError = space.getattr(space.getbuiltinmodule('zipimport'), w('ZipImportError')) ok = False parts_ends = [i for i in range(0, len(name)) if name[i] == os.path.sep or name[i] == ZIPSEP] parts_ends.append(len(name)) filename = "" # make annotator ha... |
rstack.resume_point("CALL_METHOD", f, n_args, returns=w_result) | rstack.resume_point("CALL_METHOD_no_kwargs", f, n_args, returns=w_result) | 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:... |
assert module.from_unsignedlong() == (1<<32) - 1 | import sys if sys.maxint < 1<<32: assert module.from_unsignedlong() == (1<<32) - 1 else: assert module.from_unsignedlong() == (1<<64) - 1 | def test_fromunsignedlong(self): module = self.import_extension('foo', [ ("from_unsignedlong", "METH_NOARGS", """ return PyLong_FromUnsignedLong((unsigned long)-1); """)]) assert module.from_unsignedlong() == (1<<32) - 1 |
assert not pypypolicy.look_inside_function(id__ANY) | assert pypypolicy.look_inside_function(id__ANY) | def test_id_any(): from pypy.objspace.std.default import id__ANY assert not pypypolicy.look_inside_function(id__ANY) |
assert string_to_w_long(space, s).longval() == expected | assert string_to_bigint(s).tolong() == expected | def test_string_to_int(self): space = self.space cases = [('0', 0), ('1', 1), ('9', 9), ('10', 10), ('09', 9), ('0000101', 101), # not octal unless base 0 or 8 ('5123', 5123), (' 0', 0), ('0 ', 0), (' \t \n 32313 \f \v \r \n\r ', 32313), ('+12', 12), ('-5', -5), ('- 5', -5), ('+ 5', 5), (' -123456789 ', ... |
def test_string_to_w_long(self): space = self.space assert string_to_w_long(space, '123L').longval() == 123 assert string_to_w_long(space, '123L ').longval() == 123 raises(ParseStringError, string_to_w_long, space, 'L') raises(ParseStringError, string_to_w_long, space, 'L ') assert string_to_w_long(space, '123L', 4).... | def test_string_to_bigint(self): assert string_to_bigint('123L').tolong() == 123 assert string_to_bigint('123L ').tolong() == 123 raises(ParseStringError, string_to_bigint, 'L') raises(ParseStringError, string_to_bigint, 'L ') assert string_to_bigint('123L', 4).tolong() == 27 assert string_to_bigint('123L', 30).tolon... | def test_string_to_w_long(self): space = self.space assert string_to_w_long(space, '123L').longval() == 123 assert string_to_w_long(space, '123L ').longval() == 123 raises(ParseStringError, string_to_w_long, space, 'L') raises(ParseStringError, string_to_w_long, space, 'L ') assert string_to_w_long(space, '123L', 4).... |
os.write(12312312, "xxx") | os.write(bad_fd, "xxx") | def g(): try: os.write(12312312, "xxx") except OSError: pass return get_errno() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.