[Python-checkins] r67455 - in python/trunk: Misc/NEWS PC/msvcrtmodule.c
martin.v.loewis
python-checkins at python.org
Sun Nov 30 20:28:27 CET 2008
Author: martin.v.loewis
Date: Sun Nov 30 20:28:27 2008
New Revision: 67455
Log:
Issue #4365: Add crtassem.h constants to the msvcrt module.
Modified:
python/trunk/Misc/NEWS
python/trunk/PC/msvcrtmodule.c
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Nov 30 20:28:27 2008
@@ -114,6 +114,8 @@
Extension Modules
-----------------
+- Issue #4365: Add crtassem.h constants to the msvcrt module.
+
- Issue #4396: The parser module now correctly validates the with statement.
Modified: python/trunk/PC/msvcrtmodule.c
==============================================================================
--- python/trunk/PC/msvcrtmodule.c (original)
+++ python/trunk/PC/msvcrtmodule.c Sun Nov 30 20:28:27 2008
@@ -22,6 +22,12 @@
#include <conio.h>
#include <sys/locking.h>
+#ifdef _MSC_VER
+#if _MSC_VER >= 1500
+#include <crtassem.h>
+#endif
+#endif
+
// Force the malloc heap to clean itself up, and free unused blocks
// back to the OS. (According to the docs, only works on NT.)
static PyObject *
@@ -298,6 +304,7 @@
PyMODINIT_FUNC
initmsvcrt(void)
{
+ int st;
PyObject *d;
PyObject *m = Py_InitModule("msvcrt", msvcrt_functions);
if (m == NULL)
@@ -310,4 +317,21 @@
insertint(d, "LK_NBRLCK", _LK_NBRLCK);
insertint(d, "LK_RLCK", _LK_RLCK);
insertint(d, "LK_UNLCK", _LK_UNLCK);
+
+ /* constants for the crt versions */
+#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
+ st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
+ _VC_ASSEMBLY_PUBLICKEYTOKEN);
+ if (st < 0)return;
+#endif
+#ifdef _CRT_ASSEMBLY_VERSION
+ st = PyModule_AddStringConstant(m, "CRT_ASSEMBLY_VERSION",
+ _CRT_ASSEMBLY_VERSION);
+ if (st < 0)return;
+#endif
+#ifdef __LIBRARIES_ASSEMBLY_NAME_PREFIX
+ st = PyModule_AddStringConstant(m, "LIBRARIES_ASSEMBLY_NAME_PREFIX",
+ __LIBRARIES_ASSEMBLY_NAME_PREFIX);
+ if (st < 0)return;
+#endif
}
More information about the Python-checkins
mailing list