[Python-modules-commits] [python-pyld] 02/05: Fix off-by-one error in context merging.

Wolfgang Borgert debacle at moszumanska.debian.org
Tue Oct 13 22:56:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag 0.6.6
in repository python-pyld.

commit c197fa5cfb598613451a7728fba39001e8299bda
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Wed Dec 3 14:55:29 2014 -0500

    Fix off-by-one error in context merging.
---
 lib/pyld/jsonld.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index 3b9e58a..bae5081 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -4154,7 +4154,7 @@ class JsonLdProcessor(object):
                 # array @context
                 if _is_array(v):
                     length = len(v)
-                    for i in range(len(v)):
+                    for i in range(length):
                         if _is_string(v[i]):
                             url = prepend_base(base, v[i])
                             # replace w/@context if requested
@@ -4165,8 +4165,8 @@ class JsonLdProcessor(object):
                                     v.pop(i)
                                     for e in reversed(ctx):
                                         v.insert(i, e)
-                                    i += len(ctx)
-                                    length += len(ctx)
+                                    i += len(ctx) - 1
+                                    length = len(v)
                                 else:
                                     v[i] = ctx
                             # @context URL found

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git



More information about the Python-modules-commits mailing list