Slight improvement · RDFLib/rdflib@a6ca291 (original) (raw)

Original file line number Diff line number Diff line change
@@ -98,14 +98,15 @@ def graph(self, argstr: str, i: int) -> int:
98 98
99 99 j = i + 1
100 100
101 +if self._context is not None:
102 +self.BadSyntax(argstr, i, "Nested graphs are not allowed")
103 +
101 104 oldParentContext = self._parentContext
102 105 self._parentContext = self._context
103 106 reason2 = self._reason2
104 107 self._reason2 = becauseSubGraph
105 108 # type error: Incompatible types in assignment (expression has type "Graph", variable has type "Optional[Formula]")
106 109 self._context = self._store.newGraph(graph) # type: ignore[assignment]
107 -if self._context is not None and self._parentContext is not None:
108 -raise SyntaxError("GRAPH may not include a GRAPH " "(#trig-graph-bad-07)")
109 110
110 111 while 1:
111 112 i = self.skipSpace(argstr, j)