]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#4807: Remove a wrong usage of wsprintf in the winreg module
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Tue, 13 Jan 2009 23:19:08 +0000 (23:19 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Tue, 13 Jan 2009 23:19:08 +0000 (23:19 +0000)
("windows sprintf", different than swprintf)

Needed for the windows CE port.

Misc/NEWS
PC/_winreg.c

index f9122bbc137e19f1e12c3f78fa162ed6fd1d78d5..79393235841da43f81007e275a6ae817c92b343f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.7 alpha 1
 Core and Builtins
 -----------------
 
+- Issue #4807: Port the _winreg module to Windows CE.
+
 - Issue #4935: The overflow checking code in the expandtabs() method common
   to str, bytes and bytearray could be optimized away by the compiler, letting
   the interpreter segfault instead of raising an error.
index 74d33437bc802f65f626e094caca569314867017..0cb516a781e59da0f01ab2f80079d80f36ee4429 100644 (file)
@@ -410,21 +410,17 @@ PyHKEY_intFunc(PyObject *ob)
 static int
 PyHKEY_printFunc(PyObject *ob, FILE *fp, int flags)
 {
-       PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
-       char resBuf[160];
-       wsprintf(resBuf, "<PyHKEY at %p (%p)>",
-                ob, pyhkey->hkey);
-       fputs(resBuf, fp);
-       return 0;
+    PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
+    fprintf(fp, "<PyHKEY at %p (%p)>",
+            ob, pyhkey->hkey);
+    return 0;
 }
 
 static PyObject *
 PyHKEY_strFunc(PyObject *ob)
 {
-       PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
-       char resBuf[160];
-       wsprintf(resBuf, "<PyHKEY:%p>", pyhkey->hkey);
-       return PyString_FromString(resBuf);
+    PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
+    return PyString_FromFormat("<PyHKEY:%p>", pyhkey->hkey);
 }
 
 static int