Skip to content

Commit 1a52069

Browse files
committed
doc: Fix example with __next__() in PL/Python function
Per PEP 3114, iterator.next() has been renamed to iterator.__next__(), and one example in the documentation still used next(). This caused the example provided to fail the function creation since Python 2 is not supported anymore since 19252e8. Author: Erik Wienhold Discussion: https://postgr.es/m/173209043143.2092749.13692266486972491694@wrigleys.postgresql.org Backpatch-through: 15
1 parent e3b249c commit 1a52069

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/src/sgml/plpython.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ $$ LANGUAGE plpython3u;
553553

554554
<varlistentry>
555555
<term>Iterator (any object providing <symbol>__iter__</symbol> and
556-
<symbol>next</symbol> methods)</term>
556+
<symbol>__next__</symbol> methods)</term>
557557
<listitem>
558558
<para>
559559
<programlisting>
@@ -569,7 +569,7 @@ AS $$
569569
def __iter__ (self):
570570
return self
571571

572-
def next (self):
572+
def __next__(self):
573573
self.ndx += 1
574574
if self.ndx == len(self.who):
575575
raise StopIteration

0 commit comments

Comments
 (0)