Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a1c7e72

Browse files
committed
Issue #23668: Suppresses invalid parameter handler around chsize calls.
1 parent 8fc8980 commit a1c7e72

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

Modules/_io/fileio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,12 +880,14 @@ fileio_truncate(fileio *self, PyObject *args)
880880
}
881881

882882
Py_BEGIN_ALLOW_THREADS
883+
_Py_BEGIN_SUPPRESS_IPH
883884
errno = 0;
884885
#ifdef MS_WINDOWS
885886
ret = _chsize_s(fd, pos);
886887
#else
887888
ret = ftruncate(fd, pos);
888889
#endif
890+
_Py_END_SUPPRESS_IPH
889891
Py_END_ALLOW_THREADS
890892

891893
if (ret != 0) {

Modules/posixmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8803,11 +8803,13 @@ os_ftruncate_impl(PyModuleDef *module, int fd, Py_off_t length)
88038803

88048804
do {
88058805
Py_BEGIN_ALLOW_THREADS
8806+
_Py_BEGIN_SUPPRESS_IPH
88068807
#ifdef MS_WINDOWS
88078808
result = _chsize_s(fd, length);
88088809
#else
88098810
result = ftruncate(fd, length);
88108811
#endif
8812+
_Py_END_SUPPRESS_IPH
88118813
Py_END_ALLOW_THREADS
88128814
} while (result != 0 && errno == EINTR &&
88138815
!(async_err = PyErr_CheckSignals()));
@@ -8843,6 +8845,7 @@ os_truncate_impl(PyModuleDef *module, path_t *path, Py_off_t length)
88438845
return os_ftruncate_impl(module, path->fd, length);
88448846

88458847
Py_BEGIN_ALLOW_THREADS
8848+
_Py_BEGIN_SUPPRESS_IPH
88468849
#ifdef MS_WINDOWS
88478850
if (path->wide)
88488851
fd = _wopen(path->wide, _O_WRONLY | _O_BINARY | _O_NOINHERIT);
@@ -8859,6 +8862,7 @@ os_truncate_impl(PyModuleDef *module, path_t *path, Py_off_t length)
88598862
#else
88608863
result = truncate(path->narrow, length);
88618864
#endif
8865+
_Py_END_SUPPRESS_IPH
88628866
Py_END_ALLOW_THREADS
88638867
if (result < 0)
88648868
return path_error(path);

0 commit comments

Comments
 (0)