summaryrefslogtreecommitdiff
path: root/PC/msvcrtmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'PC/msvcrtmodule.c')
-rw-r--r--PC/msvcrtmodule.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index b0739d0167..c9d1e6cec6 100644
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -33,12 +33,12 @@
#endif
/*[python input]
-class Py_intptr_t_converter(CConverter):
- type = 'Py_intptr_t'
+class intptr_t_converter(CConverter):
+ type = 'intptr_t'
format_unit = '"_Py_PARSE_INTPTR"'
class handle_return_converter(long_return_converter):
- type = 'Py_intptr_t'
+ type = 'intptr_t'
cast = '(void *)'
conversion_fn = 'PyLong_FromVoidPtr'
@@ -59,7 +59,7 @@ class wchar_t_return_converter(CReturnConverter):
data.return_conversion.append(
'return_value = PyUnicode_FromOrdinal(_return_value);\n')
[python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=6a54fc4e73d0b367]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=b59f1663dba11997]*/
/*[clinic input]
module msvcrt
@@ -148,7 +148,7 @@ msvcrt_setmode_impl(PyObject *module, int fd, int flags)
/*[clinic input]
msvcrt.open_osfhandle -> long
- handle: Py_intptr_t
+ handle: intptr_t
flags: int
/
@@ -160,8 +160,8 @@ to os.fdopen() to create a file object.
[clinic start generated code]*/
static long
-msvcrt_open_osfhandle_impl(PyObject *module, Py_intptr_t handle, int flags)
-/*[clinic end generated code: output=bf65e422243a39f9 input=4d8516ed32db8f65]*/
+msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags)
+/*[clinic end generated code: output=cede871bf939d6e3 input=cb2108bbea84514e]*/
{
int fd;
@@ -183,22 +183,17 @@ Return the file handle for the file descriptor fd.
Raises IOError if fd is not recognized.
[clinic start generated code]*/
-static Py_intptr_t
+static intptr_t
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
-/*[clinic end generated code: output=eac47643338c0baa input=c7d18d02c8017ec1]*/
+/*[clinic end generated code: output=7ce761dd0de2b503 input=c7d18d02c8017ec1]*/
{
- Py_intptr_t handle = -1;
+ intptr_t handle = -1;
- if (!_PyVerify_fd(fd)) {
- PyErr_SetFromErrno(PyExc_IOError);
- }
- else {
_Py_BEGIN_SUPPRESS_IPH
- handle = _get_osfhandle(fd);
+ handle = _get_osfhandle(fd);
_Py_END_SUPPRESS_IPH
- if (handle == -1)
- PyErr_SetFromErrno(PyExc_IOError);
- }
+ if (handle == -1)
+ PyErr_SetFromErrno(PyExc_IOError);
return handle;
}
@@ -540,7 +535,6 @@ PyInit_msvcrt(void)
#endif
/* constants for the crt versions */
- (void)st;
#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
_VC_ASSEMBLY_PUBLICKEYTOKEN);
@@ -566,6 +560,8 @@ PyInit_msvcrt(void)
st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version);
if (st < 0) return NULL;
#endif
+ /* make compiler warning quiet if st is unused */
+ (void)st;
return m;
}