[Patches] [ python-Patches-438013 ] Remove 2-byte Py_UCS2 assumptions

noreply@sourceforge.net noreply@sourceforge.net
Mon, 02 Jul 2001 13:27:10 -0700


Patches item #438013, was opened at 2001-07-02 12:43
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=438013&group_id=5470

Category: core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: M.-A. Lemburg (lemburg)
Summary: Remove 2-byte Py_UCS2 assumptions

Initial Comment:
The patch changes PyUnicode_EncodeUTF16 and 
PyUnicode_DecodeUTF16 to work without assuming the 
existence of a (exactly) 2-byte type.

There are no more references remaining in the code 
base to Py_UCS2, except for what looks to be a now-
pointless complaint in unicodeobject.h.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-07-02 13:27

Message:
Logged In: YES 
user_id=31435

Isn't Py_UNICODE always big enough to hold a UCS-2 code 
point?  If the latter is 16 bits (which I assume), C 
guarantees an unsigned short is big enough to hold it (and 
doesn't guarantee an int is bigger than that -- although 
Python would be pretty useless if an int weren't bigger!).

----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2001-07-02 13:09

Message:
Logged In: YES 
user_id=38376

+1 from here.

Py_UCS2 should either go away, or be redefined as "large 
enough to hold a UCS-2 code point" (maybe there's some 
codec that may want to use such a data type?  in real 
life, "unsigned int" is probably a decent approximation...)

</F>

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=438013&group_id=5470