[Python-checkins] r68592 - in python/trunk: Misc/NEWS PC/_winreg.c

amaury.forgeotdarc python-checkins at python.org
Wed Jan 14 00:19:08 CET 2009


Author: amaury.forgeotdarc
Date: Wed Jan 14 00:19:08 2009
New Revision: 68592

Log:
#4807: Remove a wrong usage of wsprintf in the winreg module
("windows sprintf", different than swprintf)

Needed for the windows CE port.


Modified:
   python/trunk/Misc/NEWS
   python/trunk/PC/_winreg.c

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Jan 14 00:19:08 2009
@@ -12,6 +12,8 @@
 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.

Modified: python/trunk/PC/_winreg.c
==============================================================================
--- python/trunk/PC/_winreg.c	(original)
+++ python/trunk/PC/_winreg.c	Wed Jan 14 00:19:08 2009
@@ -410,21 +410,17 @@
 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


More information about the Python-checkins mailing list