from rpython.rtyper.tool import rffi_platform as platform
from rpython.rtyper.lltypesystem import rffi
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.gateway import unwrap_spec
from rpython.rtyper.lltypesystem import lltype
from rpython.rlib.rarithmetic import intmask
from rpython.rlib import rposix, rtime
from rpython.translator.tool.cbuild import ExternalCompilationInfo
import os
from pypy.interpreter.error import wrap_windowserror, wrap_oserror
from rpython.rlib import rthread as thread
else:
from rpython.rlib import rwin32
# rpython does not support that a variable has two incompatible builtins
from rpython.rlib import jit, rgc
from rpython.rlib.buffer import Buffer
from rpython.rlib.objectmodel import keepalive_until_here
from rpython.rlib.rarithmetic import ovfcheck, widen
from rpython.rlib.unroll import unrolling_iterable
from rpython.rtyper.annlowlevel import llstr
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rtyper.lltypesystem.rstr import copy_string_to_raw
if rffi.sizeof(rffi.UINT) == rffi.sizeof(rffi.ULONG):
# 32 bits: UINT can't safely overflow into a C long (rpython int)
#
# "regular" case: it fits in an rpython integer (lltype.Signed)
from pypy.annotation import model as annmodel
from pypy.rpython.error import TyperError
from pypy.rpython.rmodel import Repr, IteratorRepr, IntegerRepr
from pypy.rpython.rstr import AbstractStringRepr, AbstractCharRepr
from pypy.rpython.lltypesystem.lltype import typeOf, Ptr, Void, Signed, Bool
from pypy.rpython.lltypesystem.lltype import nullptr, Char, UniChar, Number
from pypy.rpython import robject
from pypy.rlib.objectmodel import malloc_zero_filled
from pypy.rlib.rarithmetic import ovfcheck, widen, r_uint, intmask
from pypy.rpython.annlowlevel import ADTInterface
def _get_v_maxlength(self, hop):
from pypy.rpython.rint import signed_repr
#
# The maximal length of RPython lists is bounded by the assumption that
ll_assert(count == stop - start,
"setslice cannot resize lists in RPython")
from pypy.rpython.error import TyperError
from pypy.rpython.rmodel import Repr, getgcflavor, inputconst
from pypy.rpython.lltypesystem.lltype import Void
assert gcflavor == 'gc'
from pypy.rpython.lltypesystem import rtagged
def check_graph_of_del_does_not_call_too_much(self, graph):
# RPython-level __del__() methods should not do "too much".
# Here, as a quick way to check "not doing too much", we check
# that from no RPython-level __del__() method we can reach a
lst.append('')
raise TyperError("the RPython-level __del__() method "
else:
from pypy.rpython.lltypesystem import lltype
def fishllattr(inst, name, default=_missing):
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.ootypesystem import ootype
from pypy.annotation import description
from pypy.rpython.error import TyperError
from pypy.rpython.rmodel import Repr, getgcflavor, inputconst
from pypy.rpython.lltypesystem.lltype import Void
assert gcflavor == 'gc'
from pypy.rpython.lltypesystem import rtagged
def check_graph_of_del_does_not_call_too_much(self, graph):
# RPython-level __del__() methods should not do "too much".
# Here, as a quick way to check "not doing too much", we check
# that from no RPython-level __del__() method we can reach a
lst.append('')
raise TyperError("the RPython-level __del__() method "
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.ootypesystem import ootype
if isinstance(inst, (ootype._instance, ootype._view)):
from rpython.rlib import debug, jit, rerased
from rpython.rlib.listsort import make_timsort_class
from rpython.rlib.objectmodel import (
import_from_mixin, instantiate, newlist_hint, resizelist_hint, specialize)
from rpython.rlib import longlong2float
from rpython.tool.sourcetools import func_with_new_name
"""EmptyListStrategy is used when a W_List withouth elements is created.
The storage is None. When items are added to the W_List a new RPython list
r = l[index]
except IndexError: # make RPython raise the exception
l = self.unerase(w_list.lstorage)
# not sure if RPython raises IndexError on pop
def _safe_find(self, w_list, obj, start, stop):
from rpython.rlib.rfloat import isnan
import py
from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.backend.x86.test.test_basic import Jit386Mixin
from rpython.jit.metainterp.warmspot import reset_jit, get_stats
from rpython.jit.metainterp.jitprof import Profiler
from rpython.jit.metainterp import counter
from rpython.rlib.jit import Counters
from rpython.rlib.rarithmetic import intmask
from pypy.module.micronumpy import boxes
from pypy.module.micronumpy.base import W_NDimArray
from rpython.jit.backend.detect_cpu import getcpuclass
def get_profiler():
from rpython.jit.metainterp import pyjitpl
from rpython.rlib import rposix
from rpython.rlib.rarithmetic import intmask
from rpython.rlib import rlocale
from pypy.module.exceptions.interp_exceptions import _new_exception, W_Exception
from rpython.rtyper.lltypesystem import lltype, rffi
# note that 'result' may be the same pointer as 'msg_c',
# so it must be converted to an RPython string *before*
# note that 'result' may be the same pointer as 'msg_c',
# so it must be converted to an RPython string *before*
# note that 'result' may be the same pointer as 'msg_c',
# so it must be converted to an RPython string *before*
# note that 'result' may be the same pointer as 'domain_c'
# (maybe?) so it must be converted to an RPython string
from __future__ import with_statement
from rpython.rtyper.tool import rffi_platform as platform
from rpython.rtyper.lltypesystem import rffi
from rpython.rtyper.lltypesystem import lltype
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.gateway import interp2app, unwrap_spec
from rpython.rlib.streamio import Stream
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator.platform import platform as compiler
from rpython.rlib.rarithmetic import intmask, r_longlong
import sys
compresslevel=9):
from rpython.rlib.streamio import decode_mode, open_path_helper
from rpython.rlib.streamio import construct_stream_tower
os_flags, universal, reading, writing, basemode, binary = decode_mode(mode)
import os
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.extfunc import ExtRegistryEntry
from pypy.rlib.objectmodel import Symbolic, ComputedIntSymbolic
from pypy.annotation import model as annmodel
from pypy.rpython.llinterp import LLInterpreter, LLException
from pypy.rpython.lltypesystem.rclass import OBJECT, OBJECT_VTABLE
from pypy.rpython import raddress
from pypy.translator.platform import platform
raise Exception("invalid free() - data already freed or "
"not allocated from RPython at all")
else:
from pypy.rpython.lltypesystem import rffi
# get_ctypes_type() can raise NotImplementedError too
from pypy.rpython.lltypesystem import rffi
from pypy.rpython.memory.gctransform.framework import FrameworkGCTransformer
from pypy.rpython.memory.gctransform.framework import BaseRootWalker
from pypy.rpython.lltypesystem import lltype, llmemory, rffi
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.rbuiltin import gen_cast
from pypy.rpython.annlowlevel import llhelper
from pypy.objspace.flow.model import Constant, Variable, Block, Link, copygraph
from pypy.module.thread import ll_thread
from pypy.rpython.memory.support import AddressDict
from pypy.rpython.memory.support import copy_without_null_values
from pypy.annotation import model as annmodel
# assembler, fills information about the current stack top in an
# ASM_FRAMEDATA array and invokes an RPython callback with it.
from pypy.objspace.flow.model import c_last_exception, copygraph
from pypy.rpython.lltypesystem.lltype import Ptr, PyObject, Void, Bool, Signed
from pypy.rpython.lltypesystem.lltype import Unsigned, SignedLongLong, Float
from pypy.rpython.lltypesystem.lltype import UnsignedLongLong, Char, UniChar
from pypy.rpython.lltypesystem.lltype import pyobjectptr, ContainerType
from pypy.rpython.lltypesystem.lltype import Struct, Array, FixedSizeArray
from pypy.rpython.lltypesystem.lltype import ForwardReference, FuncType
from pypy.rpython.lltypesystem.llmemory import Address
from pypy.translator.backendopt.ssa import SSI_to_SSA
# XXX
from pypy.rpython.lltypesystem.rstr import STR
# XXX
from pypy.rpython.lltypesystem.rstr import STR
from rpython.config.config import (OptionDescription, BoolOption, IntOption,
ChoiceOption, StrOption, to_optparse)
from rpython.config.translationoption import IS_64_BITS
from rpython.jit.backend import detect_cpu
# or CompilationError or py.test.skip.Exception
"_rawffi" : ["rpython.rlib.clibffi"],
"zlib" : ["rpython.rlib.rzlib"],
"_minimal_curses": ["pypy.module._minimal_curses.fficurses"],
"_continuation": ["rpython.rlib.rstacklet"],
def validator(config):
from rpython.rtyper.tool.rffi_platform import CompilationError
def get_pypy_config(overrides=None, translating=False):
from rpython.config.translationoption import get_combined_translation_config
from pypy.tool.pairtype import pairtype
from pypy.rpython.extregistry import ExtRegistryEntry
from pypy.rpython.rclass import getinstancerepr
from pypy.rpython.rmodel import Repr
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.lltypesystem.rclass import OBJECTPTR
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.error import TyperError
def ll_unerase_int(gcref):
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.ootypesystem import ootype
import sys
from pypy.rpython import extregistry
def widen(n):
from pypy.rpython.lltypesystem import lltype
def ovfcheck(r):
"NOT_RPYTHON"
def most_neg_value_of_same_type(x):
from pypy.rpython.lltypesystem import lltype
def most_neg_value_of(tp):
from pypy.rpython.lltypesystem import lltype, rffi
This is a single-precision floating-point number.
Regular 'float' values in Python and RPython are double-precision.
from pypy.rpython.lltypesystem import lltype
from pypy.rpython.lltypesystem.lloperation import llop
if not objectmodel.we_are_translated():
from pypy.tool.pairtype import pairtype
from pypy.rpython.extregistry import ExtRegistryEntry
from pypy.rpython.rclass import getinstancerepr
from pypy.rpython.rmodel import Repr
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.lltypesystem.rclass import OBJECTPTR
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.error import TyperError
from pypy.rlib.rarithmetic import is_valid_int
def ll_unerase_int(gcref):
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.ootypesystem import ootype
from rpython.rlib import jit
from rpython.rlib.rarithmetic import INT_MAX
from rpython.rlib.rfloat import DTSF_ALT, formatd, isnan, isinf
from rpython.rlib.rstring import StringBuilder, UnicodeBuilder
from rpython.rlib.unroll import unrolling_iterable
from rpython.tool.sourcetools import func_with_new_name
# to build two subclasses of the BaseStringFormatter class,
# each one getting its own subtle differences and RPython types.
# do the padding requested by self.width and the flags,
# without building yet another RPython string but directly
In order to have the same behavior running on CPython, and after RPython
from rpython.rlib import jit
from rpython.rlib.objectmodel import instantiate
from rpython.rlib.rarithmetic import (
LONG_BIT, is_valid_int, ovfcheck, r_longlong, r_uint, string_to_int)
from rpython.rlib.rbigint import rbigint
from rpython.rlib.rfloat import DBL_MANT_DIG
from rpython.rlib.rstring import (
ParseStringError, ParseStringOverflowError)
from rpython.tool.sourcetools import func_renamer, func_with_new_name
from rpython.rlib import rpoll, rsocket, rthread, rweakref, rgc
from rpython.rlib.rarithmetic import intmask, widen, r_uint
from rpython.rlib.ropenssl import *
from pypy.module._socket import interp_socket
from rpython.rlib._rsocket_rffi import MAX_FD_SIZE
from rpython.rlib.rposix import get_saved_errno
from rpython.rlib.rweakref import RWeakValueDictionary
from rpython.rlib.objectmodel import specialize, compute_unique_id
from rpython.rtyper.lltypesystem import lltype, rffi
from pypy.tool.pairtype import pairtype
from pypy.rpython.rmodel import inputconst
from pypy.rpython.robject import PyObjRepr, pyobj_repr
from pypy.rpython.rtuple import AbstractTupleRepr, AbstractTupleIteratorRepr
from pypy.rpython.lltypesystem.lltype import \
Ptr, GcStruct, Void, Signed, malloc, typeOf, nullptr
from pypy.rpython.lltypesystem.rtupletype import TUPLE_TYPE
from pypy.rpython.lltypesystem import rstr
#
# Concrete implementation of RPython tuples:
def rtype_bltn_list(self, hop):
from pypy.rpython.lltypesystem import rlist