Commits

Ronny Pfannschmidt committed 44cff93

undo my addition of next in rev 214561f55dfc, this particular implementation was rather bad

Comments (0)

Files changed (4)

   (as seen from jnja2)
 - make trackeback recursion detection more resilent
   about the eval magic of a decorator library
-- add py.builtin.next
 - iniconfig: add support for ; as comment starter
 - properly handle lists in xmlgen on python3
 
         'builtins'       : '._builtin:builtins',
         'execfile'       : '._builtin:execfile',
         'callable'       : '._builtin:callable',
-        'next'           : '._builtin:next',
     },
 
     # input-output helping
 enumerate = enumerate
 
 try:
-    next = next
-except NameError:
-    _next_noarg = object()
-    def next(it, default=_next_noarg):
-        try:
-            if hasattr(it, '__next__'):
-                return it.__next__()
-            else:
-                return it.next()
-        except StopIteration:
-            if default is _next_noarg:
-                raise
-            else:
-                return default
-
-try:
     BaseException = BaseException
 except NameError:
     BaseException = Exception

testing/root/test_builtin.py

 import sys
 import types
 import py
-from py.builtin import set, frozenset, reversed, sorted, next
+from py.builtin import set, frozenset, reversed, sorted
 
 def test_enumerate():
     l = [0,1,2]
     code = py.builtin._getcode(test_getcode)
     assert isinstance(code, types.CodeType)
     assert py.builtin._getcode(4) is None
-
-def test_next():
-    it = iter([])
-    py.test.raises(StopIteraton, next, it)
-    it = iter('1')
-    n = next(it)
-    assert n ==  '1'
-    py.test.raises(StopIteraton, next, it)
-
-    class new_next(object):
-        def __next__(self):
-            return 1
-    assert next(new_next()) == 1
-
-    class old_next(object):
-        def next(self):
-            return 1
-    assert next(old_next) == 1
-