[pypy-svn] r73917 - pypy/branch/cpython-extension/pypy/module/cpyext

afa at codespeak.net afa at codespeak.net
Tue Apr 20 19:09:23 CEST 2010


Author: afa
Date: Tue Apr 20 19:09:22 2010
New Revision: 73917

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/unicodeobject.py
Log:
fix translation


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	Tue Apr 20 19:09:22 2010
@@ -151,12 +151,8 @@
     string may or may not be 0-terminated.  It is the responsibility of the caller
     to make sure that the wchar_t string is 0-terminated in case this is
     required by the application."""
-    if not PyUnicode_Check(space, ref):
-        raise OperationError(space.w_TypeError,
-                             space.wrap("expected unicode object"))
-
-    c_buffer = PyUnicode_AS_UNICODE(space, ref)
-    c_size = rffi.cast(PyUnicodeObject, ref).c_size
+    c_buffer = PyUnicode_AS_UNICODE(space, rffi.cast(PyObject, ref))
+    c_size = ref.c_size
 
     # If possible, try to copy the 0-termination as well
     if size > c_size:



More information about the Pypy-commit mailing list