Skip to content

Commit 1b66e61

Browse files
committed
Raise TypeError if ParseResult isn't a ParamValue
1 parent c79ecc2 commit 1b66e61

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

rdflib/plugins/sparql/parserutils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,11 @@ def postParse(self, instring, loc, tokenList):
224224
for t in tokenList:
225225
if isinstance(t, ParseResults):
226226
for i in t:
227-
if isinstance(i, ParamValue):
228-
if i.name not in res:
229-
res[i.name] = []
230-
res[i.name].append(i.tokenList)
227+
if not isinstance(i, ParamValue):
228+
raise TypeError("ParseResult must be a ParamValue")
229+
if i.name not in res:
230+
res[i.name] = []
231+
res[i.name].append(i.tokenList)
231232
elif isinstance(t, ParamValue):
232233
res[t.name] = t.tokenList
233234
return res

0 commit comments

Comments
 (0)