bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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)
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)
452,700
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)
def test_remove_guard_class_1(self): ops = """ [p0] guard_class(p0, ConstClass(node_vtable)) [] guard_class(p0, ConstClass(node_vtable)) [] jump(p0) """ preamble = """ [p0] guard_class(p0, ConstClass(node_vtable)) [] jump(p0) """ self.optimize_loop(ops, 'Not', expected)
452,701
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)
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)
452,702
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...
def test_bound_eq(self): ops = """ [] i0 = escape() i1 = escape() 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 = escape() i1 = escape() i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] jump...
452,703
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...
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() """ expected = """ [] i0 = escape() i1 = escape() i2 = int_le(i0, 4) guard_true(i2) [] i3 = int_eq(i0, i1) guard_true(i3) [] jump(i0, i1) """ self.optimize_l...
452,704
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...
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...
452,705
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)
def test_bound_eq_const(self): ops = """ [] i0 = escape() i1 = int_eq(i0, 7) guard_true(i1) [] i2 = int_add(i0, 3) jump(i2) """ expected = """ [] i0 = escape() i1 = int_eq(i0, 7) guard_true(i1) [] jump(10)
452,706
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)
def test_bound_eq_const(self): ops = """ [i0] i1 = int_eq(i0, 7) guard_true(i1) [] i2 = int_add(i0, 3) escape(i2) jump() """ expected = """ [] i0 = escape() i1 = int_eq(i0, 7) guard_true(i1) [] jump(10)
452,707
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)
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)
452,708
def main(n): s = 0 for i in range(n): s += g(n)[i] return s
def main(n): s = 0 for i in range(n): s += g(n)[i] return s
452,709
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)
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)
452,710
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('>'...
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 r'pypy\\lib\\_pypy_interact.py' in r.lower()) and r.endswith('>...
452,711
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...
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...
452,712
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,713
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,714
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
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
452,715
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
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
452,716
def setUp(self): self.cbcalled = 0
def setUp(self): self.cbcalled = 0
452,717
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()
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()
452,718
def test_main(): test_support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, SubclassableWeakrefTestCase, ) test_support.run_doctest(sys.modules[__name__])
def test_main(): test_support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, SubclassableWeakrefTestCase, ) test_support.run_doctest(sys.modules[__name__])
452,719
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...
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...
452,720
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...
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) s1_c = rffi.str2charp(s1) s2_c = rffi.str2charp(s2) try: r...
452,721
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...
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...
452,722
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...
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) s_c = rffi.str2charp(s) try: n2 = _strxfrm(buf, s_c, n1) + 1 finally: rffi.free_charp(s_c) if n2 > n1: # more space needed lltype.free(buf, fla...
452,723
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...
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...
452,724
def gettext(space, msg): """gettext(msg) -> string Return translation of msg.""" return space.wrap(rffi.charp2str(_gettext(rffi.str2charp(msg))))
def gettext(space, msg): """gettext(msg) -> string Return translation of msg.""" return space.wrap(rffi.charp2str(_gettext(rffi.str2charp(msg))))
452,725
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))
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 msg_c = rffi.str2charp(msg) try: result = _dgettext(domain, msg_c) finally: rffi.free_charp(msg_c) else: domain = space.str_w(w_domain) result = _dgettext(r...
452,726
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))
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))
452,727
def dcgettext(space, w_domain, msg, category): """dcgettext(domain, msg, category) -> string Return translation of msg in domain and category."""
def dcgettext(space, w_domain, msg, category): """dcgettext(domain, msg, category) -> string Return translation of msg in domain and category."""
452,728
def dcgettext(space, w_domain, msg, category): """dcgettext(domain, msg, category) -> string Return translation of msg in domain and category."""
def dcgettext(space, w_domain, msg, category): """dcgettext(domain, msg, category) -> string Return translation of msg in domain and category."""
452,729
def textdomain(space, w_domain): """textdomain(domain) -> string Set the C library's textdomain to domain, returning the new domain."""
def textdomain(space, w_domain): """textdomain(domain) -> string Set the C library's textdomain to domain, returning the new domain."""
452,730
def bindtextdomain(space, domain, w_dir): """bindtextdomain(domain, dir) -> string Bind the C library's domain to dir."""
def bindtextdomain(space, domain, w_dir): """bindtextdomain(domain, dir) -> string Bind the C library's domain to dir."""
452,731
def bindtextdomain(space, domain, w_dir): """bindtextdomain(domain, dir) -> string Bind the C library's domain to dir."""
def bindtextdomain(space, domain, w_dir): """bindtextdomain(domain, dir) -> string Bind the C library's domain to dir."""
452,732
def bind_textdomain_codeset(space, domain, w_codeset): """bind_textdomain_codeset(domain, codeset) -> string Bind the C library's domain to codeset."""
def bind_textdomain_codeset(space, domain, w_codeset): """bind_textdomain_codeset(domain, codeset) -> string Bind the C library's domain to codeset."""
452,733
def bind_textdomain_codeset(space, domain, w_codeset): """bind_textdomain_codeset(domain, codeset) -> string Bind the C library's domain to codeset."""
def bind_textdomain_codeset(space, domain, w_codeset): """bind_textdomain_codeset(domain, codeset) -> string Bind the C library's domain to codeset."""
452,734
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...
def test_exc(formatstr, args, exception, excmsg): try: testformat(formatstr, args) except exception, exc: if excmsg is None or 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 el...
452,735
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...
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...
452,736
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...
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 = [intmask(space.uint_w(space.getitem(w_code, space.wrap(i)))) for i in range(n)] # w_srepat = space.allocate_instance(W_SRE_Pattern, w_subtype) srepat = space.inte...
452,737
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_...
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_...
452,738
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
def test_array_sum(self): for tc, maxops in zip('bhilBHILfd', (38,) * 6 + (40, 40, 41, 38)): res = 19352859 if tc == 'L': res = long(res) elif tc in 'fd': res = float(res) self.run_source(''' from array import array
452,739
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
defelif tc == 'I' and sys.maxint == 2147483647: res = long(res) test_array_sum(self):elif tc == 'I' and sys.maxint == 2147483647: res = long(res) forelif tc == 'I' and sys.maxint == 2147483647: res = long(res) tc,elif tc == 'I' and sys.maxint == 2147483647: res = long(res) maxopselif tc == 'I' and sys.maxint ==...
452,740
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...
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 == 'L': res = long(res) eli...
452,741
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...
defelif tc == 'I' and sys.maxint == 2147483647: res = long(res) test_array_intimg(self):elif tc == 'I' and sys.maxint == 2147483647: res = long(res) #elif tc == 'I' and sys.maxint == 2147483647: res = long(res) XXXelif tc == 'I' and sys.maxint == 2147483647: res = long(res) thiselif tc == 'I' and sys.maxint == ...
452,742
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 _...
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 _...
452,743
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 _...
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 _...
452,744
def emit_op_int_add(self, op, regalloc, fcond): # assuming only one argument is constant a0 = op.getarg(0) a1 = op.getarg(1) imm_a0 = isinstance(a0, ConstInt) and (a0.getint() <= 0xFF or -1 * a0.getint() <= 0xFF) imm_a1 = isinstance(a1, ConstInt) and (a1.getint() <= 0xFF or -1 * a1.getint() <= 0xFF) if imm_a0: imm_a0, ...
defemit_op_int_add(self,op,regalloc,fcond):#assumingonlyoneargumentisconstanta0=op.getarg(0)a1=op.getarg(1)imm_a0=isinstance(a0,ConstInt)and(a0.getint()<=0xFFor-1*a0.getint()<=0xFF)imm_a1=isinstance(a1,ConstInt)and(a1.getint()<=0xFFor-1*a1.getint()<=0xFF)ifimm_a0:imm_a0,imm_a1=imm_a1,imm_a0a0,a1=a1,a0ifimm_a1:l0=regall...
452,745
def emit_op_int_neg(self, op, regalloc, fcond): arg = op.getarg(0) l0 = regalloc.make_sure_var_in_reg(arg, imm_fine=False) l1 = regalloc.make_sure_var_in_reg(ConstInt(-1), [arg], imm_fine=False) res = regalloc.force_allocate_reg(op.result, [arg]) self.mc.MUL(res.value, l0.value, l1.value) regalloc.possibly_free_vars([l...
def emit_op_int_neg(self, op, regalloc, fcond): arg = op.getarg(0) l0 = regalloc.make_sure_var_in_reg(arg, imm_fine=False) l1 = regalloc.make_sure_var_in_reg(ConstInt(-1), [arg], imm_fine=False) res = regalloc.force_allocate_reg(op.result, [arg]) self.mc.MUL(res.value, l0.value, l1.value) regalloc.possibly_free_vars([l...
452,746
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...
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_ri(l0.value, l1.getint()) else: self.mc.CMP_rr(l0.value, l1.value) regalloc.possibly_free_vars_for_op(op) retu...
452,747
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...
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...
452,748
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...
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...
452,749
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))
def setup_class(cls): space = gettestobjspace(usemodules=('_stackless','_socket')) cls.space = space # cannot test the unpickle part on top of py.py cls.w_can_unpickle = space.wrap(bool(option.runappdirect))
452,750
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
def PyType_Ready(space, pto): if pto.c_tp_flags & Py_TPFLAGS_READY: return 0 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 0
452,751
def write_w(self, space, w_data): self._check_closed(space, "write to closed file") data = space.str_w(w_data) size = len(data)
def write_w(self, space, w_data): self._check_closed(space, "write to closed file") data = space.str_w(w_data) size = len(data)
452,752
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_...
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_...
452,753
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
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
452,754
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
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') pendian[0] = rffi.cast(rffi.INT, value) else: pendian = None
452,755
def time_time_llimpl(): void = lltype.nullptr(rffi.VOIDP.TO) result = -1.0 if self.HAVE_GETTIMEOFDAY: t = lltype.malloc(self.TIMEVAL, flavor='raw')
def time_time_llimpl(): void = lltype.nullptr(rffi.VOIDP.TO) result = -1.0 if self.HAVE_GETTIMEOFDAY: t = lltype.malloc(self.TIMEVAL, flavor='raw')
452,756
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...
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)], 'void', ...
452,757
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...
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...
452,758
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))
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))
452,759
def test_malloc_nonmovable_fixsize(self): py.test.skip("not supported")
def test_malloc_nonmovable_fixsize(self): py.test.skip("not supported")
452,760
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
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
452,761
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)
def portal(codeno, j): i = 1 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)
452,762
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)
def portal(codeno, j): i = 0 while 1: driver.jit_merge_point(codeno=codeno, i=i, j=j) if (i >> 1) == 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)
452,763
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)
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 == 5: return i += 1 driver.can_enter_jit(codeno=codeno, i=i, j=j)
452,764
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)
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)
452,765
def my_ctc(*args): looptoken = original_ctc(*args) trace.append(looptoken) return looptoken
def my_ctc(*args): looptoken = original_ctc(*args) trace.append(looptoken) return looptoken
452,766
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...
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...
452,767
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...
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...
452,768
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)
def __init__(self, config, chunk_size=DEFAULT_CHUNK_SIZE, space_size=4096): self.param_space_size = space_size MovingGCBase.__init__(self, config, chunk_size)
452,769
def setup(self): self.space_size = self.param_space_size self.next_collect_after = self.param_space_size/2 # whatever...
def setup(self): self.space_size = self.param_space_size self.next_collect_after = self.param_space_size/2 # whatever...
452,770
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
def debug_collect_start(self): if have_debug_prints(): debug_start("gc-collect") debug_print() debug_print(".----------- Full collection ------------------") start_time = time.time() return start_time
452,771
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
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
452,772
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_...
def debug_collect_finish(self, start_time): if start_time != -1: 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_collection_coun...
452,773
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_...
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_...
452,774
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)
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)
452,775
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 ...
def build(self, noerr=False): basename = self.outputfilename.new(ext='') data = '' try: saved_environ = os.environ.copy() try: 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 in saved_environ.items(): if os.environ.get(key)...
452,776
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...
def splitloops(loops): real_loops = [] counter = 1 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...
452,777
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...
def splitloops(loops): real_loops = [] counter = 0 for loop in loops: firstline = loop[:loop.find("\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.search("bridge out of Guard...
452,778
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...
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(...
452,779
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...
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) + " " + m.group(2) opsno = loop.content.count("\n") lastline = loop.content[loop.content.rfind("...
452,780
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...
def filenames_from_platform(platform): if platform == 'win32': files = [goal_dir / 'pypy-c.exe'] dll = goal_dir / 'libpypy-c.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) return files
452,781
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...
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...
452,782
def test_parse_this(self): s = py.path.local(__file__).read() t = self.parse(s) t = self.ToAST.transform(t)
def test_parse_this(self): filename = __file__ if filename.lower().endswith('.pyc'): filename = filename[:-1] s = py.path.local(filename).read() t = self.parse(s) t = self.ToAST.transform(t)
452,783
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...
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...
452,784
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,785
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,786
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
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
452,787
def test_id_any(): from pypy.objspace.std.default import id__ANY assert not pypypolicy.look_inside_function(id__ANY)
def test_id_any(): from pypy.objspace.std.default import id__ANY assert pypypolicy.look_inside_function(id__ANY)
452,788
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_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 ', ...
452,789
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_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)....
452,790
def g(): try: os.write(12312312, "xxx") except OSError: pass return get_errno()
def g(): try: os.write(bad_fd, "xxx") except OSError: pass return get_errno()
452,791
def test_format_percent(self): assert 'a%b' == 'a%%b' % {}
def test_format_percent(self): assert 'a%b' == 'a%%b' % {}
452,792
def test_format_error(self): assert '' % {} == '' raises(TypeError, "'' % 5") class MyMapping(object): def __getitem__(self, key): py.test.fail('should not be here') assert '' % MyMapping() == '' class MyMapping2(object): def __getitem__(self, key): return key assert '%(key)s'%MyMapping2() == 'key' assert u'%(key)s'%My...
def test_format_error(self): d = {} assert '' % d == '' n = 5 raises(TypeError, "'' % n") class MyMapping(object): def __getitem__(self, key): py.test.fail('should not be here') assert '' % MyMapping() == '' class MyMapping2(object): def __getitem__(self, key): return key assert '%(key)s'%MyMapping2() == 'key' assert u...
452,793
def test_format_item(self): assert 'a23b' == 'a%sb' % 23 assert '23b' == '%sb' % 23 assert 'a23' == 'a%s' % 23 assert '23' == '%s' % 23
def test_format_item(self): assert 'a23b' == 'a%sb' % 23 assert '23b' == '%sb' % 23 assert 'a23' == 'a%s' % 23 assert '23' == '%s' % 23
452,794
def test_format_percent(self): assert 'a%b' == 'a%%b' % () assert '%b' == '%%b' % () assert 'a%' == 'a%%' % () assert '%' == '%%' % ()
def test_format_percent(self): assert 'a%b' == 'a%%b' % () assert '%b' == '%%b' % () assert 'a%' == 'a%%' % () assert '%' == '%%' % ()
452,795
def test_format_string(self): assert '23' == '%s' % '23' assert "'23'" == '%r' % '23' raises(TypeError, '%d'.__mod__, "23")
def test_format_string(self): assert '23' == '%s' % '23' assert "'23'" == '%r' % '23' raises(TypeError, '%d'.__mod__, "23")
452,796
def test_format_float(self): assert '23' == '%d' % 23.456 assert '17' == '%x' % 23.456 assert '23.456' == '%s' % 23.456 # for 'r' use a float that has an exact decimal rep: assert '23.125' == '%r' % 23.125 assert '0.028' == '%.3f' % 0.0276 # should work on most platforms... assert ' inf' == '%6g' % (1E200 * 1E200)
def test_format_float(self): f = 23.456 assert '23' == '%d' % f assert '17' == '%x' % f assert '23.456' == '%s' % f # for 'r' use a float that has an exact decimal rep: assert '23.125' == '%r' % 23.125 assert '0.028' == '%.3f' % 0.0276 # should work on most platforms... assert ' inf' == '%6g' % (1E200 * 1E200)
452,797
def test_format_float(self): assert '23' == '%d' % 23.456 assert '17' == '%x' % 23.456 assert '23.456' == '%s' % 23.456 # for 'r' use a float that has an exact decimal rep: assert '23.125' == '%r' % 23.125 assert '0.028' == '%.3f' % 0.0276 # should work on most platforms... assert ' inf' == '%6g' % (1E200 * 1E200)
def test_format_float(self): assert '23' == '%d' % 23.456 assert '17' == '%x' % 23.456 assert '23.456' == '%s' % 23.456 # for 'r' use a float that has an exact decimal rep: assert '23.125' == '%r' % 23.125 assert '0.028' == '%.3f' % 0.0276 # should work on most platforms... assert ' inf' == '%6g' % (1E200 * 1E200)
452,798
def test_format_int(self): import sys assert '23' == '%d' % 23 assert '17' == '%x' % 23 assert '0x17' == '%#x' % 23 assert '0x0' == '%#x' % 0 assert '23' == '%s' % 23 assert '23' == '%r' % 23 assert ('%d' % (-sys.maxint-1,) == '-' + str(sys.maxint+1) == '-%d' % (sys.maxint+1,)) assert '1C' == '%X' % 28 assert '0X1C' ==...
def test_format_int(self): import sys assert '23' == '%d' % 23 assert '17' == '%x' % 23 assert '0x17' == '%#x' % 23 assert '0x0' == '%#x' % 0 assert '23' == '%s' % 23 assert '23' == '%r' % 23 assert ('%d' % (-sys.maxint-1,) == '-' + str(sys.maxint+1) == '-%d' % (sys.maxint+1,)) assert '1C' == '%X' % 28 assert '0X1C' ==...
452,799