@@ -111,7 +111,9 @@ msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes)
111
111
int err ;
112
112
113
113
Py_BEGIN_ALLOW_THREADS
114
+ _Py_BEGIN_SUPPRESS_IPH
114
115
err = _locking (fd , mode , nbytes );
116
+ _Py_END_SUPPRESS_IPH
115
117
Py_END_ALLOW_THREADS
116
118
if (err != 0 )
117
119
return PyErr_SetFromErrno (PyExc_IOError );
@@ -138,7 +140,9 @@ static long
138
140
msvcrt_setmode_impl (PyObject * module , int fd , int flags )
139
141
/*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/
140
142
{
143
+ _Py_BEGIN_SUPPRESS_IPH
141
144
flags = _setmode (fd , flags );
145
+ _Py_END_SUPPRESS_IPH
142
146
if (flags == -1 )
143
147
PyErr_SetFromErrno (PyExc_IOError );
144
148
@@ -165,7 +169,9 @@ msvcrt_open_osfhandle_impl(PyObject *module, Py_intptr_t handle, int flags)
165
169
{
166
170
int fd ;
167
171
172
+ _Py_BEGIN_SUPPRESS_IPH
168
173
fd = _open_osfhandle (handle , flags );
174
+ _Py_END_SUPPRESS_IPH
169
175
if (fd == -1 )
170
176
PyErr_SetFromErrno (PyExc_IOError );
171
177
@@ -189,16 +195,11 @@ msvcrt_get_osfhandle_impl(PyObject *module, int fd)
189
195
{
190
196
Py_intptr_t handle = -1 ;
191
197
192
- if (!_PyVerify_fd (fd )) {
193
- PyErr_SetFromErrno (PyExc_IOError );
194
- }
195
- else {
196
198
_Py_BEGIN_SUPPRESS_IPH
197
- handle = _get_osfhandle (fd );
199
+ handle = _get_osfhandle (fd );
198
200
_Py_END_SUPPRESS_IPH
199
- if (handle == -1 )
200
- PyErr_SetFromErrno (PyExc_IOError );
201
- }
201
+ if (handle == -1 )
202
+ PyErr_SetFromErrno (PyExc_IOError );
202
203
203
204
return handle ;
204
205
}
@@ -308,7 +309,9 @@ static PyObject *
308
309
msvcrt_putch_impl (PyObject * module , char char_value )
309
310
/*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/
310
311
{
312
+ _Py_BEGIN_SUPPRESS_IPH
311
313
_putch (char_value );
314
+ _Py_END_SUPPRESS_IPH
312
315
Py_RETURN_NONE ;
313
316
}
314
317
@@ -325,7 +328,9 @@ static PyObject *
325
328
msvcrt_putwch_impl (PyObject * module , int unicode_char )
326
329
/*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/
327
330
{
331
+ _Py_BEGIN_SUPPRESS_IPH
328
332
_putwch (unicode_char );
333
+ _Py_END_SUPPRESS_IPH
329
334
Py_RETURN_NONE ;
330
335
331
336
}
@@ -347,7 +352,13 @@ static PyObject *
347
352
msvcrt_ungetch_impl (PyObject * module , char char_value )
348
353
/*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/
349
354
{
350
- if (_ungetch (char_value ) == EOF )
355
+ int res ;
356
+
357
+ _Py_BEGIN_SUPPRESS_IPH
358
+ res = _ungetch (char_value );
359
+ _Py_END_SUPPRESS_IPH
360
+
361
+ if (res == EOF )
351
362
return PyErr_SetFromErrno (PyExc_IOError );
352
363
Py_RETURN_NONE ;
353
364
}
@@ -365,7 +376,13 @@ static PyObject *
365
376
msvcrt_ungetwch_impl (PyObject * module , int unicode_char )
366
377
/*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/
367
378
{
368
- if (_ungetwch (unicode_char ) == WEOF )
379
+ int res ;
380
+
381
+ _Py_BEGIN_SUPPRESS_IPH
382
+ res = _ungetwch (unicode_char );
383
+ _Py_END_SUPPRESS_IPH
384
+
385
+ if (res == WEOF )
369
386
return PyErr_SetFromErrno (PyExc_IOError );
370
387
Py_RETURN_NONE ;
371
388
}
@@ -387,7 +404,13 @@ static long
387
404
msvcrt_CrtSetReportFile_impl (PyObject * module , int type , int file )
388
405
/*[clinic end generated code: output=df291c7fe032eb68 input=bb8f721a604fcc45]*/
389
406
{
390
- return (long )_CrtSetReportFile (type , (_HFILE )file );
407
+ long res ;
408
+
409
+ _Py_BEGIN_SUPPRESS_IPH
410
+ res = (long )_CrtSetReportFile (type , (_HFILE )file );
411
+ _Py_END_SUPPRESS_IPH
412
+
413
+ return res ;
391
414
}
392
415
393
416
/*[clinic input]
@@ -408,7 +431,9 @@ msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode)
408
431
{
409
432
int res ;
410
433
434
+ _Py_BEGIN_SUPPRESS_IPH
411
435
res = _CrtSetReportMode (type , mode );
436
+ _Py_END_SUPPRESS_IPH
412
437
if (res == -1 )
413
438
PyErr_SetFromErrno (PyExc_IOError );
414
439
return res ;
@@ -429,7 +454,13 @@ static long
429
454
msvcrt_set_error_mode_impl (PyObject * module , int mode )
430
455
/*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/
431
456
{
432
- return _set_error_mode (mode );
457
+ long res ;
458
+
459
+ _Py_BEGIN_SUPPRESS_IPH
460
+ res = _set_error_mode (mode );
461
+ _Py_END_SUPPRESS_IPH
462
+
463
+ return res ;
433
464
}
434
465
#endif /* _DEBUG */
435
466
@@ -448,7 +479,10 @@ msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode)
448
479
{
449
480
unsigned int res ;
450
481
482
+ _Py_BEGIN_SUPPRESS_IPH
451
483
res = SetErrorMode (mode );
484
+ _Py_END_SUPPRESS_IPH
485
+
452
486
return PyLong_FromUnsignedLong (res );
453
487
}
454
488
0 commit comments