STINNER Victor <vstin...@python.org> added the comment:

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
---

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46513>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to