[pypy-svn] r7478 - in pypy/trunk/src/pypy: annotation interpreter objspace/std translator
hpk at codespeak.net
hpk at codespeak.net
Sat Nov 20 09:22:14 CET 2004
Author: hpk
Date: Sat Nov 20 09:22:14 2004
New Revision: 7478
Modified:
pypy/trunk/src/pypy/annotation/binaryop.py
pypy/trunk/src/pypy/annotation/factory.py
pypy/trunk/src/pypy/interpreter/argument.py
pypy/trunk/src/pypy/interpreter/eval.py
pypy/trunk/src/pypy/objspace/std/objspace.py
pypy/trunk/src/pypy/translator/annrpython.py
pypy/trunk/src/pypy/translator/genc.h
Log:
revert the previous commit ... sorry mixed up my
cmdline ...
Modified: pypy/trunk/src/pypy/annotation/binaryop.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/binaryop.py (original)
+++ pypy/trunk/src/pypy/annotation/binaryop.py Sat Nov 20 09:22:14 2004
@@ -7,7 +7,7 @@
from pypy.annotation.model import SomeString, SomeChar, SomeList, SomeDict
from pypy.annotation.model import SomeTuple, SomeImpossibleValue
from pypy.annotation.model import SomeInstance, SomeCallable
-from pypy.annotation.model import SomeBuiltin, SomeIterator, SomeNone
+from pypy.annotation.model import SomeBuiltin, SomeIterator
from pypy.annotation.model import SomePrebuiltConstant, immutablevalue
from pypy.annotation.model import unionof, set, setunion, missing_operation
from pypy.annotation.factory import generalize, isclassdef, getbookkeeper
@@ -288,24 +288,6 @@
d[cal] = classdef
return SomeCallable(d)
-# XXX experimental hack: union of more complex objects with
-# SomeNone (aka "NULL"-pointer) doesn't destroy
-# type inference (keeps the type of the more complex object)
-
-#for _X in SomeCallable, SomeInstance, SomePrebuiltConstant:
-# class __extend__(pairtype(_X, SomeNone)):
-# def union((obj1, obj2)):
-# return obj1
-# class __extend__(pairtype(SomeNone, _X)):
-# def union((obj1, obj2)):
-# return obj2
-
-#class __extend__(pairtype(SomePrebuiltConstant, SomeNone)):
-# def union((pbc, non)):
-# if
-
-# XXX experimental hack finish ... kind of
-
class __extend__(pairtype(SomeImpossibleValue, SomeObject)):
def union((imp1, obj2)):
return obj2
Modified: pypy/trunk/src/pypy/annotation/factory.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/factory.py (original)
+++ pypy/trunk/src/pypy/annotation/factory.py Sat Nov 20 09:22:14 2004
@@ -177,27 +177,11 @@
assert isinstance(func, FunctionType), "expected function, got %r"%func
# do we need to specialize this function in several versions?
x = getattr(func, '_specialize_', False)
- #if not x:
- # x = 'argtypesdeep'
if x:
if x == 'argtypes':
key = "_".join([arg.__class__.__name__ for arg in args])
name = func.__name__+'_'+key
func = self.specialize_by_key(func, key, name)
- elif x == 'argtypesdeep':
- l = []
- for arg in args:
- if isinstance(arg, SomeInstance):
- if hasattr(arg, 'knowntype'):
- x = arg.knowntype.__name__
- else:
- x = 'unknown'
- l.append('SI_%s' % x)
- else:
- l.append(arg.__class__.__name__)
- key = "_".join(l)
- name = func.__name__ + '_' + key
- func = self.specialize_by_key(func, key, name)
elif x == "location":
# fully specialize: create one version per call position
func = self.specialize_by_key(func, self.position_key)
Modified: pypy/trunk/src/pypy/interpreter/argument.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/argument.py (original)
+++ pypy/trunk/src/pypy/interpreter/argument.py Sat Nov 20 09:22:14 2004
@@ -84,9 +84,7 @@
space = self.space
args_w = self.args_w
kwds_w = self.kwds_w
- argnames = signature[0]
- varargname = signature[1]
- kwargname = signature[2]
+ argnames, varargname, kwargname = signature
#
# args_w = list of the normal actual parameters, wrapped
# kwds_w = real dictionary {'keyword': wrapped parameter}
Modified: pypy/trunk/src/pypy/interpreter/eval.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/eval.py (original)
+++ pypy/trunk/src/pypy/interpreter/eval.py Sat Nov 20 09:22:14 2004
@@ -49,7 +49,7 @@
def getdocstring(self):
return None
-class UndefinedClass:
+class UndefinedClass:
pass
UNDEFINED = UndefinedClass() # marker for undefined local variables
Modified: pypy/trunk/src/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/objspace.py (original)
+++ pypy/trunk/src/pypy/objspace/std/objspace.py Sat Nov 20 09:22:14 2004
@@ -303,7 +303,6 @@
def lookup(self, w_obj, name):
w_type = w_obj.getclass(self)
return w_type.lookup(name)
- lookup._specialize_ = "argtypesdeep"
def allocate_instance(self, cls, w_subtype):
"""Allocate the memory needed for an instance of an internal or
@@ -350,7 +349,6 @@
if w_one is w_two:
return self.w_True
return self.w_False
- is_._specialize_ = "argtypesdeep"
def is_true(self, w_obj):
# XXX don't look!
@@ -358,7 +356,6 @@
return not not w_obj.used
else:
return DescrOperation.is_true(self, w_obj)
- is_true._specialize_ = "argtypesdeep"
def hash(space, w_obj):
w = space.wrap
Modified: pypy/trunk/src/pypy/translator/annrpython.py
==============================================================================
--- pypy/trunk/src/pypy/translator/annrpython.py (original)
+++ pypy/trunk/src/pypy/translator/annrpython.py Sat Nov 20 09:22:14 2004
@@ -187,17 +187,16 @@
missingargs = expectedargs - len(inputcells)
nbdefaults = len(func.func_defaults or ())
if not (0 <= missingargs <= nbdefaults):
+ # XXX hack to avoid "*args" related processing
+ # to bail out
+ #v = graph.getreturnvar()
+ #return self.bindings.get(v, annmodel.SomeImpossibleValue())
+ # XXX end hack
if nbdefaults:
msg = "%d to %d" % (expectedargs-nbdefaults,
expectedargs)
else:
msg = "%d" % expectedargs
- # XXX hack to avoid "*args" related processing
- # to bail out
- print "ANNOTATION WARNING: got %d inputcells in call to %r; expected %s" % (len(inputcells), func, msg)
- v = graph.getreturnvar()
- return self.bindings.get(v, annmodel.SomeImpossibleValue())
- # XXX end hack
raise AnnotatorError, (
"got %d inputcells in call to %r; expected %s" % (
len(inputcells), func, msg))
Modified: pypy/trunk/src/pypy/translator/genc.h
==============================================================================
--- pypy/trunk/src/pypy/translator/genc.h (original)
+++ pypy/trunk/src/pypy/translator/genc.h Sat Nov 20 09:22:14 2004
@@ -194,7 +194,6 @@
#define SETUP_MODULE(modname) \
PyObject *m = Py_InitModule(#modname, no_methods); \
- PyModule_AddStringConstant(m, "__sourcefile__", __FILE__); \
this_module_globals = PyModule_GetDict(m); \
PyGenCFunction_Type.tp_base = &PyCFunction_Type; \
PyType_Ready(&PyGenCFunction_Type); \
More information about the Pypy-commit
mailing list