[pypy-svn] pypy default: On Windows, Python.h defines snprintf and vsnprintf...
amauryfa
commits-noreply at bitbucket.org
Wed Mar 23 19:06:10 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r42876:0ab786e2a9ee
Date: 2011-03-23 14:59 +0100
http://bitbucket.org/pypy/pypy/changeset/0ab786e2a9ee/
Log: On Windows, Python.h defines snprintf and vsnprintf...
diff --git a/pypy/module/cpyext/include/pyerrors.h b/pypy/module/cpyext/include/pyerrors.h
--- a/pypy/module/cpyext/include/pyerrors.h
+++ b/pypy/module/cpyext/include/pyerrors.h
@@ -15,6 +15,20 @@
PyObject *PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict);
PyObject *PyErr_Format(PyObject *exception, const char *format, ...);
+/* These APIs aren't really part of the error implementation, but
+ often needed to format error messages; the native C lib APIs are
+ not available on all platforms, which is why we provide emulations
+ for those platforms in Python/mysnprintf.c,
+ WARNING: The return value of snprintf varies across platforms; do
+ not rely on any particular behavior; eventually the C99 defn may
+ be reliable.
+*/
+#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF)
+# define HAVE_SNPRINTF
+# define snprintf _snprintf
+# define vsnprintf _vsnprintf
+#endif
+
#ifdef __cplusplus
}
#endif
More information about the Pypy-commit
mailing list