[issue3618] possible deadlock in IO library (Lib/io.py)

2008-12-26 Thread Gabriel Genellina
Changes by Gabriel Genellina : -- nosy: +gagenellina ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue4241] zipfile.py -> is_zipfile leaves file open when error

2008-12-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: The patch for issue4756 fixes this too. -- nosy: +gagenellina ___ Python tracker ___ ___ Python-b

[issue4756] zipfile.is_zipfile: added support for file-like objects

2008-12-26 Thread Gabriel Genellina
New submission from Gabriel Genellina : Patch to zipfile.is_zipfile, adding support for file and file-like objects. Includes test cases and documentation updates. This fixes issue4241 too. -- components: Library (Lib) files: is_zipfile_filelike.diff keywords: patch messages: 78342 nosy

[issue4710] [PATCH] zipfile.ZipFile does not extract directories properly

2008-12-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: Your usage of os.sep is incorrect, both when reading and writing directories. Zip files are (more-or-less) platform independent. The specification *requires* forward slashes in paths [1], and the zipfile module already writes them that way. Checking for o

[issue4740] pickle test for protocol 3 (HIGHEST_PROTOCOL in py3k)

2008-12-26 Thread Hirokazu Yamamoto
Changes by Hirokazu Yamamoto : -- stage: patch review -> committed/rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue4740] pickle test for protocol 3 (HIGHEST_PROTOCOL in py3k)

2008-12-26 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Done. Fixed in r67930(trunk), r67931(py3k) -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___

[issue4755] Common path prefix

2008-12-26 Thread Nick Coghlan
Nick Coghlan added the comment: A new function sounds like a good solution to me. How about just calling it "os.path.commonpath" though? I agree having a path component based prefix function in os.path is highly desirable, particularly since the addition of relpath in 2.6: base_dir = os.path.c

[issue4755] Common path prefix

2008-12-26 Thread Skip Montanaro
New submission from Skip Montanaro : os.path.commonprefix returns the common prefix of a list of paths taken character-by-character. This can return invalid paths. For example, os.path.commonprefix(["/export/home/dave", "/etc/passwd"]) will return "/e", which likely has no meaning as a path,

[issue4740] pickle test for protocol 3 (HIGHEST_PROTOCOL in py3k)

2008-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Go ahead. ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/ma

[issue4740] pickle test for protocol 3 (HIGHEST_PROTOCOL in py3k)

2008-12-26 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Not yet. This patch is for trunk. But HIGHEST_PROTOCOL is 2 in trunk, so no difference in behavior. (Just useful for consistency) Added file: http://bugs.python.org/file12468/trunk_use_HIGHEST_PROTOCOL.patch ___ Python t

[issue4740] pickle test for protocol 3 (HIGHEST_PROTOCOL in py3k)

2008-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Looks fine to me. This happens in the trunk already, right? -- nosy: +benjamin.peterson ___ Python tracker ___ __

[issue4745] socket.send obscure error message

2008-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Fixed in r67929. -- nosy: +benjamin.peterson resolution: -> fixed status: open -> closed ___ Python tracker ___

[issue4743] intra-pkg multiple import (import local1, local2) not fixed

2008-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: r67928 makes 2to3 more tolerant about multiple imports on a line. It also warns when there is an absolute import and relative import on the same line. -- nosy: +benjamin.peterson resolution: -> fixed status: open -> closed _

[issue4744] asynchat documentation needs to be more precise

2008-12-26 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +giampaolo.rodola, josiah.carlson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue4738] Patch to make zlib-objects better support threads

2008-12-26 Thread ebfe
Changes by ebfe : Removed file: http://bugs.python.org/file12463/zlib_threads-2.diff ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue4748] yield expression vs lambda

2008-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Attaching patch? BTW, how did you find this bug? :) -- keywords: +needs review, patch nosy: +benjamin.peterson stage: -> patch review type: -> behavior Added file: http://bugs.python.org/file12467/nasty_lambda_generators.patch ___

[issue4738] Patch to make zlib-objects better support threads

2008-12-26 Thread ebfe
ebfe added the comment: new svn diff attached the indentation in this file is not my fault, it has tabs all over it... The 5kb limits protects from the overhead of releasing the GIL. With very small buffers the overall runtime in my benchmark tends to double. I set it based on my testing and i

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: hashlibtest.py results on my Quad Core with 4 threads: - unpatched: best=13.0 sec - patched: best=3.25 sec Some maths: 13.0 / 4 = 3.25 \o/ ___ Python tracker

[issue4738] Patch to make zlib-objects better support threads

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: Comments on zlib_threads-2.diff: - the indentation is strange: don't mix spaces and tabs! - I prefer ";" after a call to a macro: "ENTER_ZLIB(self);" instead of "ENTER_ZLIB(self)". It makes vim happy (auto indent code correctly) and it works for ENTER_ZLIB a

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread ebfe
ebfe added the comment: Here is another simple benchmarker. For me it shows almost perfect scaling (2 cores = 196% performance) if the buffer put into .update() is large enough. I deliberately did not move Py_BEGIN_ALLOW_THREADS into EVP_hash as we might call this function without having some l

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file12462/md5sum.py ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: New version of my md5sum.py program limited to 10 threads. New benchmark with 160 files (size in 7..10 MB): - Python unpatched: best=4.8 sec - C version (/usr/bin/md5sum): best=3.6 sec - Python patched: best=2.1 sec As everybody knows, Python is faster than

[issue4738] Patch to make zlib-objects better support threads

2008-12-26 Thread ebfe
Changes by ebfe : Removed file: http://bugs.python.org/file12448/zlib_threads.diff ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue4738] Patch to make zlib-objects better support threads

2008-12-26 Thread ebfe
ebfe added the comment: new svn diff attached - GIL is now released for adler32 and crc32 if the buffer is larger than 5kb (we don't want to risk burning cpu cycles by GIL-stuff) - adler32 got it's param by s# but now does s* - why s# anyway? - ENTER_ZLIB no longer gives away the GIL. It's dang

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: > I've taken on haypo's patch to release the GIL only > when the buffer is larger than 10kb You can factorize the code by moving Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS *into* EVP_hash ;-) 10 KB is a random value or the fast value for your computer? I

[issue3860] GzipFile and BZ2File should support context manager protocol

2008-12-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: > (1) the IOError message is different for the two modules: >"I/O operation on closed GzipFile object" > vs >"I/O operation on closed file" I've reused the same error message as used in other parts of each module. > (2) For bz2module, Why don't you cal

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Is it save to assume that a buffer-view will not change until release() > is called - for all types supporting the buffer protocol in py3k ?? Yes, it is! ___ Python tracker _

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread ebfe
ebfe added the comment: Thanks for the advices. Antoine, maybe you could clarify the situation regarding buffer-locks for me. In older versions of PEP 3118 the PyBUF_LOCK flag was still present but it doesn't seem to have made it's way into the final draft. Is it save to assume that a buffer-vi

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread ebfe
Changes by ebfe : Removed file: http://bugs.python.org/file12453/hashopenssl_threads.diff ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue4708] os.pipe should return inheritable descriptors (Windows)

2008-12-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: Patch to posixmodule.c including test case and documentation updates. Note: I've only run the tests on Windows. -- keywords: +patch Added file: http://bugs.python.org/file12460/inheritable_pipes.diff ___ Python tr

[issue4640] optparse - dosn't distinguish between '--option' and '-option'

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: -debug may be equivalent to -d -e -b -u -g (if none of these options have an argument), but no to --debug. If you like to use -d as an alias to --debug, just use: add_option("-d", "--debug", ...). -- nosy: +haypo _

[issue3860] GzipFile and BZ2File should support context manager protocol

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: I love "with ... as f:" and I want it for gzip/bz2 files! Comment about the patch: (1) the IOError message is different for the two modules: "I/O operation on closed GzipFile object" vs "I/O operation on closed file" Specify the object name in both mes

[issue4738] Patch to make zlib-objects better support threads

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: New comments about the last patch: - GIL is not released for adler() or crc32() whereas these functions may be slow for long strings: just add Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS before / after adler(...) and crc32(...) - (As ENTER_HASHLIB, issue #

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: New version of ebfe's patch: - ENTER/LEAVE_HASHLIB: * don't touch GIL in ENTER_HASHLIB (it's useless) * add mandatory argument (explicit use of "self") - EVP_hash(): * restore Py_SAFE_DOWNCAST * simplify the code: always use the while() instead of

[issue4716] Python 3.0 halts on shutdown when settrace is set

2008-12-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the investigation! The problem has already been reported in #3618. Closing this one. -- resolution: -> duplicate status: open -> closed superseder: -> possible deadlock in IO library (Lib/io.py) ___ Pyth

[issue4716] Python 3.0 halts on shutdown when settrace is set

2008-12-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: Yes, this is exactly the problem. The execution never goes beyond print ('here'); if you print frame.f_lineno you'll see it blocks at io.py line 1036, waiting for a Lock for the second time. So the trace function cannot use print, not write to regular files

[issue4754] winsound documentation (about stoping sounds)

2008-12-26 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: The patch is for release26-maint. ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue4754] winsound documentation (about stoping sounds)

2008-12-26 Thread Hirokazu Yamamoto
New submission from Hirokazu Yamamoto : This comes from Issue4741. The patch - clarify meaning of None as the parameter of *sound* to PlaySound - notify SND_PURGE is not supported by MS now -- assignee: georg.brandl components: Documentation files: winsound_doc.patch keywords: patch me

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: If view.len is negative, EVP_hash() may read invalid memory :-/ Be careful of integer overflow in this block: Py_ssize_t offset = 0, sublen = len; while (sublen) { unsigned int process = sublen > MUNCH_SIZE ? MUNCH_SIZE : sublen; ... } Y

[issue4738] Patch to make zlib-objects better support threads

2008-12-26 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +pitrou priority: -> normal stage: -> patch review versions: -Python 2.5, Python 2.6, Python 3.0 ___ Python tracker ___ ___

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: EVP_copy() and EVP_get_digest_size() should call ENTER_HASHLIB/LEAVE_HASHLIB to protect self->ctx. ___ Python tracker ___ __

[issue4726] doctest gets line numbers wrong due to quotes in comments

2008-12-26 Thread Gabriel Genellina
Gabriel Genellina added the comment: I could not reproduce the behaviour you describe. Could you provide a test case? That fails with the current code and is fixed after applying your patch. (BTW, the r.e. should be a raw string literal, even the original one) -- nosy: +gagenellina _

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: Hi, Very good idea. However, you don't need to discriminate for the bytes type specifically. When a buffer is taken on the object (with PyObject_GetBuffer()), the object is internally "locked" until the buffer is release with PyBuffer_Release(). Try with a byte

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread STINNER Victor
STINNER Victor added the comment: I think that you don't use Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS correctly: the GIL can be released when the hashlib lock is acquired (to run hash functions in parallel threads). So the macros should be: #define ENTER_HASHLIB \ PyThread_acquire_lo

[issue4753] Faster opcode dispatch on gcc

2008-12-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: Armin, by reading the pypy-dev mailing-list it looks like you were interested in this. -- nosy: +arigo ___ Python tracker ___ __

[issue4753] Faster opcode dispatch on gcc

2008-12-26 Thread Antoine Pitrou
New submission from Antoine Pitrou : This patch implements what is usually called "threaded code" for the ceval loop on compilers which support it (only gcc). The idea is that there is a separate opcode dispatch epilog at the end of each opcode, which allows the CPU to make much better use of its

[issue4752] Error in SocketServer UDP documentation

2008-12-26 Thread Andrey Petrov
New submission from Andrey Petrov : In the SocketServer.UDPServer Example, the second last line: server = SocketServer.UDPServer((HOST, PORT), BaseUDPRequestHandler) Should be: server = SocketServer.UDPServer((HOST, PORT), MyUDPHandler) -- assignee: georg.brandl components: Do

[issue4722] _winreg.QueryValue fault while reading mangled registry values

2008-12-26 Thread Gabriel Genellina
Changes by Gabriel Genellina : -- nosy: +gagenellina ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue4718] wsgiref package totally broken

2008-12-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: Hi, The patch looks ok to me, although the tests against mutable byte-like types are probably useless. ___ Python tracker ___ __

[issue1886] Permit to easily use distutils "--formats=tar, gztar, bztar" on all systems

2008-12-26 Thread anatoly techtonik
anatoly techtonik added the comment: What are the systems where does this original tar still exist as a default utility? If there is no tarfile module on this systems and "tar" version is so old then you need a more modern system to wrap your releases or more modern "tar". The ratio of such sys

[issue1886] Permit to easily use distutils "--formats=tar, gztar, bztar" on all systems

2008-12-26 Thread Roumen Petrov
Roumen Petrov added the comment: about patch1886.use.tarfile.module.diff - the original tar don't support -j flag. -- nosy: +rpetrov ___ Python tracker ___ __

[issue1886] Permit to easily use distutils "--formats=tar, gztar, bztar" on all systems

2008-12-26 Thread anatoly techtonik
anatoly techtonik added the comment: Oh, my mistake - the bug with extra dir component in archive is in issue4750 Second shell call to compression program is removed only for the case when tarfile or any of required compression modules are not available. ___

[issue1886] Permit to easily use distutils "--formats=tar, gztar, bztar" on all systems

2008-12-26 Thread anatoly techtonik
anatoly techtonik added the comment: I attach an improved patch1886.use.tarfile.module.diff that fixes all bugs addressed in this issue. It also removes second call to compression program leaving that privilege to tar. > I notice that the archive generated by tarfile module looks > different.

[issue1885] [distutils] - error when processing the "--formats=tar" option

2008-12-26 Thread anatoly techtonik
anatoly techtonik added the comment: Please reopen this bug. issue#1886 is different it take a long time until it is committed. I attach patch from Giampaolo here. -- keywords: +patch nosy: +techtonik versions: +Python 2.5, Python 2.7 Added file: http://bugs.python.org/file12455/issue1

[issue4718] wsgiref package totally broken

2008-12-26 Thread Dmitry Vasiliev
Dmitry Vasiliev added the comment: Added check for wsgi.input.read() argument. Added file: http://bugs.python.org/file12454/wsgiref2.patch ___ Python tracker ___

[issue4751] Patch for better thread support in hashlib

2008-12-26 Thread ebfe
New submission from ebfe : The hashlib functions provided by _hashopenssl.c hold the GIL all the time although the underlying openssl-library is basically thread-safe. I've attached a patch (svn diff) which basically does four things: * If python is compiled with thread-support, the EVPobject is

[issue4750] tarfile keeps excessive dir structure in compressed files

2008-12-26 Thread anatoly techtonik
Changes by anatoly techtonik : -- keywords: +patch Added file: http://bugs.python.org/file12452/tarfile.directory.fix.diff ___ Python tracker ___ _

[issue4750] tarfile keeps excessive dir structure in compressed files

2008-12-26 Thread anatoly techtonik
New submission from anatoly techtonik : When tarfile is directed to create tar.gz compressed archive file in a path different from current, it saves full path information in .gz header where only filename is required. This causes problems with decompression utilities, such as 7zip. The testsuite

[issue4604] close() seems to have limited effect

2008-12-26 Thread Dmitry Vasiliev
Dmitry Vasiliev added the comment: Attached more generic version of the patch. -- nosy: +hdima Added file: http://bugs.python.org/file12450/io_fixes.patch ___ Python tracker ___

[issue4718] wsgiref package totally broken

2008-12-26 Thread Dmitry Vasiliev
Dmitry Vasiliev added the comment: Graham Dumpleton wrote: > the check for number of arguments supplied to wsgi.input.read() is wrong as > it allows for an optional argument, > when argument is supposed to mandatory. I think it's a good idea. I'll update the patch soon. _

[issue4749] Issue with RotatingFileHandler logging handler on Windows

2008-12-26 Thread Mohammad Al
New submission from Mohammad Al : It seems that RotatingFileHandler is experiencing an issue when attempting to rotate log files under Windows. The following errors are received: Traceback (most recent call last): File "C:\Python25\lib\logging\handlers.py", line 73, in emit if self.shou

[issue4718] wsgiref package totally broken

2008-12-26 Thread Graham Dumpleton
Graham Dumpleton added the comment: If making changes in wsgireg.validate, may be worthwhile also fixing up one area where it isn't strictly correct according to WSGI PEP. As per discussion: http://groups.google.com/group/python-web-sig/browse_frm/thread/b14b862ec4c620c0 the check for numbe

[issue4748] yield expression vs lambda

2008-12-26 Thread Georg Brandl
New submission from Georg Brandl : With lambda, the ban on "return x" in generators can be evaded: >>> x = lambda: ((yield 1), (yield 2)) >>> list(x()) [1, 2, (None, None)] >>> dis.dis(x) 1 0 LOAD_CONST 0 (1) 3 YIELD_VALUE 4 LOAD_CONST

[issue4741] winsound.SND_PURGE has no effect

2008-12-26 Thread Georg Brandl
Georg Brandl added the comment: In any case, this is not an issue in Python as PlaySound is only a thin wrapper around the OS' function. -- nosy: +georg.brandl resolution: -> wont fix status: open -> closed ___ Python tracker