Ma Lin <malin...@163.com> added the comment: > What's about other OS/flags? > Should we commit that every exposed socket flag is supported in runtime? > It looks like very heavy burden.
Let alone run-time check. Flags only depend on .C code and the building SDK, therefore, for a certain official release (e.g. CPython 3.6.5), the flags are fixed. Then it is possible to get a flag-snapshot of a certain official release. I wrote a script to dump/compare these flags in some Windows related modules (written in C language), see attached file winsdk_watchdog.py. Let me demonstrate how to use it: > Comparing from A to B: > A: 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] > B: 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] > > socket added 2 constants: {'TCP_KEEPCNT', 'TCP_FASTOPEN'} > > Finished, 1 modules changed constants. Comparing official 3.6.3 (1607 SDK) with official 3.6.4 (1703 SDK). It caught the 2 flags lead to this issue. > Comparing from A to B: > A: 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] > B: 3.7.0b1 (v3.7.0b1:9561d7f, Jan 31 2018, 07:26:34) [MSC v.1900 64 bit > (AMD64)] > > _winapi added 15 constants: {'NORMAL_PRIORITY_CLASS', 'FILE_TYPE_DISK', > 'IDLE_PRIORITY_C > LASS', 'CREATE_DEFAULT_ERROR_MODE', 'CREATE_BREAKAWAY_FROM_JOB', > 'FILE_TYPE_PIPE', 'FILE > _TYPE_REMOTE', 'BELOW_NORMAL_PRIORITY_CLASS', 'DETACHED_PROCESS', > 'FILE_TYPE_CHAR', 'REA > LTIME_PRIORITY_CLASS', 'FILE_TYPE_UNKNOWN', 'ABOVE_NORMAL_PRIORITY_CLASS', > 'CREATE_NO_WI > NDOW', 'HIGH_PRIORITY_CLASS'} > > socket added 3 constants: {'TCP_KEEPIDLE', 'TCP_KEEPINTVL', 'MSG_ERRQUEUE'} > > mmap added 1 constants: {'ACCESS_DEFAULT'} > > Finished, 3 modules changed constants. Comparing official 3.6.4 (1703 SDK) with official 3.7.0b1 (1709 SDK). _winapi added 15 constants, after searching on GitHub repository, we know they were added in 2 commits: https://github.com/python/cpython/commit/b5d9e0811463f3b28ba355a9e0bee7f1682854e3#diff-c5f7cb301f3746a4c77e8bcd91d9f897 https://github.com/python/cpython/commit/b2a6083eb0384f38839d3f1ed32262a3852026fa#diff-c5f7cb301f3746a4c77e8bcd91d9f897 So they can be ignored. socket added 3 constants. After exploring, we know the 2 flags (TCP_KEEPIDLE, TCP_KEEPINTVL) were added by 1709 SDK, so we need to handle them during run-time as well. Another new flag MSG_ERRQUEUE was also added by 1709 SDK, we need a socket expert decide what to do. mmap added 1 constants. It was added in: https://github.com/python/cpython/commit/5a8a84b34fbc385bf112819fe3b65503e33a33fa#diff-a8a9c2d912381058181c8ffe496aa39b Also ignore it. This check is only needed after switching to a newer Windows SDK. As the file name, it's a watchdog of Windows SDK. Some people build third-party-build by themselves, it's also possible to create a unittest, and teach it how to recognize flexible-flags (may be removed during run-time). For example, a man builds CPython 3.7.0b1 with 1607 SDK (official 3.7.0b1 build with 1709 SDK), then he got a prompt like this: > These flags are missing in socket module: > 'TCP_KEEPCNT', 'TCP_FASTOPEN', 'TCP_KEEPIDLE', 'TCP_KEEPINTVL', 'MSG_ERRQUEUE' > Maybe you are using a older SDK than official release's, or these flags are > removed in this machine during run-time. If he build CPython 3.7.0b1 with 1903 SDK in two years later, he may got prompt like this: > Unknown flags appear in socket module: > 'TCP_XXXXXX', 'TCP_YYYYYY', 'TCP_ZZZZZZ' > They were added by newer Windows SDK, please make sure.... ---------- Added file: https://bugs.python.org/file47431/winsdk_watchdog.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32394> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com