This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: wrong wsprintf usage
Type: compile error Stage:
Components: Windows Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, eckhardt, vstinner
Priority: normal Keywords: patch

Created on 2009-01-02 13:08 by eckhardt, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-2.7-no-wsprint.0.patch eckhardt, 2009-01-02 13:08 patch
Messages (4)
msg78790 - (view) Author: Ulrich Eckhardt (eckhardt) Date: 2009-01-02 13:08
Note up front: there is a win32 function wsprintf() and an ISO C
function swprintf(), these are different things in case you wonder.

In _winreg.c, there are two functions that use wsprintf on a char
buffer, while the function takes a TCHAR buffer instead. This leads to
compile warning and runtime errors when _UNICODE is defined, like e.g.
under MS Windows CE. The attached patch replaces the two calls to that
function with calls to fprintf() and PyString_FromFormat().
msg79748 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-01-13 16:11
The patch seems good.
This only applies to trunk: py3k already uses PyUnicode_FromFormat.
msg79764 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-01-13 18:47
fprintf() is much better than wsprintf() + fputs() with a fixed size 
buffer (with no size/error check!). Same remark for 
PyString_FromFormat() instead of wsprintf()+PyString_FromString().
msg79789 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-01-13 23:19
Fixed in r68592.
History
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 49057
2009-01-13 23:19:43amaury.forgeotdarcsetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg79789
2009-01-13 18:47:24vstinnersetnosy: + vstinner
messages: + msg79764
2009-01-13 16:11:26amaury.forgeotdarcsetresolution: accepted
messages: + msg79748
nosy: + amaury.forgeotdarc
2009-01-02 13:08:01eckhardtcreate