[Python-Dev] operator.c for release24-maint and test_bz2 on Python 2.4.1

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Fri Aug 26 15:08:57 CEST 2005


A.B., Khalid wrote:
> Hello there,
> 
> 
> The release24-maint check-ins for today contained this typo:
> 
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v
> retrieving revision 2.29
> retrieving revision 2.29.4.1
> diff -u -d -r2.29 -r2.29.4.1
> --- operator.c 4 Dec 2003 22:17:49 -0000 2.29
> +++ operator.c 26 Aug 2005 06:43:16 -0000 2.29.4.1
> @@ -267,6 +267,9 @@
> itemgetterobject *ig;
> PyObject *item;
> 
> + if (!_PyArg_NoKeywords("itemgetter()", kdws)) <----- kdws should be kwds
> + return NULL;
> +
> if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &item))
> return NULL;

Thank you, that is corrected now.

> However, and in Python 2.4.1 the following happens when the test is not 
> invoked from an interpreted session:
> 
> $ python ../Lib/test/test_bz2.py
> testBug1191043 (__main__.BZ2FileTest) ... ERROR
> ERROR

[...]
> ======================================================================
> ERROR: testBug1191043 (__main__.BZ2FileTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "../Lib/test/test_bz2.py", line 255, in testBug1191043
>    lines = bz2f.readlines()
> RuntimeError: wrong sequence of bz2 library commands used
> 
> ======================================================================
> ERROR: testBug1191043 (__main__.BZ2FileTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "../Lib/test/test_bz2.py", line 47, in tearDown
>    os.unlink(self.filename)
> OSError: [Errno 13] Permission denied: '@test'
> 
> ----------------------------------------------------------------------
> Ran 33 tests in 6.210s
> 
> FAILED (errors=2)
> Traceback (most recent call last):
> File "../Lib/test/test_bz2.py", line 357, in ?
>    test_main()
> File "../Lib/test/test_bz2.py", line 353, in test_main
>    FuncTest
> File "G:\PROJS\PY24\PYTHON\DIST\SRC\lib\test\test_support.py", line 290, in 
> run_unittest
>    run_suite(suite, testclass)
> File "G:\PROJS\PY24\PYTHON\DIST\SRC\lib\test\test_support.py", line 274, in 
> run_suite
>    raise TestFailed(msg)
> test.test_support.TestFailed: errors occurred; run in verbose mode for 
> details

Are you sure that you are calling the newly-built python.exe? It is strange that
the test should pass in interactive mode when it doesn't in normal mode.

For a confirmation, can you execute this piece of code both interactively and
from a file:


        data = 'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x00!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t'
        f = open('test.bz2', "wb")
        f.write(data)
        f.close()
        bz2f = BZ2File('test.bz2')
        lines = bz2f.readlines()
        bz2f.close()
        assert lines == ['Test']
        bz2f = BZ2File('test.bz2)
        xlines = list(bz2f.xreadlines())
        bz2f.close()
        assert lines == ['Test']
        os.unlink('test.bz2')

Reinhold

-- 
Mail address is perfectly valid!



More information about the Python-Dev mailing list