Thomas Wouters wrote:
> - There's no way to figure out the size of a Py_ssize_t from Python
> code, now. test_support was using a simple-slice to figure it out. I'm
> not sure if there's really a reason to do it -- I don't quite understand
> the use of it.
This isn't quite true, but I will admit that the only way I know how to do it
is somewhat on the arcane side ;)
try:
double_width = 2*(sys.maxint+1)**2-1
slice(None).indices(double_width)
pyssize_t_max = double_width # ssize_t twice as wide as long
except OverflowError:
pyssize_t_max = sys.maxint # ssize_t same width as long
It might make more sense to just include a "sys.maxindex" to parallel
sys.maxint (even though both are technically misnomers, leaving out the
'native' bit).
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com