[pypy-svn] r73531 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test

trundle at codespeak.net trundle at codespeak.net
Thu Apr 8 00:35:22 CEST 2010


Author: trundle
Date: Thu Apr  8 00:35:20 2010
New Revision: 73531

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py
   pypy/branch/cpython-extension/pypy/module/cpyext/unicodeobject.py
Log:
Add Py_UNICODE_TOUPPER.


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py	Thu Apr  8 00:35:20 2010
@@ -5666,11 +5666,6 @@
     raise NotImplementedError
 
 @cpython_api([{Py_UNICODE}], {Py_UNICODE})
-def Py_UNICODE_TOUPPER(space, ch):
-    """Return the character ch converted to upper case."""
-    raise NotImplementedError
-
- at cpython_api([{Py_UNICODE}], {Py_UNICODE})
 def Py_UNICODE_TOTITLE(space, ch):
     """Return the character ch converted to title case."""
     raise NotImplementedError

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_unicodeobject.py	Thu Apr  8 00:35:20 2010
@@ -48,3 +48,6 @@
         assert api.Py_UNICODE_TOLOWER(u'ä') == u'ä'
         assert api.Py_UNICODE_TOLOWER(u'Ä') == u'ä'
 
+    def test_TOUPPER(self, space, api):
+        assert api.Py_UNICODE_TOUPPER(u'ä') == u'Ä'
+        assert api.Py_UNICODE_TOUPPER(u'Ä') == u'Ä'

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/unicodeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/unicodeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/unicodeobject.py	Thu Apr  8 00:35:20 2010
@@ -55,6 +55,11 @@
     """Return the character ch converted to lower case."""
     return unichr(unicodedb.tolower(ord(ch)))
 
+ at cpython_api([Py_UNICODE], Py_UNICODE, error=CANNOT_FAIL)
+def Py_UNICODE_TOUPPER(space, ch):
+    """Return the character ch converted to upper case."""
+    return unichr(unicodedb.toupper(ord(ch)))
+
 @cpython_api([PyObject], rffi.CCHARP, error=CANNOT_FAIL)
 def PyUnicode_AS_DATA(space, ref):
     """Return a pointer to the internal buffer of the object. o has to be a



More information about the Pypy-commit mailing list