A few minutes ago, I saw a
9x9 2m+0x 10s
challenge at the Play page.
(I noted the player’s name too, but figure I shouldn’t post that part here.)
Even if 0 periods is to be allowed, I would think that should warn as Unusual Time Setting.
(Does 2 minutes sudden death give that warning? These two time-settings are equivalent.)
I see that at the page joooom linked to, anoek said
we have this line in our backend sanitization ret["periods"] = min(300, max(1, int( time_control_parameters["periods"] or "0")))
.
Is that Python 3? If yes, what happens with a ValueError from int()?
(For example, it could be that, due to this being live code, something will
use 0 rather than halting if it gets a KeyError for ret["periods"].)
I saw another one, this time
9x9 5m+nullx 30s .
I believe Python has “None” rather than “hull”, so here are two hypotheses:
the Python hypothesis:
time_control_parameters["periods"] is NaN, or something else truthy that
would cause int to raise ValueError. (I know that in Python 3, NaN is truthy.)
Since the left input is truthy, the or outputs that, and then int accordingly raises ValueError. That exception stops the execution of that Python code, leaving null,
or something that gets treated as such, in whatever location your other code
- maybe something like C++, maybe database code - reads to get ret["periods"].
the something-else hypothesis:
time_control_parameters["periods"] is either null or NaN or NA or something similar, and is truthy.
Since time_control_parameters["periods"] is truthy, that is the output of the or. int of that is null. max and min both output null when one of their inputs is null.