[New-bugs-announce] [issue35359] [2.7][Windows] Define _CRT_SECURE_NO_WARNINGS to build Modules\zlib\

STINNER Victor report at bugs.python.org
Fri Nov 30 06:57:56 EST 2018


New submission from STINNER Victor <vstinner at redhat.com>:

The compilation of Modules\zlib\ on Python 2.7 emits a lot of warnings: see AppVeyor logs above. I propose to define _CRT_SECURE_NO_WARNINGS in the pythoncore project to make these warnings quiet, to spot more easily new warnings.

Attached PR adds _CRT_SECURE_NO_WARNINGS to Python 2.7 pythoncore project.

In the master branch, the following project also set _CRT_SECURE_NO_WARNINGS:

* PCbuild/_decimal.vcxproj
* PCbuild/_elementtree.vcxproj
* PCbuild/_ssl.vcxproj
* PCbuild/pyexpat.vcxproj

Note: In the master branch, encode_current_locale() of Python/fileutils.c also uses wcstombs(), but no warning is emitted, whereas the C file is compiled by the pythoncore project which doesn't define _CRT_SECURE_NO_WARNINGS.


AppVeyor logs:

[00:01:51] ..\Modules\zlib\gzlib.c(193): warning C4996: 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdlib.h(534) : see declaration of 'wcstombs'
[00:01:51] ..\Modules\zlib\gzlib.c(208): warning C4996: 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdlib.h(534) : see declaration of 'wcstombs'
[00:01:51] ..\Modules\zlib\gzlib.c(214): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf'
[00:01:51] ..\Modules\zlib\gzlib.c(245): warning C4996: '_wopen': This function or variable may be unsafe. Consider using _wsopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(276) : see declaration of '_wopen'
[00:01:51] ..\Modules\zlib\gzlib.c(245): warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(316) : see declaration of 'open'
[00:01:51] ..\Modules\zlib\gzlib.c(296): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf'
[00:01:51] ..\Modules\zlib\gzlib.c(612): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf'
[00:01:51]   gzread.c
[00:01:51] ..\Modules\zlib\gzread.c(35): warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(317) : see declaration of 'read'
[00:01:51] ..\Modules\zlib\gzread.c(41): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror'
[00:01:51] ..\Modules\zlib\gzread.c(651): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(306) : see declaration of 'close'
[00:01:51]   gzwrite.c
[00:01:51] ..\Modules\zlib\gzwrite.c(89): warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(322) : see declaration of 'write'
[00:01:51] ..\Modules\zlib\gzwrite.c(91): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror'
[00:01:51] ..\Modules\zlib\gzwrite.c(110): warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(322) : see declaration of 'write'
[00:01:51] ..\Modules\zlib\gzwrite.c(112): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror'
[00:01:51] ..\Modules\zlib\gzwrite.c(428): warning C4996: 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(350) : see declaration of 'vsnprintf'
[00:01:51] ..\Modules\zlib\gzwrite.c(661): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(306) : see declaration of 'close'

----------
components: Build
messages: 330777
nosy: vstinner
priority: normal
severity: normal
status: open
title: [2.7][Windows] Define _CRT_SECURE_NO_WARNINGS to build Modules\zlib\
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35359>
_______________________________________


More information about the New-bugs-announce mailing list