[pypy-commit] pypy default: (alex, fijal) fix importing and remove more annenforceargs
alex_gaynor
noreply at buildbot.pypy.org
Fri Mar 22 06:15:46 CET 2013
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r62641:af66d7a58e17
Date: 2013-03-21 22:15 -0700
http://bitbucket.org/pypy/pypy/changeset/af66d7a58e17/
Log: (alex, fijal) fix importing and remove more annenforceargs
diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
--- a/rpython/annotator/model.py
+++ b/rpython/annotator/model.py
@@ -530,7 +530,6 @@
# annotation of low-level types
from rpython.rtyper.lltypesystem import lltype
-from rpython.rtyper.ootypesystem import ootype
class SomePtr(SomeObject):
knowntype = lltype._ptr
@@ -556,27 +555,35 @@
def can_be_none(self):
return False
+
class SomeOOObject(SomeObject):
def __init__(self):
+ from rpython.rtyper.ootypesystem import ootype
self.ootype = ootype.Object
+
class SomeOOClass(SomeObject):
def __init__(self, ootype):
self.ootype = ootype
+
class SomeOOInstance(SomeObject):
def __init__(self, ootype, can_be_None=False):
self.ootype = ootype
self.can_be_None = can_be_None
+
class SomeOOBoundMeth(SomeObject):
immutable = True
+
def __init__(self, ootype, name):
self.ootype = ootype
self.name = name
+
class SomeOOStaticMeth(SomeObject):
immutable = True
+
def __init__(self, method):
self.method = method
@@ -592,6 +599,8 @@
]
def annotation_to_lltype(s_val, info=None):
+ from rpython.rtyper.ootypesystem import ootype
+
if isinstance(s_val, SomeOOInstance):
return s_val.ootype
if isinstance(s_val, SomeOOStaticMeth):
@@ -625,6 +634,8 @@
ll_to_annotation_map = dict([(ll, ann) for ann, ll in annotation_to_ll_map])
def lltype_to_annotation(T):
+ from rpython.rtyper.ootypesystem import ootype
+
try:
s = ll_to_annotation_map.get(T)
except TypeError:
@@ -730,7 +741,7 @@
flattened = args
for arg in flattened:
if arg.__class__ is SomeObject and arg.knowntype is not type:
- return SomeObject()
+ return SomeObject()
bookkeeper = rpython.annotator.bookkeeper.getbookkeeper()
bookkeeper.warning("no precise annotation supplied for %s%r" % (name, args))
return s_ImpossibleValue
diff --git a/rpython/rtyper/lltypesystem/rlist.py b/rpython/rtyper/lltypesystem/rlist.py
--- a/rpython/rtyper/lltypesystem/rlist.py
+++ b/rpython/rtyper/lltypesystem/rlist.py
@@ -1,6 +1,6 @@
-from rpython.rlib import rgc, jit
+from rpython.rlib import rgc, jit, types
from rpython.rlib.debug import ll_assert
-from rpython.rlib.objectmodel import enforceargs
+from rpython.rlib.signature import signature
from rpython.rtyper.lltypesystem import rstr
from rpython.rtyper.lltypesystem.lltype import (GcForwardReference, Ptr, GcArray,
GcStruct, Void, Signed, malloc, typeOf, nullptr, typeMethod)
@@ -171,7 +171,7 @@
# adapted C code
- at enforceargs(None, int, None)
+ at signature(types.any(), types.int(), types.bool(), returns=types.none())
def _ll_list_resize_hint_really(l, newsize, overallocate):
"""
Ensure l.items has room for at least newsize elements. Note that
@@ -227,7 +227,8 @@
if allocated < newsize or newsize < (allocated >> 1) - 5:
_ll_list_resize_hint_really(l, newsize, False)
- at enforceargs(None, int, None)
+
+ at signature(types.any(), types.int(), types.bool(), returns=types.none())
def _ll_list_resize_really(l, newsize, overallocate):
"""
Ensure l.items has room for at least newsize elements, and set
More information about the pypy-commit
mailing list