cpython: 9291b28157e1 (original) (raw)

--- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -133,9 +133,20 @@ class TclTest(unittest.TestCase): tcl = self.interp self.assertRaises(TclError,tcl.unsetvar,'a')

+ def test_getint(self): tcl = self.interp.tk

@@ -270,7 +281,7 @@ class TclTest(unittest.TestCase): check('"a\xbd\u20ac"', 'a\xbd\u20ac') check(r'"a\xbd\u20ac"', 'a\xbd\u20ac') check(r'"a\0b"', 'a\x00b')

def test_exprdouble(self): @@ -302,7 +313,7 @@ class TclTest(unittest.TestCase): check('[string length "a\xbd\u20ac"]', 3.0) check(r'[string length "a\xbd\u20ac"]', 3.0) self.assertRaises(TclError, tcl.exprdouble, '"abc"')

def test_exprlong(self): @@ -334,7 +345,7 @@ class TclTest(unittest.TestCase): check('[string length "a\xbd\u20ac"]', 3) check(r'[string length "a\xbd\u20ac"]', 3) self.assertRaises(TclError, tcl.exprlong, '"abc"')

def test_exprboolean(self): @@ -375,7 +386,7 @@ class TclTest(unittest.TestCase): check('[string length "a\xbd\u20ac"]', True) check(r'[string length "a\xbd\u20ac"]', True) self.assertRaises(TclError, tcl.exprboolean, '"abc"')

def test_booleans(self): @@ -397,6 +408,21 @@ class TclTest(unittest.TestCase): check('1 < 2', True) check('1 > 2', False)

+ def test_passing_values(self): def passValue(value): return self.interp.call('set', '_', value) @@ -414,8 +440,10 @@ class TclTest(unittest.TestCase): b'str\xc0\x80ing' if self.wantobjects else 'str\xc0\x80ing') self.assertEqual(passValue(b'str\xbding'), b'str\xbding' if self.wantobjects else 'str\xbding')

@@ -475,8 +503,10 @@ class TclTest(unittest.TestCase): check(b'str\x00ing', 'str\x00ing') check(b'str\xc0\x80ing', 'str\xc0\x80ing') check(b'str\xc0\x80ing\xe2\x82\xac', 'str\xc0\x80ing\xe2\x82\xac')

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -16,6 +16,9 @@ Core and Builtins Library ------- +- Issue #16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and

--- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -56,6 +56,11 @@ Copyright (C) 1994 Steen Lumholt. #error "Tk older than 8.4 not supported" #endif +#if TK_VERSION_HEX >= 0x08050000 +#define HAVE_LIBTOMMAMTH +#include <tclTomMath.h> +#endif + #if !(defined(MS_WINDOWS) || defined(CYGWIN)) #define HAVE_CREATEFILEHANDLER #endif @@ -234,6 +239,8 @@ typedef struct { const Tcl_ObjType *ByteArrayType; const Tcl_ObjType *DoubleType; const Tcl_ObjType *IntType;

#define CHECK_STRING_LENGTH(s) #endif +#ifdef HAVE_LIBTOMMAMTH +static Tcl_Obj* +asBignumObj(PyObject *value) +{

+

+} +#endif + static Tcl_Obj* AsObj(PyObject *value) { Tcl_Obj *result;

if (PyBytes_Check(value)) { if (PyBytes_GET_SIZE(value) >= INT_MAX) { @@ -898,18 +944,45 @@ AsObj(PyObject *value) return Tcl_NewByteArrayObj((unsigned char *)PyBytes_AS_STRING(value), (int)PyBytes_GET_SIZE(value)); }

+

+

+#ifdef TCL_WIDE_INT_TYPE

+#endif

+#ifdef TCL_WIDE_INT_TYPE

+#endif

+#ifdef HAVE_LIBTOMMAMTH

+#endif

+

+

@@ -933,7 +1006,8 @@ AsObj(PyObject *value) PyMem_Free(argv); return result; }

+

@@ -983,12 +1057,14 @@ AsObj(PyObject *value) PyMem_Free(outbuf); return result; }

+

+

@@ -1008,6 +1084,60 @@ fromBoolean(PyObject* tkapp, Tcl_Obj va } static PyObject +fromWideIntObj(PyObject* tkapp, Tcl_Obj *value) +{

+#ifdef HAVE_LONG_LONG

+#endif

+} + +#ifdef HAVE_LIBTOMMAMTH +static PyObject* +fromBignumObj(PyObject* tkapp, Tcl_Obj *value) +{

+

+} +#endif + +static PyObject* FromObj(PyObject* tkapp, Tcl_Obj *value) { PyObject result = NULL; @@ -1034,9 +1164,31 @@ FromObj(PyObject tkapp, Tcl_Obj *value) } if (value->typePtr == app->IntType) {

+ +#ifdef HAVE_LIBTOMMAMTH

+#endif + if (value->typePtr == app->ListType) { int size; int i, status; @@ -1084,6 +1236,15 @@ FromObj(PyObject* tkapp, Tcl_Obj *value) } #endif +#ifdef HAVE_LIBTOMMAMTH

+#endif + return newPyTclObject(value); } @@ -1718,7 +1879,8 @@ static PyObject * Tkapp_GetInt(PyObject *self, PyObject *args) { char *s;

if (PyTuple_Size(args) == 1) { PyObject* o = PyTuple_GetItem(args, 0); @@ -1730,9 +1892,24 @@ Tkapp_GetInt(PyObject *self, PyObject *a if (!PyArg_ParseTuple(args, "s:getint", &s)) return NULL; CHECK_STRING_LENGTH(s);

+

+#ifdef HAVE_LIBTOMMAMTH

+#else

+#endif

} static PyObject *