[pypy-svn] r14350 - pypy/dist/pypy/module/sys

ac at codespeak.net ac at codespeak.net
Wed Jul 6 19:49:14 CEST 2005


Author: ac
Date: Wed Jul  6 19:49:13 2005
New Revision: 14350

Modified:
   pypy/dist/pypy/module/sys/__init__.py
   pypy/dist/pypy/module/sys/app.py
   pypy/dist/pypy/module/sys/state.py
Log:
Have out own sys.(get|set)defaultencoding.



Modified: pypy/dist/pypy/module/sys/__init__.py
==============================================================================
--- pypy/dist/pypy/module/sys/__init__.py	(original)
+++ pypy/dist/pypy/module/sys/__init__.py	Wed Jul  6 19:49:13 2005
@@ -35,7 +35,6 @@
         'builtin_module_names'  : 'state.get(space).w_builtin_module_names', 
         'pypy_getudir'          : 'state.pypy_getudir', 
 
-        'getdefaultencoding'    : 'state.getdefaultencoding', 
         'getrefcount'           : 'vm.getrefcount', 
         '_getframe'             : 'vm._getframe', 
         'setrecursionlimit'     : 'vm.setrecursionlimit', 
@@ -68,6 +67,8 @@
         'exit'                  : 'app.exit', 
         'getfilesystemencoding' : 'app.getfilesystemencoding', 
         'callstats'             : 'app.callstats',
+        'getdefaultencoding'    : 'app.getdefaultencoding', 
+        'setdefaultencoding'    : 'app.setdefaultencoding', 
     }
 
     def setbuiltinmodule(self, w_module, name): 

Modified: pypy/dist/pypy/module/sys/app.py
==============================================================================
--- pypy/dist/pypy/module/sys/app.py	(original)
+++ pypy/dist/pypy/module/sys/app.py	Wed Jul  6 19:49:13 2005
@@ -54,3 +54,14 @@
 9. All other calls
 10. Number of stack pops performed by call_function()"""
     return None
+
+defaultencoding = 'ascii'
+
+def getdefaultencoding():
+    return defaultencoding
+
+def setdefaultencoding(encoding):
+    global defaultencoding
+    import codecs
+    codecs.lookup(encoding)
+    defaultencoding = encoding

Modified: pypy/dist/pypy/module/sys/state.py
==============================================================================
--- pypy/dist/pypy/module/sys/state.py	(original)
+++ pypy/dist/pypy/module/sys/state.py	Wed Jul  6 19:49:13 2005
@@ -87,6 +87,3 @@
 # directly. 
 def pypy_getudir(space):
     return _pypy_getudir(space)
-
-def getdefaultencoding(space): 
-    return space.wrap(sys.getdefaultencoding())



More information about the Pypy-commit mailing list