Skip to content

Commit 35e9421

Browse files
authored
Merge pull request jceb#304 from akstrfn/stopiter_fix
fix : RuntimeError: generator raised StopIteration
2 parents ce17a40 + bb503b2 commit 35e9421

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

ftplugin/orgmode/liborgmode/checkboxes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,17 @@ def all_siblings(self):
249249
else:
250250
p = self.parent
251251
if not p.children:
252-
raise StopIteration()
252+
return
253253

254254
c = p.first_checkbox
255255
while c:
256256
yield c
257257
c = c.next_sibling
258-
raise StopIteration()
258+
return
259259

260260
def all_children(self):
261261
if not self.children:
262-
raise StopIteration()
262+
return
263263

264264
c = self.first_checkbox
265265
while c:
@@ -268,7 +268,7 @@ def all_children(self):
268268
yield d
269269
c = c.next_sibling
270270

271-
raise StopIteration()
271+
return
272272

273273
def all_children_status(self):
274274
u""" Return checkboxes status for currnet checkbox's all children

ftplugin/orgmode/liborgmode/documents.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,13 @@ def all_headings(self):
269269
the current file in serialized order
270270
"""
271271
if not self.headings:
272-
raise StopIteration()
272+
return
273273

274274
h = self.headings[0]
275275
while h:
276276
yield h
277277
h = h.next_heading
278-
raise StopIteration()
278+
return
279279

280280
def find_heading(
281281
self, position=0, direction=Direction.FORWARD, heading=Heading,

ftplugin/orgmode/liborgmode/headings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,24 +223,24 @@ def all_checkboxes(self):
223223
the current heading in serialized order
224224
"""
225225
if not self.checkboxes:
226-
raise StopIteration()
226+
return
227227

228228
c = self.first_checkbox
229229
while c:
230230
yield c
231231
c = c.next_checkbox
232-
raise StopIteration()
232+
return
233233

234234
def all_toplevel_checkboxes(self):
235235
u""" return all top level checkboxes for current heading """
236236
if not self.checkboxes:
237-
raise StopIteration()
237+
return
238238

239239
c = self.first_checkbox
240240
while c:
241241
yield c
242242
c = c.next_sibling
243-
raise StopIteration()
243+
return
244244

245245
def find_checkbox(self, position=0, direction=Direction.FORWARD,
246246
checkbox=Checkbox, connect_with_heading=True):

0 commit comments

Comments
 (0)