]> granicus.if.org Git - python/commitdiff
Merged revisions 67455 via svnmerge from
authorMartin v. Löwis <martin@v.loewis.de>
Mon, 1 Dec 2008 04:49:40 +0000 (04:49 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Mon, 1 Dec 2008 04:49:40 +0000 (04:49 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67455 | martin.v.loewis | 2008-11-30 20:28:27 +0100 (So, 30 Nov 2008) | 1 line

  Issue #4365: Add crtassem.h constants to the msvcrt module.
........

Misc/NEWS
PC/msvcrtmodule.c

index 615812fcacb1b97e8d8363723c8c2811686803f3..300f7e7b92c53b1ebe0b7e16c794db4648b6deb9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -104,6 +104,8 @@ C-API
 Extension Modules
 -----------------
 
+- Issue #4365: Add crtassem.h constants to the msvcrt module.
+
 - Issue #4396: The parser module now correctly validates the with statement.
 
 
index 95e369b42499f78bb30308992ea2fa5a3a4000f4..cad22b19e0a0d3ae31b0a9be851ad6c0d8395bce 100755 (executable)
 #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 @@ static struct PyMethodDef msvcrt_functions[] = {
 PyMODINIT_FUNC
 initmsvcrt(void)
 {
+       int st;
        PyObject *d;
        PyObject *m = Py_InitModule("msvcrt", msvcrt_functions);
        if (m == NULL)
@@ -310,4 +317,21 @@ initmsvcrt(void)
        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
 }