[issue15826] Increased test coverage of test_glob.py

2012-08-30 Thread Alessandro Moura
New submission from Alessandro Moura: Hi, Here is a patch to increase test coverage of test_glob.py. I added tests where the glob patterns are of type bytes. The coverage (according to coverage.py) is now complete, except for what are clearly artefacts probably caused by the fact that glob

[issue15826] Increased test coverage of test_glob.py

2012-08-31 Thread Alessandro Moura
Alessandro Moura added the comment: Agreed, here is the patch where this is done. -- Added file: http://bugs.python.org/file27078/test_glob.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15837] Added test to test_random.py testing Random.shuffle

2012-08-31 Thread Alessandro Moura
New submission from Alessandro Moura: Random.shuffle does not have a test in test_random.py; the attached patch adds this test. In addition, I rewrote the documentation string for Random.shuffle, which apparently did not reflect recent changes in the code and was inconsistent with the

[issue15837] Added test to test_random.py testing Random.shuffle

2012-09-01 Thread Alessandro Moura
Alessandro Moura added the comment: Sorry, here it is the patch. -- keywords: +patch Added file: http://bugs.python.org/file27082/random.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15826] Increased test coverage of test_glob.py

2012-09-01 Thread Alessandro Moura
Alessandro Moura added the comment: test_bytes_glob_directory_with_trailing_slash already has a counterpart in the main class, but it is not easily handled by overriding self.glob and self.norm. Since it is only a single test, I just decided to override test_glob_directory_with_trailing_slash

[issue15826] Increased test coverage of test_glob.py

2012-09-01 Thread Alessandro Moura
Alessandro Moura added the comment: Im OK with the patch changes. ''' /home/rdmurray/python/p33/Lib/os.py:263: BytesWarning: Comparison between bytes and string if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists /home/rdmurray/python/p33/Lib/glob.py:6

[issue15845] Fixing some byte-to-string conversion warnings

2012-09-01 Thread Alessandro Moura
New submission from Alessandro Moura: This is related to issue 15826. When run with the -b option, some glob.py and os.py functions give warnings due to byte-to-string conversions: amoura@amoura-laptop:~/cpython$ ./python -b -c "import glob; glob.glob(b'cover*/glob.cover'

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-02 Thread Alessandro Moura
Alessandro Moura added the comment: This also happens for the writable() and seekable() methods. The problem is that those methods do not check whether the buffers have been closed in stringio.c. This is fixed in the attached patch for StringIO. BytesIO should be the same, but bytesio.c is

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-02 Thread Alessandro Moura
Alessandro Moura added the comment: Here is the patch fixing the issue in both StringIO and BytesIO. In both cases, the problem is that in their respective c files, these methods always returned true, without testing whether the file was closed. Is this a recent rewrite? I am surprised this

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-02 Thread Alessandro Moura
Alessandro Moura added the comment: Sorry, I should have seen the related issue (or just read the docs :)). Here is the patch fixing these issues, implementing the behaviour stated in the docs (raising ValueError after close). The tests revealed that the _pyio module also needed fixing, and

[issue15837] Added test to test_random.py testing Random.shuffle

2012-09-03 Thread Alessandro Moura
Alessandro Moura added the comment: Comparing the execution time with and without the int=int argument of this command: amoura@amoura-laptop:~/cpython$ time ./python -c "from random import shuffle; lst=list(range(100)); shuffle(lst); print (len(lst))" I get with int=

[issue15837] Added test to test_random.py testing Random.shuffle

2012-09-03 Thread Alessandro Moura
Alessandro Moura added the comment: The int=int still makes no difference, but if the second argument is set to random.random, we get a big speedup, regardless of whether the third argument is there: without int=int: amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst

[issue15837] Added test to test_random.py testing Random.shuffle

2012-09-03 Thread Alessandro Moura
Alessandro Moura added the comment: Yup. This is the result of simply eliminating the condition in the loop and just using the second argument (for the purposes of testing this only): amoura@amoura-laptop:~/cpython$ time ./python -c "import random; lst=list(range(100)); random.sh

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-04 Thread Alessandro Moura
Alessandro Moura added the comment: Thanks. Here is the amended patch with your suggestions implemented. -- Added file: http://bugs.python.org/file27117/memoryio.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15841] Some StringIO and BytesIO methods can succeed after close

2012-09-05 Thread Alessandro Moura
Alessandro Moura added the comment: I just emailed my contributor's agreement. -- ___ Python tracker <http://bugs.python.org/issue15841> ___ ___ Python-bugs-l

[issue15842] Some SocketIO methods can succeed after close()

2012-09-05 Thread Alessandro Moura
Alessandro Moura added the comment: This patch fixes the problem, making those methods raise a ValueError exception after close. I also added one test case for this issue. -- keywords: +patch nosy: +eng793 Added file: http://bugs.python.org/file27128/socket.patch

[issue15872] shutil.rmtree(..., ignore_errors=True) doesn't ignore all errors

2012-09-06 Thread Alessandro Moura
Alessandro Moura added the comment: Yes, confirmed. When checking whether the provided path is a directory, rmtree does not check whether ignore_errors is set. According to the docstring, "If ignore_errors is set, errors are ignored". Presumably this means any error, in which case t

[issue15872] shutil.rmtree(..., ignore_errors=True) doesn't ignore all errors

2012-09-06 Thread Alessandro Moura
Alessandro Moura added the comment: Added test to patch. -- Added file: http://bugs.python.org/file27139/shutil.patch ___ Python tracker <http://bugs.python.org/issue15

[issue15842] Some SocketIO methods can succeed after close()

2012-09-08 Thread Alessandro Moura
Alessandro Moura added the comment: Fixed seekable(), and amended tests; see patch. -- Added file: http://bugs.python.org/file27149/socket.patch ___ Python tracker <http://bugs.python.org/issue15