◐ Shell
reader mode source ↗

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients christian.heimes, hroncok, petr.viktorin, vstinner
Date 2022-01-26.14:29:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643207368.1.0.596605697368.issue46513@roundup.psfhosted.org>
In-reply-to
Content
IMO making the assumption that "char" is signed or not in C code is bad. If Python has code like that, it must be signed to explicitly use one of these types: unsigned char or uint8_t, signed char or int8_t. Hopefully, Python can now use C99 <stdint.h> since Python 3.6.

On my x86-64 Fedora 35 (GCC 11.2.1), the "char" type is signed. I built Python with -funsigned-char and I ran the test suite: the whole test suite pass! Commands:

---
make distclean
./configure --with-pydebug CFLAGS="-O0 -funsigned-char" --with-system-expat --with-system-ffi
make
./python -m test -j0 -r
---

Using ./configure CFLAGS, -funsigned-char is also used to build C extensions. Example: 

   gcc (...) -O0 -funsigned-char (...) Modules/_elementtree.c (...)


For completeness, I also built Python with -fsigned-char. Again, the full test suite passed ;-)

---
make distclean
./configure --with-pydebug CFLAGS="-O0 -fsigned-char" --with-system-expat --with-system-ffi
make
./python -m test -r -j0
---
History
Date User Action Args
2022-01-26 14:29:28vstinnersetrecipients: + vstinner, christian.heimes, petr.viktorin, hroncok
2022-01-26 14:29:28vstinnersetmessageid: <1643207368.1.0.596605697368.issue46513@roundup.psfhosted.org>
2022-01-26 14:29:28vstinnerlinkissue46513 messages
2022-01-26 14:29:28vstinnercreate