cpython: a6f4d8fa7ab8 (original) (raw)

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

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

@@ -270,7 +283,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 +315,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 +347,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 +388,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 +410,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 +442,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')

@@ -473,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 @@ -24,6 +24,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 @@ -69,6 +69,11 @@ Copyright (C) 1994 Steen Lumholt. #error "Tk older than 8.3.1 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 @@ -247,6 +252,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)) return Tcl_NewByteArrayObj((unsigned char *)PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));

+

+

+#ifdef TCL_WIDE_INT_TYPE

+#endif

+#ifdef TCL_WIDE_INT_TYPE

+#endif

+#ifdef HAVE_LIBTOMMAMTH

+#endif

+

+

@@ -916,7 +989,8 @@ AsObj(PyObject *value) ckfree(FREECAST argv); return result; }

+

@@ -966,12 +1040,14 @@ AsObj(PyObject *value) ckfree(FREECAST outbuf); return result; }

+

+

@@ -990,6 +1066,62 @@ fromBoolean(PyObject* tkapp, Tcl_Obj va return PyBool_FromLong(boolValue); } +#ifdef TCL_WIDE_INT_TYPE +static PyObject +fromWideIntObj(PyObject* tkapp, Tcl_Obj *value) +{

+#ifdef HAVE_LONG_LONG

+#endif

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

+

+} +#endif + static PyObject* FromObj(PyObject* tkapp, Tcl_Obj value) { @@ -1017,9 +1149,33 @@ FromObj(PyObject tkapp, Tcl_Obj *value) } if (value->typePtr == app->IntType) {

+#endif + +#ifdef HAVE_LIBTOMMAMTH

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

+#endif + return newPyTclObject(value); } @@ -1700,7 +1865,12 @@ static PyObject * Tkapp_GetInt(PyObject *self, PyObject *args) { char *s;

+#if defined(TCL_WIDE_INT_TYPE) || defined(HAVE_LIBTOMMAMTH)

+#else

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

+#if defined(TCL_WIDE_INT_TYPE) || defined(HAVE_LIBTOMMAMTH)

+

+#ifdef HAVE_LIBTOMMAMTH

+#else

+#endif

+#else

+#endif

} static PyObject *