Author: Armin Rigo <[email protected]>
Branch: gc_no_cleanup_nursery
Changeset: r73732:6e9e4f255563
Date: 2014-09-28 08:42 +0200
http://bitbucket.org/pypy/pypy/changeset/6e9e4f255563/
Log: hg merge default
diff --git a/lib-python/2.7/test/test_select.py
b/lib-python/2.7/test/test_select.py
--- a/lib-python/2.7/test/test_select.py
+++ b/lib-python/2.7/test/test_select.py
@@ -57,7 +57,17 @@
del a[-1]
return sys.__stdout__.fileno()
a[:] = [F()] * 10
- self.assertEqual(select.select([], a, []), ([], a[:5], []))
+ result = select.select([], a, [])
+ # CPython: 'a' ends up with 5 items, because each fileno()
+ # removes an item and at the middle the iteration stops.
+ # PyPy: 'a' ends up empty, because the iteration is done on
+ # a copy of the original list: fileno() is called 10 times.
+ if test_support.check_impl_detail(cpython=True):
+ self.assertEqual(len(result[1]), 5)
+ self.assertEqual(len(a), 5)
+ if test_support.check_impl_detail(pypy=True):
+ self.assertEqual(len(result[1]), 10)
+ self.assertEqual(len(a), 0)
def test_main():
test_support.run_unittest(SelectTestCase)
diff --git a/pypy/module/select/test/test_select.py
b/pypy/module/select/test/test_select.py
--- a/pypy/module/select/test/test_select.py
+++ b/pypy/module/select/test/test_select.py
@@ -244,20 +244,6 @@
raises(OverflowError, pollster.modify, 1, -1)
raises(OverflowError, pollster.modify, 1, 1 << 64)
- def test_resize_list_in_select(self):
- import select
- class Foo(object):
- def fileno(self):
- print len(l)
- if len(l) < 100:
- l.append(Foo())
- return 0
- l = [Foo()]
- select.select(l, (), (), 0)
- assert 1 <= len(l) <= 100
- # ^^^ CPython gives 100, PyPy gives 1. I think both are OK as
- # long as there is no crash.
-
class AppTestSelectWithPipes(_AppTestSelect):
"Use a pipe to get pairs of file descriptors"
@@ -318,6 +304,20 @@
for fd in rfds:
os.close(fd)
+ def test_resize_list_in_select(self):
+ import select
+ class Foo(object):
+ def fileno(self):
+ print len(l)
+ if len(l) < 100:
+ l.append(Foo())
+ return 0
+ l = [Foo()]
+ select.select(l, (), (), 0)
+ assert 1 <= len(l) <= 100
+ # ^^^ CPython gives 100, PyPy gives 1. I think both are OK as
+ # long as there is no crash.
+
class AppTestSelectWithSockets(_AppTestSelect):
"""Same tests with connected sockets.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit