[py-svn] commit/py: RonnyPfannschmidt: undo my addition of next in rev 214561f55dfc, this particular implementation was rather bad
Bitbucket
commits-noreply at bitbucket.org
Tue Dec 13 00:34:44 CET 2011
1 new commit in py:
https://bitbucket.org/hpk42/py/changeset/44cff93787d6/
changeset: 44cff93787d6
user: RonnyPfannschmidt
date: 2011-12-12 22:11:03
summary: undo my addition of next in rev 214561f55dfc, this particular implementation was rather bad
affected #: 4 files
diff -r e284b86857e2e3d975cac9c654a810434c9e5cfc -r 44cff93787d68267a2d2cb3f3f6c45a45ee352d5 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,7 +12,6 @@
(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
diff -r e284b86857e2e3d975cac9c654a810434c9e5cfc -r 44cff93787d68267a2d2cb3f3f6c45a45ee352d5 py/__init__.py
--- a/py/__init__.py
+++ b/py/__init__.py
@@ -104,7 +104,6 @@
'builtins' : '._builtin:builtins',
'execfile' : '._builtin:execfile',
'callable' : '._builtin:callable',
- 'next' : '._builtin:next',
},
# input-output helping
diff -r e284b86857e2e3d975cac9c654a810434c9e5cfc -r 44cff93787d68267a2d2cb3f3f6c45a45ee352d5 py/_builtin.py
--- a/py/_builtin.py
+++ b/py/_builtin.py
@@ -91,22 +91,6 @@
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
diff -r e284b86857e2e3d975cac9c654a810434c9e5cfc -r 44cff93787d68267a2d2cb3f3f6c45a45ee352d5 testing/root/test_builtin.py
--- a/testing/root/test_builtin.py
+++ b/testing/root/test_builtin.py
@@ -1,7 +1,7 @@
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]
@@ -160,22 +160,3 @@
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
-
Repository URL: https://bitbucket.org/hpk42/py/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list