classification
Title: Deprecate or remove "U" and "U#" formats of Py_BuildValue()
Type: Stage:
Components: Interpreter Core Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, vstinner
Priority: normal Keywords: patch

Created on 2010-05-29 01:38 by vstinner, last changed 2010-06-07 20:00 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
py_buildvalue_removeU.patch vstinner, 2010-05-29 02:39
Messages (6)
msg106700 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-05-29 01:38
"U" and "U#" formats were introduced by r55433 (Python3). At this same, "s" and "U" formats were different: "s" called PyString_FromStringAndSize() and "U" called PyUnicode_FromStringAndSize(). Two months later, PyString_FromStringAndSize() was replaced by PyUnicode_FromStringAndSize() for format "s", and so both formats are exactly the same.

"U" and "U#" were introduced during the transition between bytes, str and unicode. They can now be replaced by "s" and "s#", and then be removed.

There is just one usage of "U": definition of sys.subversion (Python/sysmodule.c), whereas there are 36 usages of "s" format. (U# and s# are not used.)
msg106704 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-05-29 02:39
Less extreme patch: set 'U' as an alias to 's' (and 'U#' as an alias to 's#'). Replace usage of 'U' by 's'.

Note: 'z' is also an alias to 's', and 'z#' an alias to 's#'.
msg106880 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2010-06-02 12:25
The code for case 's'/'z' in py3k is indeed the same as for case 'U'. The patch looks good to me.

IMHO removing 'U' should only be done once Py2 is dead.
msg107206 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-06-06 18:52
> IMHO removing 'U' should only be done once Py2 is dead.

What do you mean by "once Py2 is dead"? Can I apply the patch in Python 3.2 now?
msg107260 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2010-06-07 08:55
Yes, I think you should apply the patch.
msg107276 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-06-07 20:00
Commited to py3k (r81807), blocked in 3.1 (r81808).
History
Date User Action Args
2010-06-07 20:00:46vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg107276
2010-06-07 08:55:43doerwaltersetmessages: + msg107260
2010-06-06 18:52:17vstinnersetmessages: + msg107206
2010-06-02 12:25:37doerwaltersetmessages: + msg106880
2010-05-29 02:39:47vstinnersettitle: Remove "U" and "U#" formats of Py_BuildValue() -> Deprecate or remove "U" and "U#" formats of Py_BuildValue()
2010-05-29 02:39:31vstinnersetfiles: + py_buildvalue_removeU.patch
keywords: + patch
messages: + msg106704
2010-05-29 01:38:47vstinnercreate