Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

tclobjs

Tohil Tcl objects, tclobjs, are a data type Tohil creates in Python. Tclobjs have gained considerable new power. Among them, they now implement the number protocol.

...

  • tclobjs can now ingest python sets (in addition to lists, tuples, etc, which it already could do.)

Tclobj Shadow Vars

Another new feature, Tclobj shadow vars, t = tohil.tclvar(‘t’), makes t a tclobj that shadows a variable t in the Tcl interpreter. Any changes to the variable from the Tcl side are “seen” from the Python side, and vice versa. The variable can also be an array element.

Tcldicts

  • Tcldict objects now provide many methods that standard Python dicts provide, such as keys(), values(), items(). Because of this, dict(tcldict) now works.

  • The clear() method is now supported to empty the Tcl dict.

  • A new tcldict pop method behaves the same as pop for standard Python dicts, popping the last item in the list if no position is specified, else popping the specified position, i.e. removing it from the list and returning it.

  • A new .insert(i, x) method will insert item x at position i.

ShadowDicts

ShadowDicts implement many additional methods implemented by standard Python dicts.

ShadowDicts now have a get method that behaves as standard dicts do. A new clear method removes all items from the shadow diction, i.e. it unsets the shadowed Tcl array.

Python exception improvements

We now raise more standard Python TypeError, KeyError and ValueError exceptions in places where we used to just raise RuntimeError.

Tohil method improvements and changes

Tohil.unset can now take an arbitrary number of arguments of variable names and array elements to unset, include zero. As before, it is fine to unset something that doesn’t exist.

Testing Improvements

  • Lots of new tests.

  • Also we’re now using the hypothesis testing framework and have found and fixed a number of problems because of it.

  • All tests pass now on 32-bit ARM Linux.

  • Linux CI automated testing using Github Actions

Build Improvements