[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument
Paul Campbell added the comment: Victor: The changes in the main branch gets me past this issue without having to make additional changes. -- ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument
Paul Campbell added the comment: > In Python, we are trying to provide a same C API on all platforms. If "struct > stat" is no longer considered as portable, IMO we should attempt to avoid it, > at least in the public C API. Microsoft provides stat and struct stat, but they prepend the names with an underscore. So functions like stat are named _stat and struct stat is named struct _stat, etc. Not sure if pros/cons of using such functions are though. Seems it would go back to depending on some type nonstandard python macro to translate between the two during build. -- ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument
Paul Campbell added the comment: Hi Victor, I was trying to compile with clang on Windows 10. I will try to pull your 3.11 changes and test. Sorry to cause so much churn. It looked to me like a simple issue that was missed, probably because whatever was trying to compile was not normally compiled on Windows. I was not trying to make a lot of work to support a new platform :) -- ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument
Paul Campbell added the comment: I was trying to build python core (-DMS_WINDOWS -DPy_BUILD_CORE). I was using clang, which I think is unsupported looking at Windows doc. After looking at the issue though, it seemed that it was just some slight mistake which is why I filed the bug. clang version 13.0.0 Target: x86_64-pc-windows-msvc Thread model: posix I can test to see if it fixes the immediate build problem, but I still find your fix not quite addressing the issue which I initially tried to create a patch for. Someone has already developed a shim here for Windows and it just was not used properly. `_Py_stat_struct` is a define which either evaluates to `stat` on non-Windows systems or a compatibility structure on Windows. Simply replacing the use of `struct stat` with `struct _Py_stat_struct` should solve the issue. -- ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument
Change by Paul Campbell : -- title: _Py_stat using incorrect type for status argument -> _Py_stat and _Py_wstat using incorrect type for status argument ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46303] _Py_stat using incorrect type for status argument
Change by Paul Campbell : -- keywords: +patch pull_requests: +28681 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30478 ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46303] _Py_stat using incorrect type for status argument
Change by Paul Campbell : -- components: +Build, Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware type: -> compile error ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46303] _Py_stat using incorrect type for status argument
New submission from Paul Campbell : While attempting to embed the full cpython source in my application, I found that during compilation on Windows, there was a compilation issue due to struct stat not being defined. Taking a look at the file cpython/fileutils.h, it seems that the type of the status argument should be _Py_stat_struct instead of just stat to satisfy compilation for all supported platforms. -- messages: 410073 nosy: pacampbell priority: normal severity: normal status: open title: _Py_stat using incorrect type for status argument versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue46303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com