aboutsummaryrefslogtreecommitdiffstats
path: root/__run__.py
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2019-10-23 14:24:59 -0400
committerJake Hunsaker <jhunsake@redhat.com>2019-10-24 10:30:15 -0400
commit903958306830ea00ac47e3ea353eaa5d8abbacb6 (patch)
tree5c1772009f6d0204377117613930ba797a95a973 /__run__.py
parentca711063e27192c3021c8cb6eb46f3850dd02486 (diff)
downloadsos-903958306830ea00ac47e3ea353eaa5d8abbacb6.tar.gz
[Predicate] Override __bool__ to allow py3 evaluation
The check in `Plugin.test_predicate()` relies on a 'is not None' test, which on py2 invokes a call to `SoSPredicate.__nonzero__()` which in turns runs our evaluation of the predicate. On py3 however, this test is an explicit check to see if the object is `NoneType`. As such, `__nonzero__()` never runs and the predicate defaults to always evaluating ad `True`. This effectively removed any gating for command execution on py3. By overriding `SoSPredicate.__bool__()` to wrap `__nonzero__()` we can ensure that predicate evaluation is performed properly on both py2 and py3 runtimes. Closes: #1839 Resolves: #1840 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to '__run__.py')
0 files changed, 0 insertions, 0 deletions