Commits

Philip Jenvey  committed 63e8637

rpython's stricter now about None for a pointer type, fix translation

  • Participants
  • Parent commits 1a80367
  • Branches py3k

Comments (0)

Files changed (1)

File pypy/module/_codecs/locale.py

 def unicode2rawwcharp(u):
     """unicode -> raw wchar_t*"""
     if _should_merge_surrogates():
-        size = _unicode2rawwcharp_loop(u, None)
+        size = _unicode2rawwcharp_loop(u, lltype.nullptr(RAW_WCHARP.TO))
     else:
         size = len(u)
     array = lltype.malloc(RAW_WCHARP.TO, size + 1, flavor='raw')
 unicode2rawwcharp._annenforceargs_ = [unicode]
 
 def _unicode2rawwcharp_loop(u, array):
-    write = array is not None
     ulen = len(u)
     count = i = 0
     while i < ulen:
         if (_should_merge_surrogates() and
             0xD800 <= oc <= 0xDBFF and i + 1 < ulen and
             0xDC00 <= ord(u[i + 1]) <= 0xDFFF):
-            if write:
+            if array:
                 merged = (((oc & 0x03FF) << 10) |
                           (ord(u[i + 1]) & 0x03FF)) + 0x10000
                 array[count] = rffi.cast(rffi.WCHAR_T, merged)
             i += 2
         else:
-            if write:
+            if array:
                 array[count] = rffi.cast(rffi.WCHAR_T, oc)
             i += 1
         count += 1