[pypy-svn] r9393 - in pypy/dist/pypy/interpreter: . test
pedronis at codespeak.net
pedronis at codespeak.net
Mon Feb 21 23:19:10 CET 2005
Author: pedronis
Date: Mon Feb 21 23:19:10 2005
New Revision: 9393
Modified:
pypy/dist/pypy/interpreter/gateway.py
pypy/dist/pypy/interpreter/test/test_gateway.py
Log:
removed unused importall exportall export_values
Modified: pypy/dist/pypy/interpreter/gateway.py
==============================================================================
--- pypy/dist/pypy/interpreter/gateway.py (original)
+++ pypy/dist/pypy/interpreter/gateway.py Mon Feb 21 23:19:10 2005
@@ -4,8 +4,6 @@
* BuiltinCode (call interp-level code from app-level)
* app2interp (embed an app-level function into an interp-level callable)
* interp2app (publish an interp-level object to be visible from app-level)
-* exportall (mass-call interp2app on a whole dict of objects)
-* importall (mass-call app2interp on a whole dict of objects)
"""
@@ -446,49 +444,6 @@
fn = Function(space, code, None, defs, forcename = self.name)
cache.content[self] = fn
return fn
-
-def exportall(d, temporary=False):
- """NOT_RPYTHON: Publish every function from a dict."""
- if temporary:
- i2a = interp2app_temp
- else:
- i2a = interp2app
- for name, obj in d.items():
- if isinstance(obj, types.FunctionType):
- # names starting in 'app_' are supposedly already app-level
- if name.startswith('app_'):
- continue
- # ignore tricky functions with another interp-level meaning
- if name in ('__init__', '__new__'):
- continue
- # ignore names in '_xyz'
- if name.startswith('_') and not name.endswith('_'):
- continue
- if 'app_'+name not in d:
- d['app_'+name] = i2a(obj, name)
-
-def export_values(space, dic, w_namespace):
- "NOT_RPYTHON"
- for name, w_value in dic.items():
- if name.startswith('w_'):
- if name == 'w_dict':
- w_name = space.wrap('__dict__')
- elif name == 'w_name':
- w_name = space.wrap('__name__')
- else:
- w_name = space.wrap(name[2:])
- space.setitem(w_namespace, w_name, w_value)
-
-def importall(d, temporary=False):
- """NOT_RPYTHON: Import all app_-level functions as Gateways into a dict."""
- if temporary:
- a2i = app2interp_temp
- else:
- a2i = app2interp
- for name, obj in d.items():
- if name.startswith('app_') and name[4:] not in d:
- if isinstance(obj, types.FunctionType):
- d[name[4:]] = a2i(obj)
#
# the next gateways are to be used only for
Modified: pypy/dist/pypy/interpreter/test/test_gateway.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_gateway.py (original)
+++ pypy/dist/pypy/interpreter/test/test_gateway.py Mon Feb 21 23:19:10 2005
@@ -209,17 +209,5 @@
raises(gateway.OperationError,space.call_function,w_app_g3_f,w(None))
raises(gateway.OperationError,space.call_function,w_app_g3_f,w("foo"))
-
- def test_importall(self):
- w = self.space.wrap
- g = {'app_g3': app_g3}
- gateway.importall(g, temporary=True)
- g3 = g['g3']
- assert self.space.eq_w(g3(self.space, w('bar')), w('foobar'))
-
-## def test_exportall(self):
-## not used any more
-
-
def app_g3(b):
return 'foo'+b
More information about the Pypy-commit
mailing list