mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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 19252e8ec9.
Author: Erik Wienhold
Discussion: https://postgr.es/m/173209043143.2092749.13692266486972491694@wrigleys.postgresql.org
Backpatch-through: 15
			
			
This commit is contained in:
		@@ -553,7 +553,7 @@ $$ LANGUAGE plpython3u;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <varlistentry>
 | 
					    <varlistentry>
 | 
				
			||||||
     <term>Iterator (any object providing <symbol>__iter__</symbol> and
 | 
					     <term>Iterator (any object providing <symbol>__iter__</symbol> and
 | 
				
			||||||
      <symbol>next</symbol> methods)</term>
 | 
					      <symbol>__next__</symbol> methods)</term>
 | 
				
			||||||
     <listitem>
 | 
					     <listitem>
 | 
				
			||||||
      <para>
 | 
					      <para>
 | 
				
			||||||
<programlisting>
 | 
					<programlisting>
 | 
				
			||||||
@@ -569,7 +569,7 @@ AS $$
 | 
				
			|||||||
    def __iter__ (self):
 | 
					    def __iter__ (self):
 | 
				
			||||||
      return self
 | 
					      return self
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def next (self):
 | 
					    def __next__(self):
 | 
				
			||||||
      self.ndx += 1
 | 
					      self.ndx += 1
 | 
				
			||||||
      if self.ndx == len(self.who):
 | 
					      if self.ndx == len(self.who):
 | 
				
			||||||
        raise StopIteration
 | 
					        raise StopIteration
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user