◐ Shell
clean mode source ↗

Message 178815 - Python tracker

A long time Tcl got support first 64-bit integers, and then arbitrary size integers. Python also supports arbitrary size integers. However Tkinter supports only C long integers. For example, on 32-bit platform:

>>> import tkinter
>>> t = tkinter.Tk()
>>> t.tk.call('expr', 2**30)
1073741824
>>> t.tk.call('expr', 2**31)
<wideInt object at 0x9122518>
>>> t.tk.call('expr', 2**63)
<bignum object at 0x9126010>

Those <wideInt object> and <bignum object> are not usable from Python. Potentially this can cause errors in some rare circumstances.

I'm working on a patch, but was faced with a problem. Tcl provides functions for conversions between Bignum Tcl object and mp_int, but it does not provide all functions for conversions between mp_int and bytes sequence. Which is better, add libtommath library to CPython dependencies, or implement the missing functionality manually? Or may be use haxadecimal representation for conversions?