[New-bugs-announce] [issue16840] Tkinter doesn't support large integers

Serhiy Storchaka report at bugs.python.org
Wed Jan 2 16:09:13 CET 2013

New submission from Serhiy Storchaka:

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

assignee: serhiy.storchaka
components: Tkinter
messages: 178815
nosy: gpolo, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Tkinter doesn't support large integers
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list