This is an automated email from the git hooks/post-receive script. sebastic pushed a commit to branch experimental in repository grass.
commit 3e6111db5dcb1d5f7032515692757c71ae91240e Author: Bas Couwenberg <sebas...@xs4all.nl> Date: Tue Feb 10 22:56:09 2015 +0100 Update python-ctypes-ternary.patch to use if/else instead of and/or. --- debian/changelog | 6 ++++++ debian/patches/python-ctypes-ternary.patch | 27 +++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index dd1b67b..671a668 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +grass (7.0.0~rc2-1~exp2) UNRELEASED; urgency=medium + + * Update python-ctypes-ternary.patch to use if/else instead of and/or. + + -- Bas Couwenberg <sebas...@debian.org> Tue, 10 Feb 2015 22:55:48 +0100 + grass (7.0.0~rc2-1~exp1) experimental; urgency=medium * New upstream release candidate. diff --git a/debian/patches/python-ctypes-ternary.patch b/debian/patches/python-ctypes-ternary.patch index 36b90a8..b5f8cda 100644 --- a/debian/patches/python-ctypes-ternary.patch +++ b/debian/patches/python-ctypes-ternary.patch @@ -19,17 +19,36 @@ Description: Enclose Python ternary in parenthesis. ('st_spare', c_int * ((sizeof(__fsid_t) == sizeof(c_int)) and 9 or 8)), . fixes the TypeError. + . + While the and/or idiom is common it's also unsafe, because it can return + wrong results when the "and" value has a false boolean value. See: + . + https://docs.python.org/3.4/faq/programming.html#is-there-an-equivalent-of-c-s-ternary-operator + . + In the st_spare case this is not a problem, but it can cause problems for + other conversions in the future. + . + Instead of the and/or idiom the recommended if/else idiom is used. + . + The st_spare member thus becomes: + . + ('st_spare', c_int * (9 if (sizeof(__fsid_t) == sizeof(c_int)) else 8)), + . Author: Bas Couwenberg <sebas...@xs4all.nl> Forwarded: https://trac.osgeo.org/grass/ticket/2581 --- a/lib/python/ctypes/ctypesgencore/expressions.py +++ b/lib/python/ctypes/ctypesgencore/expressions.py -@@ -208,7 +208,7 @@ class ConditionalExpressionNode(Expressi +@@ -208,9 +208,9 @@ class ConditionalExpressionNode(Expressi return self.no.evaluate(context) def py_string(self, can_be_ctype): - return "%s and %s or %s" % \ -+ return "(%s and %s or %s)" % \ - (self.cond.py_string(True), - self.yes.py_string(can_be_ctype), +- (self.cond.py_string(True), +- self.yes.py_string(can_be_ctype), ++ return "(%s if %s else %s)" % \ ++ (self.yes.py_string(can_be_ctype), ++ self.cond.py_string(True), self.no.py_string(can_be_ctype)) + + class AttributeExpressionNode(ExpressionNode): -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/grass.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel