This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jackjansen
Recipients
Date 2003-05-18.21:22:20
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=45365

Martin, I'm assigning back to you, because I'm out of my water here. I 
discussed this problem with the MacTcl people, and it seems that what was 
checked in in _tkinter.c for patch 518625 is not correct: if something is 
initialized as a string in Tcl and then some code accesses it as a float the 
internal float representation will be created automatically. In other words:
the FromObj() code attempts to graft Python semantics on Tcl objects, which 
is prone to obscure errors.

Here are some excerpts from relevant mail messages:

-------------

From Jim Ingham:
tcl_version is created as a string variable with the value "8.2".  If somebody 
tried to do some math with it (like evaluate expr $tcl_version <= 8.4 or 
something) then Tcl would set the internal representation to a float.  I don't 
see any place where we are doing that, but maybe your Tkinter code does 
that to check something on Mac OS X?

Anyway that would not be an error on Tcl's part.  If you want tcl_version in 
Python explicitly as a string, you need to make sure the string representation 
exists, and then get the variable as a string.  You can't rely on their being or 
not being any particular internal representation.

------------------

And from Benjamin Riefenstahl:
Well, somebody may already have told you that, but that's not how Tcl
works.  In Tcl *all* values are strings.  You use
Tcl_GetStringFromObj() to get that value.  That's it.  If you want a
floating point, you explicitly *convert* by using
Tcl_GetDoubleFromObj().

Everything you see related to "types" is just internal speed
optimizations to avoid double conversions.  These internal
representations come and go at the whim of the implementation.
Accessing these infos without the official APIs will lead to errors
and inconsistent behaviour, as you have seen.  The details of the
behaviour will also quite likely change from Tcl version to Tcl
version.
---------------
History
Date User Action Args
2007-08-23 14:12:55adminlinkissue729317 messages
2007-08-23 14:12:55admincreate