Commits

Ronald Oussoren committed b8d77a0

Fix unicode incompatibility for python 3.3 and later

(This caused a crash in python builds with --with-pydebug due to
an assertion failure)

Comments (0)

Files changed (1)

pyobjc-core/Modules/objc/unicode-object.m

 			ascii->length = length - nr_surrogates;
 			*ucs2_cur = 0;
 		}
+#if SIZEOF_WCHAR_T == 2
+		ascii->wstr = (wchar_t*)(result->base.data.ucs4);
+		compact->wstr_length = ascii->length;
+#endif
 
 	} else { /* 4BYTE_KIND */
 		result->base.data.ucs4 = PyObject_MALLOC(sizeof(Py_UCS4) * (length + 1 - nr_surrogates));
 		}
 		*ucs4_cur = 0;
 		ascii->length = length - nr_surrogates;
+#if SIZEOF_WCHAR_T == 4
+		ascii->wstr = (wchar_t*)(result->base.data.ucs4);
+		compact->wstr_length = ascii->length;
+#endif
 	}