本文整理汇总了Python中pypy.rlib.debug.make_sure_not_resized函数的典型用法代码示例。如果您正苦于以下问题:Python make_sure_not_resized函数的具体用法?Python make_sure_not_resized怎么用?Python make_sure_not_resized使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_sure_not_resized函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pushrevvalues
def pushrevvalues(self, n, values_w): # n should be len(values_w)
make_sure_not_resized(values_w)
while True:
n -= 1
if n < 0:
break
self.pushvalue(values_w[n])
示例2: overwrite
def overwrite(self, pos, listofchars):
make_sure_not_resized(listofchars)
assert pos + len(listofchars) <= self._size
for c in listofchars:
self._data[pos] = c
pos += 1
return pos
示例3: packimm32
def packimm32(i):
lst = [chr(i & 0xFF),
chr((i >> 8) & 0xFF),
chr((i >> 16) & 0xFF),
chr((i >> 24) & 0xFF)]
make_sure_not_resized(lst)
return lst
示例4: __init__
def __init__(self, space, code, w_globals, outer_func):
if not we_are_translated():
assert type(self) in (space.FrameClass, CPythonFrame), (
"use space.FrameClass(), not directly PyFrame()")
self = hint(self, access_directly=True, fresh_virtualizable=True)
assert isinstance(code, pycode.PyCode)
self.pycode = code
eval.Frame.__init__(self, space, w_globals)
self.locals_stack_w = [None] * (code.co_nlocals + code.co_stacksize)
# Symbolic stack, globals tracker and constraint stack
self.locals_stack_w_s = [None] * (code.co_nlocals + code.co_stacksize)
self.w_globals_s = w_globals
self.valuestackdepth = code.co_nlocals
self.lastblock = None
make_sure_not_resized(self.locals_stack_w)
check_nonneg(self.valuestackdepth)
#
if space.config.objspace.honor__builtins__:
self.builtin = space.builtin.pick_builtin(w_globals)
# regular functions always have CO_OPTIMIZED and CO_NEWLOCALS.
# class bodies only have CO_NEWLOCALS.
self.initialize_frame_scopes(outer_func, code)
self.f_lineno = code.co_firstlineno
示例5: __init__
def __init__(self, opnum, args, result, descr=None):
make_sure_not_resized(args)
assert isinstance(opnum, int)
self.opnum = opnum
self.args = list(args)
make_sure_not_resized(self.args)
assert not isinstance(result, list)
self.result = result
self.setdescr(descr)
示例6: __init__
def __init__(self, space, dim, dtype):
self.dim = dim
self.space = space
# ignore dtype for now
size = 1
for el in dim:
size *= el
self.storage = [0] * size
make_sure_not_resized(self.storage)
示例7: __init__
def __init__(self, space, args_w, kwds_w=None,
w_stararg=None, w_starstararg=None):
self.space = space
assert isinstance(args_w, list)
self.arguments_w = args_w
from pypy.rlib.debug import make_sure_not_resized
make_sure_not_resized(self.arguments_w)
self.kwds_w = kwds_w
self.w_stararg = w_stararg
self.w_starstararg = w_starstararg
示例8: __init__
def __init__(self, space, code, w_globals=None, defs_w=[], closure=None, forcename=None):
self.space = space
self.name = forcename or code.co_name
self.w_doc = None # lazily read from code.getdocstring()
self.code = code # Code instance
self.w_func_globals = w_globals # the globals dictionary
self.closure = closure # normally, list of Cell instances or None
self.defs_w = defs_w # list of w_default's
make_sure_not_resized(self.defs_w)
self.w_func_dict = None # filled out below if needed
self.w_module = None
示例9: args_hash
def args_hash(args):
make_sure_not_resized(args)
res = 0x345678
for arg in args:
if arg is None:
y = 17
elif isinstance(arg, history.Const):
y = arg._get_hash_()
else:
y = compute_identity_hash(arg)
res = intmask((1000003 * res) ^ y)
return res
示例10: __init__
def __init__(self, space, code, w_globals, closure):
self = hint(self, access_directly=True, fresh_virtualizable=True)
assert isinstance(code, pycode.PyCode)
self.pycode = code
eval.Frame.__init__(self, space, w_globals, code.co_nlocals)
self.valuestack_w = [None] * code.co_stacksize
self.valuestackdepth = 0
self.lastblock = None
if space.config.objspace.honor__builtins__:
self.builtin = space.builtin.pick_builtin(w_globals)
# regular functions always have CO_OPTIMIZED and CO_NEWLOCALS.
# class bodies only have CO_NEWLOCALS.
self.initialize_frame_scopes(closure, code)
self.fastlocals_w = [None] * self.numlocals
make_sure_not_resized(self.fastlocals_w)
self.f_lineno = code.co_firstlineno
示例11: args_eq
def args_eq(args1, args2):
make_sure_not_resized(args1)
make_sure_not_resized(args2)
if len(args1) != len(args2):
return False
for i in range(len(args1)):
arg1 = args1[i]
arg2 = args2[i]
if isinstance(arg1, history.Const):
if arg1.__class__ is not arg2.__class__:
return False
if not arg1.same_constant(arg2):
return False
else:
if not arg1 is arg2:
return False
return True
示例12: __init__
def __init__(self, parent, func, pc, max_stack_size, nargs, bc_off, closure):
self = jit.hint(self, access_directly=True, fresh_virtualizable=True)
self.parent = parent
self.stack = [None] * max_stack_size
debug.make_sure_not_resized(self.stack)
self.func = func
self.pc = pc
self.nargs = nargs # Number of arguments passed to this continuation
self.bc_off = bc_off # -1 for Py modules
self.closure = closure
self.returned = False
# stackpe always points to the element *after* the end of the stack (this makes a lot of
# stack-based operations quicker)
self.stackpe = 0
# ffp, gfp, and xfp all point *to* the frame they refer to
self.ffp = self.gfp = self.xfp = -1
示例13: fixedview
def fixedview(self, w_obj, expected_length=-1, unroll=False):
""" Fast paths
"""
if isinstance(w_obj, W_AbstractTupleObject):
t = w_obj.tolist()
elif type(w_obj) is W_ListObject:
if unroll:
t = w_obj.getitems_unroll()
else:
t = w_obj.getitems_fixedsize()
else:
if unroll:
return make_sure_not_resized(ObjSpace.unpackiterable_unroll(
self, w_obj, expected_length))
else:
return make_sure_not_resized(ObjSpace.unpackiterable(
self, w_obj, expected_length)[:])
if expected_length != -1 and len(t) != expected_length:
raise self._wrap_expected_length(expected_length, len(t))
return make_sure_not_resized(t)
示例14: __init__
def __init__(self, space, args_w, keywords=None, keywords_w=None,
w_stararg=None, w_starstararg=None):
self.space = space
assert isinstance(args_w, list)
self.arguments_w = args_w
self.keywords = keywords
self.keywords_w = keywords_w
if keywords is not None:
assert keywords_w is not None
assert len(keywords_w) == len(keywords)
make_sure_not_resized(self.keywords)
make_sure_not_resized(self.keywords_w)
make_sure_not_resized(self.arguments_w)
if w_stararg is not None or w_starstararg is not None:
self._combine_wrapped(w_stararg, w_starstararg)
示例15: __init__
def __init__(self, space, args_w, keywords=None, keywords_w=None,
w_stararg=None, w_starstararg=None):
self.space = space
assert isinstance(args_w, list)
self.arguments_w = args_w
self.keywords = keywords
self.keywords_w = keywords_w
if keywords is not None:
assert keywords_w is not None
assert len(keywords_w) == len(keywords)
make_sure_not_resized(self.keywords)
make_sure_not_resized(self.keywords_w)
make_sure_not_resized(self.arguments_w)
if w_stararg is not None or w_starstararg is not None:
self._combine_wrapped(w_stararg, w_starstararg)
# if we have a call where * or ** args are used at the callsite
# we shouldn't let the JIT see the argument matching
self._dont_jit = True
else:
self._dont_jit = False