Repository navigation
build.bat --tail-call-interp and errors/warnings in socketmodule #145929
Copy link
Copy link
Closed
Labels
OS-unsupportedOS-windowsbuildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Running build.bat --tail-call-interp ... leads to 1 error and 10 warnings about "Modules\socketmodule.c" and "Modules\socketmodule.h".
- The build fails due to 1 error in "Modules\socketmodule.c."
- "\Modules\socketmodule.c" leads to 4
warning : ... is deprecatedstatements. - "\Modules\socketmodule.h" leads to 5
warning : the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] [C:\Users\hunte\AppData\Local\cpython\PCbuild\FILE.vcxproj]statements, where "FILE" is _freeze_module, _socket, or pythoncore. - The build succeeds if in "Modules\socketmodule.c," I change line 3375 from
int dummy;toDWORD dummy;.
Details
- Source files: github/python/cpython/3.14
- Command
build.bat --pgo --tail-call-interp "/p:PlatformToolset=ClangCL" "/p:LLVMInstallDir=%pathCLang%" "/p:LLVMToolsVersion=%LLVMToolsVersion%" "/p:WholeProgramOptimization=true". - Both
build.bat -dandbuild.bat, with the same source files, lead to 1 Warning and 0 Errorsc:\clones\cpython\Modules\unicodedata.c(1478,62): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data [c:\clones\cpython\PCbuild\unicodedata.vcxproj]. - In total,
build.bat --tail-call-interp ...leads to 715 warnings and 1 error.- No other errors or warnings refer to a "
*.c" or "*.h" file. - One warning states
C:\Users\hunte\AppData\Local\cpython\PCbuild\pythoncore.vcxproj(720,5): warning : Toolset ClangCL is not used for official builds. Your build may have errors or incompatibilities. - All other warnings state
clang-cl : warning : argument unused during compilation: '/GL' [-Wunused-command-line-argument] [PATHto\cpython\PCbuild\FILE.vcxproj], where "FILE" is one of exactly 45 different names. I think there are 55 "*.vcxproj" files in the directory.
- No other errors or warnings refer to a "
The 1 error and 10 warnings about "Modules\socketmodule.c" and "Modules\socketmodule.h"
..\Modules\socketmodule.c(3377,51): error : incompatible pointer types passing 'int *' to parameter of type 'LPDWORD' (aka 'unsigned long *') [-Wincompatible-pointer-types] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_socket.vcxproj]
..\Modules\socketmodule.c(6208,9): warning : 'gethostbyname' is deprecated: Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings [-Wdeprecated-declarations] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_socket.vcxproj]
..\Modules\socketmodule.c(6313,9): warning : 'gethostbyaddr' is deprecated: Use getnameinfo() or GetNameInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings [-Wdeprecated-declarations] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_socket.vcxproj]
..\Modules\socketmodule.c(6731,23): warning : 'inet_addr' is deprecated: Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings [-Wdeprecated-declarations] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_socket.vcxproj]
..\Modules\socketmodule.c(6775,33): warning : 'inet_ntoa' is deprecated: Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings [-Wdeprecated-declarations] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_socket.vcxproj]
..\Modules\socketmodule.h(21,11): warning : the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_freeze_module.vcxproj]
..\Modules\socketmodule.h(21,11): warning : the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_socket.vcxproj]
..\Modules\socketmodule.h(21,11): warning : the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] [C:\Users\hunte\AppData\Local\cpython\PCbuild\pythoncore.vcxproj]
..\Modules\socketmodule.h(53,11): warning : the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_freeze_module.vcxproj]
..\Modules\socketmodule.h(53,11): warning : the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] [C:\Users\hunte\AppData\Local\cpython\PCbuild\_socket.vcxproj]
..\Modules\socketmodule.h(53,11): warning : the current #pragma pack alignment value is modified in the included file [-Wpragma-pack] [C:\Users\hunte\AppData\Local\cpython\PCbuild\pythoncore.vcxproj]
Success
- In "Modules\socketmodule.c," I changed line 3375 from
int dummy;toDWORD dummy;. - Rerun the build script.
- 547 Warnings and 0 Errors.
There are a few different file names between uniqueWarningsBefore.txt and uniqueWarningsAfter.txt if you think it's important.
Information you can almost certainly ignore.
Environment
Microsoft Windows [Version 10.0.26200.8037]
curl 8.18.0 (Windows) libcurl/8.18.0 Schannel zlib/1.3.1 WinIDN WinLDAP
clang version 22.1.1 (https://github.com/llvm/llvm-project fef02d48c08db859ef83f84232ed78bd9d1c323a)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\clones\clang_msvc\bin
Python 3.14.3 (tags/v3.14.3:323c59a, Feb 3 2026, 16:04:56) [MSC v.1944 64 bit (AMD64)]
My batch files to build and install tail-call-interp
_variables.cmd
SET path314raw=%LOCALAPPDATA%\cpythongo.cmd
@ECHO OFF
CALL C:\apps\Z0Z_\buildPython\_variables.cmd
:: LLVM clang version
SET pathCLang=C:\clones\clang_msvc
SET URLreleases=https://github.com/llvm/llvm-project/releases
FOR /F "tokens=3" %%G IN ('%pathCLang%\bin\clang.exe --version ^| findstr clang') DO SET versionLLVM=%%G
FOR /F "delims=" %%G IN ('curl -L -s -o NUL -w "%%{url_effective}" "%URLreleases%/latest"') DO SET URLlatest=%%G
FOR /F "tokens=7 delims=/" %%G IN ("%URLlatest%") DO SET LLVMdirectory=%%G
SET "versionLLVMlatest=%LLVMdirectory:llvmorg-=%"
IF NOT "%versionLLVM%"=="%versionLLVMlatest%" (
IF NOT EXIST %pathCLang% MKDIR %pathCLang%
SET pathRelativeLLVM=clang+llvm-%versionLLVMlatest%-x86_64-pc-windows-msvc
SET filename_tar=%pathRelativeLLVM%.tar
SET filename_xz=%filename_tar%.xz
curl -L "%URLreleases%/download/%LLVMdirectory%/%filename_xz%" -o "%pathCLang%\%filename_xz%"
CALL 7z x -aoa "-o%pathCLang%" "%pathCLang%\%filename_xz%"
CALL 7z x -aoa "-o%pathCLang%" "%pathCLang%\%filename_tar%" "%pathRelativeLLVM%\*"
ROBOCOPY %pathCLang%\%pathRelativeLLVM% %pathCLang% /MOVE /E /NJH /NDL /NFL
DEL %pathCLang%\%filename_tar%
DEL %pathCLang%\%filename_xz%
)
%pathCLang%\bin\clang.exe --version
:: github/python/cpython/3.14 sync
PUSHd %path314raw%
CALL git checkout 3.14
CALL git pull
POPd
:: PCbuild\build.bat
PUSHd "%path314raw%\PCbuild"
FOR /F "tokens=1 delims=." %%G IN ("%versionLLVMlatest%") DO SET LLVMToolsVersion=%%G
CALL build.bat --pgo --tail-call-interp "/p:PlatformToolset=ClangCL" "/p:LLVMInstallDir=%pathCLang%" ^
"/p:LLVMToolsVersion=%LLVMToolsVersion%" "/p:WholeProgramOptimization=true"
@REM -Wno-unused-command-line-argument
POPdregedit_copyFiles.cmd
@ECHO OFF
CALL C:\apps\Z0Z_\buildPython\_variables.cmd
SET z=z
SET path314zCompiled=%path314raw%\PCbuild\amd64
SET path314zInstalled=%LOCALAPPDATA%\Programs\Python\Python314
COPY /Y "%path314zCompiled%\python.exe" "%path314zInstalled%\python3.14%z%.exe"
COPY /Y "%path314zCompiled%\python.pdb" "%path314zInstalled%\python3.14%z%.pdb"
COPY /Y "%path314zCompiled%\pythonw.exe" "%path314zInstalled%\pythonw3.14%z%.exe"
COPY /Y "%path314zCompiled%\pythonw.pdb" "%path314zInstalled%\pythonw3.14%z%.pdb"
COPY /Y "%path314zCompiled%\python3.*" "%path314zInstalled%\python3%z%.*"
COPY /Y "%path314zCompiled%\python314.*" "%path314zInstalled%\python314%z%.*"
MOVE /Y "%path314zInstalled%\*.lib" "%path314zInstalled%\libs\"
"%path314zInstalled%\python3.14%z%.exe" -VV
SET "keyRoot=HKCU\Software\Python\PythonCore\3.14%z%"
REG ADD "%keyRoot%" /F /T REG_SZ /V DisplayName /D "Python 3.14 (64-bit, tail-call interpreter)"
REG ADD "%keyRoot%" /F /T REG_SZ /V SupportUrl /D "https://www.python.org/"
REG ADD "%keyRoot%" /F /T REG_SZ /V Version /D "3.14"
REG ADD "%keyRoot%" /F /T REG_SZ /V SysVersion /D "3.14"
REG ADD "%keyRoot%" /F /T REG_SZ /V SysArchitecture /D "64bit"
REG ADD "%keyRoot%\InstallPath" /F /T REG_SZ /VE /D %path314zInstalled%\
REG ADD "%keyRoot%\InstallPath" /F /T REG_SZ /V ExecutablePath /D "%path314zInstalled%\python3.14%z%.exe"
REG ADD "%keyRoot%\InstallPath" /F /T REG_SZ /V WindowedExecutablePath /D "%path314zInstalled%\pythonw3.14%z%.exe"
REG ADD "%keyRoot%\PythonPath" /F /T REG_SZ /VE /D %path314zInstalled%\Lib\;%path314zInstalled%\DLLs\
py -0p
45 filenames with warning about unused /GL
_asyncio.vcxproj
_bz2.vcxproj
_ctypes_test.vcxproj
_ctypes.vcxproj
_decimal.vcxproj
_elementtree.vcxproj
_freeze_module.vcxproj
_hashlib.vcxproj
_lzma.vcxproj
_multiprocessing.vcxproj
_overlapped.vcxproj
_queue.vcxproj
_remote_debugging.vcxproj
_socket.vcxproj
_sqlite3.vcxproj
_testbuffer.vcxproj
_testcapi.vcxproj
_testclinic_limited.vcxproj
_testclinic.vcxproj
_testconsole.vcxproj
_testembed.vcxproj
_testimportmultiple.vcxproj
_testinternalcapi.vcxproj
_testlimitedcapi.vcxproj
_testmultiphase.vcxproj
_testsinglephase.vcxproj
_tkinter.vcxproj
_uuid.vcxproj
_wmi.vcxproj
_zoneinfo.vcxproj
_zstd.vcxproj
liblzma.vcxproj
pyexpat.vcxproj
pylauncher.vcxproj
pyshellext.vcxproj
python3dll.vcxproj
pythoncore.vcxproj
pywlauncher.vcxproj
select.vcxproj
sqlite3.vcxproj
unicodedata.vcxproj
venvlauncher.vcxproj
venvwlauncher.vcxproj
winsound.vcxproj
zlib-ng.vcxproj
55 "`*.vcxproj`" files in PCBuild directory
_asyncio.vcxproj
_bz2.vcxproj
_ctypes_test.vcxproj
_ctypes.vcxproj
_decimal.vcxproj
_elementtree.vcxproj
_freeze_module.vcxproj
_hashlib.vcxproj
_lzma.vcxproj
_multiprocessing.vcxproj
_overlapped.vcxproj
_queue.vcxproj
_remote_debugging.vcxproj
_socket.vcxproj
_sqlite3.vcxproj
_ssl.vcxproj
_testbuffer.vcxproj
_testcapi.vcxproj
_testclinic_limited.vcxproj
_testclinic.vcxproj
_testconsole.vcxproj
_testembed.vcxproj
_testimportmultiple.vcxproj
_testinternalcapi.vcxproj
_testlimitedcapi.vcxproj
_testmultiphase.vcxproj
_testsinglephase.vcxproj
_tkinter.vcxproj
_uuid.vcxproj
_wmi.vcxproj
_zoneinfo.vcxproj
_zstd.vcxproj
liblzma.vcxproj
openssl.vcxproj
pyexpat.vcxproj
pylauncher.vcxproj
pyshellext.vcxproj
python_uwp.vcxproj
python.vcxproj
python3dll.vcxproj
pythoncore.vcxproj
pythonw_uwp.vcxproj
pythonw.vcxproj
pywlauncher.vcxproj
select.vcxproj
sqlite3.vcxproj
tcl.vcxproj
tk.vcxproj
unicodedata.vcxproj
venvlauncher.vcxproj
venvwlauncher.vcxproj
winsound.vcxproj
xxlimited_35.vcxproj
xxlimited.vcxproj
zlib-ng.vcxproj
10 files in directory that didn't have unused /GL warning
_ssl.vcxproj
openssl.vcxproj
python_uwp.vcxproj
python.vcxproj
pythonw_uwp.vcxproj
pythonw.vcxproj
tcl.vcxproj
tk.vcxproj
xxlimited_35.vcxproj
xxlimited.vcxproj
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OS-unsupportedOS-windowsbuildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
Fidget-Spinner commentedon Mar 14, 2026
Building with clangcl is undocumented and also generally unsupported :(. @chris-eibl has generally made the process pretty smooth, but even then we officially still do not support it.
chris-eibl commentedon Mar 14, 2026
See #131296. I've fixed all of the warnings back then, but a few PRs weren't merged before the 3.14 release and not backported. Main is warning-free 🚀 .
Fidget-Spinner commentedon Mar 14, 2026
Ok, that's pretty good news for 3.15 and clangcl. I don't think we can backport the fixes to 3.14 as it's an unsupported platform, though I forgot the exact policy for that so I may be wrong.
chris-eibl commentedon Mar 14, 2026
These are due to
"/p:WholeProgramOptimization=true", which results in the compiler option/GLthat clang-cl does not support. Its equivalent is -flto, but you do not need to specify it, because it is used automatically for non-debug builds.chris-eibl commentedon Mar 14, 2026
It seems, that newer clang versions issue an error instead of just a warning for
@zooba: So we might consider backporting just #131821?
@hunterhogan : as a stop-gap, you can use LLVM <= 21, which just issues a warning.
hunterhogan commentedon Mar 14, 2026
Summary of current status
incompatible pointer typesfrom "socketmodule.c".DWORD dummy.int dummy.int dummytoDWORD dummy.... is deprecated ....--tail-call-interpis undocumented.--tail-call-interpis undocumented."... #pragma pack ....argument unused during compilation: '/GL'."/p:PlatformToolset=ClangCL", do not use the option"/p:WholeProgramOptimization=true".warning : Toolset ClangCL is not used for official builds. Your build may have errors or incompatibilities.Information you can probably ignore
I ran
build.bat --tail-call-interpwith branch "3.14" and three versions of "socketmodule.c". I did not use"/p:WholeProgramOptimization=true". After @chris-eibl commented about "socketmodule.h", I ran a fourth build.My new batch file for building 3.14
"socketmodule.c" unchanged
11 Warnings 1 Error
"socketmodule.c"
inttoDWORDUnlike my original post, I did not sort the warnings/errors in this post. I think it is interesting that the order of the messages is slightly different and that a couple of files are different. I probably think it's interesting because I'm a n00b.
11 Warnings 0 Errors
"socketmodule.c" with the changes from #131821
https://github.com/hunterhogan/cpython/blob/e878cca61bc1341db912b0106272221afd5d29fa/Modules/socketmodule.c
7 Warnings 0 Errors
"socketmodule.c" and "socketmodule.h" with the changes from #131821 and #131832
https://github.com/hunterhogan/cpython/blob/902adb794259cc6f79a4376a41515b60c3d9c76c/Modules/socketmodule.h
1 Warning 0 Errors
chris-eibl commentedon Mar 14, 2026
was fixed in #131832 on main.
zooba commentedon Mar 16, 2026
Seems harmless enough. Double check that the other macro changes only impact pragmas/warnings, or leave them out and just backport the
DWORD.chris-eibl commentedon Mar 16, 2026
The
_Py_COMP_DIAG_PUSH,_Py_COMP_DIAG_IGNORE_DEPR_DECLSand_Py_COMP_DIAG_POPmacroscpython/Include/pyport.h
Lines 298 to 317 in 4e96282
are fine. IMHO, #131821 is safe to backport ...
chris-eibl commentedon Mar 16, 2026
Likewise, #131832 would be safe, too, since it is a change only visble to clang-cl:
ifdef __clang__in anMS_WINDOWScode path ...zooba commentedon Mar 16, 2026
Yeah, they both look fine (FWIW, the criteria here is that we aren't obliged to backport fixes for unsupported platforms/compilers, but can choose to if they are safe enough for the supported platforms and there's demand for them).
chris-eibl commentedon Mar 23, 2026
Triggered backport for both PRs and cc'ed @hugovk as the 3.14 release manager.