Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r63132:95c7ec00101c
Date: 2013-04-08 11:06 +0000
http://bitbucket.org/pypy/pypy/changeset/95c7ec00101c/

Log:    Fix _curses to not use unicode names when creating attributes.

        Fix translation to work anyway in this case (because pypy 2.0-beta2
        has such attributes).

diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -364,7 +364,9 @@
             key_n = ffi.string(key_n)
             if key_n == b"UNKNOWN KEY":
                 continue
-            key_n = key_n.decode().replace('(', '').replace(')', '')
+            if not isinstance(key_n, str):   # python 3
+                key_n = key_n.decode()
+            key_n = key_n.replace('(', '').replace(')', '')
             globals()[key_n] = key
 
 _setup()
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -709,6 +709,7 @@
 
     def new_interned_w_str(self, w_s):
         s = self.str_w(w_s)
+        assert isinstance(s, str)
         try:
             return self.interned_strings[s]
         except KeyError:
@@ -717,6 +718,7 @@
         return w_s
 
     def new_interned_str(self, s):
+        assert isinstance(s, str)
         try:
             return self.interned_strings[s]
         except KeyError:
diff --git a/pypy/module/_minimal_curses/__init__.py 
b/pypy/module/_minimal_curses/__init__.py
--- a/pypy/module/_minimal_curses/__init__.py
+++ b/pypy/module/_minimal_curses/__init__.py
@@ -27,6 +27,7 @@
     }
 
 for i in dir(_curses):
+    i = str(i)     # workaround for pypy 2.0-beta2
     val = getattr(_curses, i)
     if i.isupper() and type(val) is int:
         Module.interpleveldefs[i] = "space.wrap(%s)" % val
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to