Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 1 | /********************************************************* |
| 2 | |
| 3 | msvcrtmodule.c |
| 4 | |
| 5 | A Python interface to the Microsoft Visual C Runtime |
| 6 | Library, providing access to those non-portable, but |
| 7 | still useful routines. |
| 8 | |
| 9 | Only ever compiled with an MS compiler, so no attempt |
| 10 | has been made to avoid MS language extensions, etc... |
| 11 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 12 | This may only work on NT or 95... |
| 13 | |
| 14 | Author: Mark Hammond and Guido van Rossum. |
| 15 | Maintenance: Guido van Rossum. |
| 16 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 17 | ***********************************************************/ |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 18 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 19 | #include "Python.h" |
| 20 | #include "malloc.h" |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 21 | #include <io.h> |
| 22 | #include <conio.h> |
| 23 | #include <sys/locking.h> |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 24 | |
Martin v. Löwis | bcb017f | 2008-11-30 19:28:27 +0000 | [diff] [blame] | 25 | #ifdef _MSC_VER |
| 26 | #if _MSC_VER >= 1500 |
| 27 | #include <crtassem.h> |
| 28 | #endif |
| 29 | #endif |
| 30 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 31 | // Force the malloc heap to clean itself up, and free unused blocks |
| 32 | // back to the OS. (According to the docs, only works on NT.) |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 33 | static PyObject * |
| 34 | msvcrt_heapmin(PyObject *self, PyObject *args) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 35 | { |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 36 | if (!PyArg_ParseTuple(args, ":heapmin")) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 37 | return NULL; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 38 | |
| 39 | if (_heapmin() != 0) |
| 40 | return PyErr_SetFromErrno(PyExc_IOError); |
| 41 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 42 | Py_INCREF(Py_None); |
| 43 | return Py_None; |
| 44 | } |
| 45 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 46 | // Perform locking operations on a C runtime file descriptor. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 47 | static PyObject * |
| 48 | msvcrt_locking(PyObject *self, PyObject *args) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 49 | { |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 50 | int fd; |
| 51 | int mode; |
| 52 | long nbytes; |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 53 | int err; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 54 | |
| 55 | if (!PyArg_ParseTuple(args, "iil:locking", &fd, &mode, &nbytes)) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 56 | return NULL; |
| 57 | |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 58 | Py_BEGIN_ALLOW_THREADS |
| 59 | err = _locking(fd, mode, nbytes); |
| 60 | Py_END_ALLOW_THREADS |
| 61 | if (err != 0) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 62 | return PyErr_SetFromErrno(PyExc_IOError); |
| 63 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 64 | Py_INCREF(Py_None); |
| 65 | return Py_None; |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 66 | } |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 67 | |
| 68 | // Set the file translation mode for a C runtime file descriptor. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 69 | static PyObject * |
| 70 | msvcrt_setmode(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 71 | { |
| 72 | int fd; |
| 73 | int flags; |
| 74 | if (!PyArg_ParseTuple(args,"ii:setmode", &fd, &flags)) |
| 75 | return NULL; |
| 76 | |
| 77 | flags = _setmode(fd, flags); |
| 78 | if (flags == -1) |
| 79 | return PyErr_SetFromErrno(PyExc_IOError); |
| 80 | |
| 81 | return PyInt_FromLong(flags); |
| 82 | } |
| 83 | |
| 84 | // Convert an OS file handle to a C runtime file descriptor. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 85 | static PyObject * |
| 86 | msvcrt_open_osfhandle(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 87 | { |
| 88 | long handle; |
| 89 | int flags; |
| 90 | int fd; |
| 91 | |
| 92 | if (!PyArg_ParseTuple(args, "li:open_osfhandle", &handle, &flags)) |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 93 | return NULL; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 94 | |
| 95 | fd = _open_osfhandle(handle, flags); |
| 96 | if (fd == -1) |
| 97 | return PyErr_SetFromErrno(PyExc_IOError); |
| 98 | |
| 99 | return PyInt_FromLong(fd); |
| 100 | } |
| 101 | |
| 102 | // Convert a C runtime file descriptor to an OS file handle. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 103 | static PyObject * |
| 104 | msvcrt_get_osfhandle(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 105 | { |
| 106 | int fd; |
Tim Peters | 79248aa | 2001-08-29 21:37:10 +0000 | [diff] [blame] | 107 | Py_intptr_t handle; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 108 | |
| 109 | if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd)) |
| 110 | return NULL; |
| 111 | |
| 112 | handle = _get_osfhandle(fd); |
| 113 | if (handle == -1) |
| 114 | return PyErr_SetFromErrno(PyExc_IOError); |
| 115 | |
Fred Drake | 25e1726 | 2000-06-30 17:48:51 +0000 | [diff] [blame] | 116 | /* technically 'handle' is not a pointer, but a integer as |
| 117 | large as a pointer, Python's *VoidPtr interface is the |
| 118 | most appropriate here */ |
| 119 | return PyLong_FromVoidPtr((void*)handle); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | /* Console I/O */ |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 123 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 124 | static PyObject * |
| 125 | msvcrt_kbhit(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 126 | { |
| 127 | int ok; |
| 128 | |
| 129 | if (!PyArg_ParseTuple(args, ":kbhit")) |
| 130 | return NULL; |
| 131 | |
| 132 | ok = _kbhit(); |
| 133 | return PyInt_FromLong(ok); |
| 134 | } |
| 135 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 136 | static PyObject * |
| 137 | msvcrt_getch(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 138 | { |
| 139 | int ch; |
| 140 | char s[1]; |
| 141 | |
| 142 | if (!PyArg_ParseTuple(args, ":getch")) |
| 143 | return NULL; |
| 144 | |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 145 | Py_BEGIN_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 146 | ch = _getch(); |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 147 | Py_END_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 148 | s[0] = ch; |
Gregory P. Smith | dd96db6 | 2008-06-09 04:58:54 +0000 | [diff] [blame] | 149 | return PyString_FromStringAndSize(s, 1); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 150 | } |
| 151 | |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 152 | #ifdef _WCONIO_DEFINED |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 153 | static PyObject * |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 154 | msvcrt_getwch(PyObject *self, PyObject *args) |
| 155 | { |
| 156 | Py_UNICODE ch; |
| 157 | Py_UNICODE u[1]; |
| 158 | |
| 159 | if (!PyArg_ParseTuple(args, ":getwch")) |
| 160 | return NULL; |
| 161 | |
| 162 | Py_BEGIN_ALLOW_THREADS |
| 163 | ch = _getwch(); |
| 164 | Py_END_ALLOW_THREADS |
| 165 | u[0] = ch; |
| 166 | return PyUnicode_FromUnicode(u, 1); |
| 167 | } |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 168 | #endif |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 169 | |
| 170 | static PyObject * |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 171 | msvcrt_getche(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 172 | { |
| 173 | int ch; |
| 174 | char s[1]; |
| 175 | |
| 176 | if (!PyArg_ParseTuple(args, ":getche")) |
| 177 | return NULL; |
| 178 | |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 179 | Py_BEGIN_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 180 | ch = _getche(); |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 181 | Py_END_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 182 | s[0] = ch; |
Gregory P. Smith | dd96db6 | 2008-06-09 04:58:54 +0000 | [diff] [blame] | 183 | return PyString_FromStringAndSize(s, 1); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 184 | } |
| 185 | |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 186 | #ifdef _WCONIO_DEFINED |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 187 | static PyObject * |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 188 | msvcrt_getwche(PyObject *self, PyObject *args) |
| 189 | { |
| 190 | Py_UNICODE ch; |
| 191 | Py_UNICODE s[1]; |
| 192 | |
| 193 | if (!PyArg_ParseTuple(args, ":getwche")) |
| 194 | return NULL; |
| 195 | |
| 196 | Py_BEGIN_ALLOW_THREADS |
| 197 | ch = _getwche(); |
| 198 | Py_END_ALLOW_THREADS |
| 199 | s[0] = ch; |
| 200 | return PyUnicode_FromUnicode(s, 1); |
| 201 | } |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 202 | #endif |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 203 | |
| 204 | static PyObject * |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 205 | msvcrt_putch(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 206 | { |
| 207 | char ch; |
| 208 | |
| 209 | if (!PyArg_ParseTuple(args, "c:putch", &ch)) |
| 210 | return NULL; |
| 211 | |
| 212 | _putch(ch); |
| 213 | Py_INCREF(Py_None); |
| 214 | return Py_None; |
| 215 | } |
| 216 | |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 217 | #ifdef _WCONIO_DEFINED |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 218 | static PyObject * |
| 219 | msvcrt_putwch(PyObject *self, PyObject *args) |
| 220 | { |
| 221 | Py_UNICODE *ch; |
| 222 | int size; |
| 223 | |
| 224 | if (!PyArg_ParseTuple(args, "u#:putwch", &ch, &size)) |
| 225 | return NULL; |
| 226 | |
Christian Heimes | 61927fc | 2007-12-10 15:39:09 +0000 | [diff] [blame] | 227 | if (size == 0) { |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 228 | PyErr_SetString(PyExc_ValueError, |
Christian Heimes | 61927fc | 2007-12-10 15:39:09 +0000 | [diff] [blame] | 229 | "Expected unicode string of length 1"); |
| 230 | return NULL; |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 231 | } |
Christian Heimes | 61927fc | 2007-12-10 15:39:09 +0000 | [diff] [blame] | 232 | _putwch(*ch); |
| 233 | Py_RETURN_NONE; |
| 234 | |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 235 | } |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 236 | #endif |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 237 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 238 | static PyObject * |
| 239 | msvcrt_ungetch(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 240 | { |
| 241 | char ch; |
| 242 | |
| 243 | if (!PyArg_ParseTuple(args, "c:ungetch", &ch)) |
| 244 | return NULL; |
| 245 | |
Guido van Rossum | 6543e88 | 1999-02-16 19:40:02 +0000 | [diff] [blame] | 246 | if (_ungetch(ch) == EOF) |
| 247 | return PyErr_SetFromErrno(PyExc_IOError); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 248 | Py_INCREF(Py_None); |
| 249 | return Py_None; |
| 250 | } |
| 251 | |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 252 | #ifdef _WCONIO_DEFINED |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 253 | static PyObject * |
| 254 | msvcrt_ungetwch(PyObject *self, PyObject *args) |
| 255 | { |
| 256 | Py_UNICODE ch; |
| 257 | |
| 258 | if (!PyArg_ParseTuple(args, "u:ungetwch", &ch)) |
| 259 | return NULL; |
| 260 | |
| 261 | if (_ungetch(ch) == EOF) |
| 262 | return PyErr_SetFromErrno(PyExc_IOError); |
| 263 | Py_INCREF(Py_None); |
| 264 | return Py_None; |
| 265 | } |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 266 | #endif |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 267 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 268 | static void |
| 269 | insertint(PyObject *d, char *name, int value) |
| 270 | { |
| 271 | PyObject *v = PyInt_FromLong((long) value); |
| 272 | if (v == NULL) { |
| 273 | /* Don't bother reporting this error */ |
| 274 | PyErr_Clear(); |
| 275 | } |
| 276 | else { |
| 277 | PyDict_SetItemString(d, name, v); |
| 278 | Py_DECREF(v); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 283 | /* List of functions exported by this module */ |
| 284 | static struct PyMethodDef msvcrt_functions[] = { |
Neal Norwitz | 031829d | 2002-03-31 14:37:44 +0000 | [diff] [blame] | 285 | {"heapmin", msvcrt_heapmin, METH_VARARGS}, |
| 286 | {"locking", msvcrt_locking, METH_VARARGS}, |
| 287 | {"setmode", msvcrt_setmode, METH_VARARGS}, |
| 288 | {"open_osfhandle", msvcrt_open_osfhandle, METH_VARARGS}, |
| 289 | {"get_osfhandle", msvcrt_get_osfhandle, METH_VARARGS}, |
| 290 | {"kbhit", msvcrt_kbhit, METH_VARARGS}, |
| 291 | {"getch", msvcrt_getch, METH_VARARGS}, |
| 292 | {"getche", msvcrt_getche, METH_VARARGS}, |
| 293 | {"putch", msvcrt_putch, METH_VARARGS}, |
| 294 | {"ungetch", msvcrt_ungetch, METH_VARARGS}, |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 295 | #ifdef _WCONIO_DEFINED |
Christian Heimes | 7c7f6af | 2007-12-10 15:12:41 +0000 | [diff] [blame] | 296 | {"getwch", msvcrt_getwch, METH_VARARGS}, |
| 297 | {"getwche", msvcrt_getwche, METH_VARARGS}, |
| 298 | {"putwch", msvcrt_putwch, METH_VARARGS}, |
| 299 | {"ungetwch", msvcrt_ungetwch, METH_VARARGS}, |
Amaury Forgeot d'Arc | a4dd2e2 | 2008-06-13 00:42:22 +0000 | [diff] [blame] | 300 | #endif |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 301 | {NULL, NULL} |
| 302 | }; |
| 303 | |
Thomas Heller | a18331d | 2004-07-28 20:02:52 +0000 | [diff] [blame] | 304 | PyMODINIT_FUNC |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 305 | initmsvcrt(void) |
| 306 | { |
Martin v. Löwis | bcb017f | 2008-11-30 19:28:27 +0000 | [diff] [blame] | 307 | int st; |
Tim Peters | 2188bf0 | 2006-01-19 15:21:30 +0000 | [diff] [blame] | 308 | PyObject *d; |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 309 | PyObject *m = Py_InitModule("msvcrt", msvcrt_functions); |
Neal Norwitz | 1ac754f | 2006-01-19 06:09:39 +0000 | [diff] [blame] | 310 | if (m == NULL) |
| 311 | return; |
Tim Peters | 2188bf0 | 2006-01-19 15:21:30 +0000 | [diff] [blame] | 312 | d = PyModule_GetDict(m); |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 313 | |
| 314 | /* constants for the locking() function's mode argument */ |
| 315 | insertint(d, "LK_LOCK", _LK_LOCK); |
| 316 | insertint(d, "LK_NBLCK", _LK_NBLCK); |
| 317 | insertint(d, "LK_NBRLCK", _LK_NBRLCK); |
| 318 | insertint(d, "LK_RLCK", _LK_RLCK); |
| 319 | insertint(d, "LK_UNLCK", _LK_UNLCK); |
Martin v. Löwis | bcb017f | 2008-11-30 19:28:27 +0000 | [diff] [blame] | 320 | |
| 321 | /* constants for the crt versions */ |
| 322 | #ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN |
| 323 | st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN", |
| 324 | _VC_ASSEMBLY_PUBLICKEYTOKEN); |
| 325 | if (st < 0)return; |
| 326 | #endif |
| 327 | #ifdef _CRT_ASSEMBLY_VERSION |
| 328 | st = PyModule_AddStringConstant(m, "CRT_ASSEMBLY_VERSION", |
| 329 | _CRT_ASSEMBLY_VERSION); |
| 330 | if (st < 0)return; |
| 331 | #endif |
| 332 | #ifdef __LIBRARIES_ASSEMBLY_NAME_PREFIX |
| 333 | st = PyModule_AddStringConstant(m, "LIBRARIES_ASSEMBLY_NAME_PREFIX", |
| 334 | __LIBRARIES_ASSEMBLY_NAME_PREFIX); |
| 335 | if (st < 0)return; |
| 336 | #endif |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 337 | } |