[pypy-svn] r9277 - in pypy/branch/dist-interpapp/pypy: interpreter module/sys2 module/test
hpk at codespeak.net
hpk at codespeak.net
Thu Feb 17 17:42:04 CET 2005
Author: hpk
Date: Thu Feb 17 17:42:04 2005
New Revision: 9277
Modified:
pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py
pypy/branch/dist-interpapp/pypy/interpreter/executioncontext.py
pypy/branch/dist-interpapp/pypy/module/sys2/__init__.py
pypy/branch/dist-interpapp/pypy/module/sys2/state.py
pypy/branch/dist-interpapp/pypy/module/sys2/vm.py
pypy/branch/dist-interpapp/pypy/module/test/test_sysmodule.py
Log:
random fixes to make test_sysmodule.py pass
Modified: pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py (original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py Thu Feb 17 17:42:04 2005
@@ -48,7 +48,6 @@
self._gatewaycache = Cache()
self._codecache = Cache()
# set recursion limit
- self.recursion_limit = 1000
# sets all the internal descriptors
self.initialize()
Modified: pypy/branch/dist-interpapp/pypy/interpreter/executioncontext.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/executioncontext.py (original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/executioncontext.py Thu Feb 17 17:42:04 2005
@@ -11,7 +11,7 @@
self.framestack = Stack()
def enter(self, frame):
- if self.framestack.depth() > self.space.recursion_limit:
+ if self.framestack.depth() > self.space.sys.recursionlimit:
raise OperationError(self.space.w_RuntimeError,
self.space.wrap("maximum recursion depth exceeded"))
locals = getthreadlocals()
Modified: pypy/branch/dist-interpapp/pypy/module/sys2/__init__.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/module/sys2/__init__.py (original)
+++ pypy/branch/dist-interpapp/pypy/module/sys2/__init__.py Thu Feb 17 17:42:04 2005
@@ -3,6 +3,11 @@
class Module(ExtModule):
"""Sys Builtin Module. """
+ def __init__(self, space, w_name):
+ super(Module, self).__init__(space, w_name)
+ self.checkinterval = 100
+ self.recursionlimit = 100
+
interpleveldefs = {
'pypy_objspaceclass' : '(space.wrap(space.__class__.__name__))',
@@ -28,7 +33,7 @@
'builtin_module_names' : 'state.get(space).w_builtin_module_names',
'pypy_getudir' : 'state.pypy_getudir',
- 'getdefaultencoding' : 'space.wrap(sys.getdefaultencoding())',
+ 'getdefaultencoding' : 'state.getdefaultencoding',
'getrefcount' : 'vm.getrefcount',
'_getframe' : 'vm._getframe',
'setrecursionlimit' : 'vm.setrecursionlimit',
@@ -40,7 +45,8 @@
'executable' : 'space.wrap("py.py")',
'copyright' : 'space.wrap("MIT-License")',
- 'version_info' : 'space.wrap((2,3,4, "pypy1"))',
+ 'api_version' : 'space.wrap(1012)',
+ 'version_info' : 'space.wrap((2,3,4, "alpha", 42))',
'version' : 'space.wrap("2.3.4 (pypy1 build)")',
'hexversion' : 'space.wrap(0x020304a0)',
'ps1' : 'space.wrap(">>>>")',
Modified: pypy/branch/dist-interpapp/pypy/module/sys2/state.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/module/sys2/state.py (original)
+++ pypy/branch/dist-interpapp/pypy/module/sys2/state.py Thu Feb 17 17:42:04 2005
@@ -41,7 +41,7 @@
class State:
def __init__(self, space, stuff=None):
self.space = space
- self.w_builtin_module_names = space.newlist(
+ self.w_builtin_module_names = space.newtuple(
[space.wrap(fn) for fn in builtin_module_names])
self.w_modules = space.newdict([])
for fn, module in builtin_modules.items():
@@ -73,3 +73,5 @@
from pypy.tool.udir import udir
return space.wrap(str(udir))
+def getdefaultencoding(space):
+ return space.wrap(sys.getdefaultencoding())
Modified: pypy/branch/dist-interpapp/pypy/module/sys2/vm.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/module/sys2/vm.py (original)
+++ pypy/branch/dist-interpapp/pypy/module/sys2/vm.py Thu Feb 17 17:42:04 2005
@@ -42,7 +42,7 @@
space.wrap("recursion limit must be positive"))
# global recursion_limit
# we need to do it without writing globals.
- space.sys.recursion_limit = new_limit
+ space.sys.recursionlimit = new_limit
def getrecursionlimit(space):
"""getrecursionlimit()
@@ -51,7 +51,7 @@
recursion from causing an overflow of the C stack and crashing Python.
"""
- return space.wrap(space.sys.recursion_limit)
+ return space.wrap(space.sys.recursionlimit)
checkinterval = 100
Modified: pypy/branch/dist-interpapp/pypy/module/test/test_sysmodule.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/module/test/test_sysmodule.py (original)
+++ pypy/branch/dist-interpapp/pypy/module/test/test_sysmodule.py Thu Feb 17 17:42:04 2005
@@ -10,11 +10,9 @@
b.sys = sys
class TestSysTests:
- def setup_method(self,method):
- self.sys_w = self.space.get_builtin_module("sys")
def test_stdout_exists(self):
s = self.space
- assert s.is_true(s.getattr(self.sys_w, s.wrap("stdout")))
+ assert s.is_true(s.getattr(s.w_sys, s.wrap("stdout")))
class AppTestAppSysTests:
def test_path_exists(self):
More information about the Pypy-commit
mailing list