[issue27097] ceval: Wordcode follow up, explicit unsigned short read

STINNER Victor report at bugs.python.org
Wed May 25 02:58:51 EDT 2016


STINNER Victor added the comment:

Antti Haapala:
> However what I'd prefer here as the size of the type is important, to use `uint16_t` or typedef instead of just `unsigned short`, which is a statemeent that the value must be at least "2 bytes wide".

I'm not aware of a platform where sizeof(unsigned short) is not *exactly* 16-bits. At least, no platform supported by CPython.

Include/unicodeobject.h is quite explicit:

#if SIZEOF_SHORT == 2
typedef unsigned short Py_UCS2;
#else
#error "Could not find a proper typedef for Py_UCS2"
#endif

Maybe we should use a similar code in ceval.c?

#if SIZEOF_SHORT != 2
#  error "Could not find a proper type for 16-bit pointer"
#endif

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27097>
_______________________________________


More information about the Python-bugs-list mailing list