simon-git: spigot (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sun Oct 8 19:40:07 BST 2017
TL;DR:
0d82070 Python: mark the PRINTF_* flag family as private.
a0d26be Python __format__: fix mishandling of the '0' flag.
e951eff Stop trying to mimic Python's default float precision.
85fa459 Python: add some missing exception handlers.
dcc9a11 Python: separate test from demo programs.
Repository: https://git.tartarus.org/simon/spigot.git
On the web: https://git.tartarus.org/?p=simon/spigot.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2017-10-08 19:40:07
commit 0d820703584e565d6fd458bf7f41a82e62124cd1
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=0d820703584e565d6fd458bf7f41a82e62124cd1;hp=766dd495b08ec5650365660e6ae30d34caeb449d
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Oct 8 17:06:20 2017 +0100
Python: mark the PRINTF_* flag family as private.
They're not intended as part of the external API that client code will
use; they're an internal implementation detail between the Python and
C halves of the spigot module itself. So they should be named with the
usual underscore prefix, to reflect that.
python/pyspig.cpp | 5 ++++-
python/spig/__init__.py | 14 +++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)
commit a0d26be54cc56411c7f1f24639af8504ba81f120
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=a0d26be54cc56411c7f1f24639af8504ba81f120;hp=0d820703584e565d6fd458bf7f41a82e62124cd1
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Oct 8 17:44:55 2017 +0100
Python __format__: fix mishandling of the '0' flag.
When no pure-alignment specifier (i.e. one of the <^>= chars) was
given, I was setting the alignment to the usual default of '>', rather
than leaving it at None so that the default could be decided later on
once we knew if we'd got the convenience '0' flag. So '0' failed to
set the alignment to '='.
python/spig/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit e951effc8a94d1b52c597ea1ec5745276811f4a8
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=e951effc8a94d1b52c597ea1ec5745276811f4a8;hp=a0d26be54cc56411c7f1f24639af8504ba81f120
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Oct 8 18:06:36 2017 +0100
Stop trying to mimic Python's default float precision.
Turns out Python 2 and 3 disagree on it. In fact, P3 doesn't even seem
to be choosing a fixed number of digits, in that "{}".format(4.0/3.0)
and "{}".format(math.pi) come out at different lengths. I suspect it's
doing something clever in IEEE terms, outputting just enough digits to
make the value unambiguous. But that's certainly not something I want
to mimic in spigot, because it's a meaningless concept anyway. So I
might as well just abandon the attempt to match Python floats, and
pick my own precision. 20 seems like a good number of digits - it's
just enough to make the point that this is better than floats :-)
python/spig/__init__.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
commit 85fa4595234195fc9ec1b784ba11f7913c09c1dd
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=85fa4595234195fc9ec1b784ba11f7913c09c1dd;hp=e951effc8a94d1b52c597ea1ec5745276811f4a8
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Oct 8 19:19:02 2017 +0100
Python: add some missing exception handlers.
Functions that retrieve data from an already-formatting spigot were
not prepared for it to throw a late-breaking spigot_error due to
having belatedly discovered a domain error, so they weren't catching
the C++ exception and converting it correctly into a Python one.
python/pyspig.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
commit dcc9a11f3d64a5657be92a94328a1316ded50b9c
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=dcc9a11f3d64a5657be92a94328a1316ded50b9c;hp=85fa4595234195fc9ec1b784ba11f7913c09c1dd
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Oct 8 19:34:02 2017 +0100
Python: separate test from demo programs.
The previous test.py is gone, because it was mostly a demo, slightly a
test, and not very organised.
Now we have testsuite.py which is a fully automated set of Python unit
tests (much more thorough), and the demo.py which is a nicely
commented quick demonstration of some spigot functionality (and
contains the more demo-like parts of the old test.py).
python/demo.py | 80 +++++++++
python/test.py | 38 ----
python/testsuite.py | 492 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 572 insertions(+), 38 deletions(-)
More information about the tartarus-commits
mailing list