[issue4656] Python 3 tutorial has old information about dicts

2008-12-13 Thread Matthew Cowles
New submission from Matthew Cowles : [From a question sent to the python-help list.] In the Python 3 tutorial at: http://docs.python.org/3.0/tutorial/datastructures.html#dictionaries it says: The keys() method of a dictionary object returns a list of all the keys used in the dictionary, in a

Re: [issue4631] urlopen returns extra, spurious bytes

2008-12-13 Thread Jeremy Hylton
Does the same thing happen with 2.6? Jeremy On Thu, Dec 11, 2008 at 8:53 AM, Jean-Paul Calderone wrote: > > Jean-Paul Calderone added the comment: > > The "f65" is the chunk length for the first chunk returned when > requesting that URL. A proxy could easily hide this by switching to a > diffe

[issue4512] Add get_filename method to zipimport

2008-12-13 Thread Nick Coghlan
Nick Coghlan added the comment: The spec get_filename is pretty simple: Return whatever __file__ would be set to if load_module() was called for this module. (runpy's problem is that it never actually loads the module in question, so it never gets the chance to interrogate __file__) _

[issue4523] logging module __init__ uses has_key

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

[issue4655] during Python installation, setup.py should not use .pydistutils.cfg

2008-12-13 Thread Jake
Changes by Jake : -- title: setup.py should not use .pydistutils.cfg -> during Python installation, setup.py should not use .pydistutils.cfg ___ Python tracker ___ __

[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

2008-12-13 Thread Nick Coghlan
Nick Coghlan added the comment: After looking into this, I think Alexander is correct. There is no standard mapping between __file__ and __name__ and linecache is mistaken in assuming such a mapping exists for all importers (and is the same as the standard filesystem to name mapping to boot). I

[issue4655] setup.py should not use .pydistutils.cfg

2008-12-13 Thread Jake
New submission from Jake : When installing python 2.6, I used: ./configure --prefix=/home/name/usr Installation was fine and everything was installed to: ~/usr/lib/python2.6 But the .so files were installed to: ~/usr/lib/python As ~/usr/lib/python was (no longer) declared in my PYTHO

[issue4258] Use 30-bit digits instead of 15-bit digits for Python integers.

2008-12-13 Thread STINNER Victor
STINNER Victor added the comment: I wrote a small benchmark tool dedicated to integer operations (+ - * / etc.): bench_int.py attached to issue4294. See also Message75715 and Message75719 for my benchmark results. Short sum up: 2^30 base helps a lot on 64 bits CPU (+26%) whereas the speedup i

[issue4258] Use 30-bit digits instead of 15-bit digits for Python integers.

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Just tested the patch, here are some benchmarks: ./python -m timeit -s "a=1;b=77" "a//b" -> 2.6: 0.253 usec per loop -> 3.1: 0.61 usec per loop -> 3.1 + patch: 0.331 usec per loop ./python -m timeit -s "a=1;b=77" "a*b" -> 2.6: 0.431

[issue4163] textwrap wordsep_re Unicode

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Fixed in r67746 and r67747. Thanks for the patch! -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker _

[issue4653] Patch to fix typos for Py3K

2008-12-13 Thread Johnny Lee
Johnny Lee added the comment: For the dynload_win.c typo, it's technically a possible buffer overflow, but you'd need to find an error that had an error message that's longer than 259 chars. In pythonrun.c, the if statements for fout and ferr and almost identical. Probably a good idea to con

[issue1040026] os.times() is bogus

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: > should the unit test in test_posix5.patch have been removed? I see. I wish that people would a) always provide complete patches in a single file, and b) delete files themselves that have been superceded by others. In any case, I have re-attached the file;

[issue1040026] os.times() is bogus

2008-12-13 Thread Martin v. Löwis
Changes by Martin v. Löwis : Added file: http://bugs.python.org/file9542/test_posix5.patch ___ Python tracker ___ ___ Python-bugs-list maili

[issue4653] Patch to fix typos for Py3K

2008-12-13 Thread Johnny Lee
Johnny Lee added the comment: Here are the URLs to the MSDN documentation for CreateFileMapping and FormatMessage[A|W]: For CreateFileMapping(), from the Return Value section: "If th

[issue4016] improve linecache: reuse tokenize.detect_encoding() and io.open()

2008-12-13 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- priority: -> normal stage: -> patch review versions: +Python 3.1 -Python 3.0 ___ Python tracker ___ __

[issue4653] Patch to fix typos for Py3K

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't know Windows APIs but the pythonrun.c bug is genuine. -- nosy: +pitrou priority: -> high type: -> behavior ___ Python tracker ___

[issue4583] segfault when mutating memoryview to array.array when array is resized

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a patch for the array module. -- keywords: +needs review, patch nosy: +pitrou priority: -> critical stage: -> patch review Added file: http://bugs.python.org/file12347/arraybuf.patch ___ Python tracker

[issue4561] Optimize new io library

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Christian, by benchmarks I meant a measurement of text reading with and without the patch. ___ Python tracker ___ ___

[issue3978] ZipFileExt.read() can be incredibly slow; patch included

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Attaching a cleanup of the proposed patch. The funny thing is that for me, both the unpatched and patched versions are as fast as the unzip binary. Added file: http://bugs.python.org/file12346/zipperf.patch ___ Python tracke

[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary

2008-12-13 Thread Gregory P. Smith
Gregory P. Smith added the comment: utf16_newlines2.patch looks good to me. This is a data corruption issue. If it is deferred for 3.0.1 it must be fixed in 3.0.2. +1 on putting this in 3.0.1. -- assignee: -> pitrou nosy: +gregory.p.smith priority: -> release blocker

[issue1040026] os.times() is bogus

2008-12-13 Thread Gregory P. Smith
Gregory P. Smith added the comment: should the unit test in test_posix5.patch have been removed? (regardless, its still on the bug tracker via the history links) ___ Python tracker _

[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: This new variant also removes the dangerous hack in getstate / setstate. Added file: http://bugs.python.org/file12345/utf16_newlines2.patch ___ Python tracker _

[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a simpler patch with a different approach and a lot of tests. The advantage is that it doesn't break the API. Added file: http://bugs.python.org/file12344/utf16_newlines.patch ___ Python tracker

[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary

2008-12-13 Thread Antoine Pitrou
Changes by Antoine Pitrou : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Changes by Mark Dickinson : Removed file: http://bugs.python.org/file12339/bit_length7_opt.patch ___ Python tracker ___ ___ Python-bugs-list ma

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Changes by Mark Dickinson : Removed file: http://bugs.python.org/file12342/bit_length7_opt2.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: > In the documentation, should "same value as ``x.bit_length``" not be > "same value as ``x.bit_length()``"? Yes, of course. Thanks! Added file: http://bugs.python.org/file12343/bit_length7_opt2.patch ___ Python tracker <

[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: A couple of suggestions: - if IncrementalNewlineDecoder gets an encoding argument, it can also instantiate the decoder itself; that way the API is a bit simpler - to encode '\r' without the BOM, you can e.g. use an incremental encoder and encode it twice: >>>

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Fredrik Johansson
Fredrik Johansson added the comment: FYI, Brent & Zimmermann call this function nbits(n) in "Modern Computer Arithmetic": http://www.loria.fr/~zimmerma/mca/pub226.html I don't really care much about the name though. In the documentation, should "same value as ``x.bit_length``" not be "same val

[issue3106] speedup some comparisons

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > If there's not a hurry, would like to review this a bit more when I get > back early next week. No pb! ___ Python tracker ___

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Changes by Mark Dickinson : Removed file: http://bugs.python.org/file12332/numbits-6b.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue4651] getopt need re-factor...

2008-12-13 Thread Guido van Rossum
Guido van Rossum added the comment: Don't open a new issue to point out that you just opened a new issue. About removing getopt.error: if it's in 3.0, it needs to stay or be properly deprecated. 3.1 has to be backwards compatible with 3.0 for sure. -- nosy: +gvanrossum resolution: ->

[issue4649] Fix a+b to a + b

2008-12-13 Thread Guido van Rossum
Guido van Rossum added the comment: Retro, you are blowing this way out of proportion. Style guidelines are not absolute rules that must be followed at all cost, and there are always exceptions. You need to have a lot of experience before you can claim with certainty that a certain piece of co

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: If there's not a hurry, would like to review this a bit more when I get back early next week. ___ Python tracker ___ _

[issue3106] speedup some comparisons

2008-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: If there's not a hurry, would like to review this a bit more when I get back early next week. ___ Python tracker ___ _

[issue1706039] Added clearerr() to clear EOF state

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Thanks for the patch. Committed into the 2.5 branch as r67740. This still needs to be applied to the other branches. -- priority: release blocker -> deferred blocker ___ Python tracker

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: I think I've found the happy medium: bit_length7_opt2.patch achieves nearly the same performance gains as bit_length7_opt.patch (around 7% for uniformly-distributed inputs, 3.5% for uniformly-distributed outputs), but is much more straightforward and readabl

[issue1040026] os.times() is bogus

2008-12-13 Thread Martin v. Löwis
Changes by Martin v. Löwis : Removed file: http://bugs.python.org/file9542/test_posix5.patch ___ Python tracker ___ ___ Python-bugs-list mai

[issue1040026] os.times() is bogus

2008-12-13 Thread Martin v. Löwis
Changes by Martin v. Löwis : Removed file: http://bugs.python.org/file9541/posixmodule.diff ___ Python tracker ___ ___ Python-bugs-list mail

[issue1040026] os.times() is bogus

2008-12-13 Thread Martin v. Löwis
Changes by Martin v. Löwis : Removed file: http://bugs.python.org/file9518/os_times3.PATCH ___ Python tracker ___ ___ Python-bugs-list maili

[issue1040026] os.times() is bogus

2008-12-13 Thread Martin v. Löwis
Changes by Martin v. Löwis : Removed file: http://bugs.python.org/file9514/os_times2.PATCH ___ Python tracker ___ ___ Python-bugs-list maili

[issue1040026] os.times() is bogus

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Committed os_times5.patch into 2.5 branch as r67739 Applying this to the other branches still needs to be done. -- assignee: gregory.p.smith -> loewis priority: release blocker -> deferred blocker resolution: -> accepted

[issue3767] tkColorChooser may fail if no color is selected

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Thanks for the patch. Committed tkColorChooser.diff as r67738 in the 2.5 branch. Applying this to the other branches still needs to be done. -- assignee: -> loewis nosy: +loewis priority: release blocker -> deferred blocker resolution: -> accepted

[issue3106] speedup some comparisons

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a new patch without any dispatch shortcut in ceval.c, just optimizations in unicodeobject.c and longobject.c. Net result on pybench: Test minimum run-timeaverage run-time thisothe

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Changes by Mark Dickinson : Removed file: http://bugs.python.org/file12338/bit_length_pybench.patch ___ Python tracker ___ ___ Python-bugs-list

[issue4342] (Tkinter) Please backport these

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: I have backported r59654 as r67737. As indicated, the other patches are not suitable for backporting. -- resolution: -> fixed status: open -> closed ___ Python tracker __

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: Added another test to pybench; it makes sense to consider cases where the input n is uniformly distributed in [0, 2**31) as well as cases where the output n.bit_length() is uniformly distributed in [0, 32). Added file: http://bugs.python.org/file12340/bit_le

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Changes by Mark Dickinson : Removed file: http://bugs.python.org/file12337/bit_length7_opt.patch ___ Python tracker ___ ___ Python-bugs-list ma

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: Slightly improved optimized version. Added file: http://bugs.python.org/file12339/bit_length7_opt.patch ___ Python tracker ___ _

[issue2996] IDLE "find in files" output not formatted optimally

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: I can't reproduce the problem. It works fine for me. -- nosy: +loewis priority: release blocker -> normal ___ Python tracker ___ __

[issue1683] Thread local storage and PyGILState_* mucked up by os.fork()

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Committed fork-thread-patch-2 as r67736 into 2.5 branch. -- status: open -> closed ___ Python tracker ___ _

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: > Well, I don't think bit_length() warrants a specific test which will > slow down the whole pybench suite. Me neither. It's a temporary patch to pybench, to establish whether it's worth applying optimizations to bit_length. I didn't intend that it should b

[issue4071] ntpath.abspath fails for long str paths

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: As it is apparently not clear what change exactly needs to be applied to 2.5, I'm declaring that this fix will not be backported. I would appreciate if somebody could summarize what still needs to be done, or (if nothing needs to be done), close this issue. -

[issue3248] ScrolledText can't be placed in a PanedWindow

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Committed for 2.5 as r67735. It still needs to be applied to the other branches. -- priority: release blocker -> deferred blocker ___ Python tracker __

[issue3863] 2.6rc1: test_threading hangs on FreeBSD 6.3 i386

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Backported to 2.5 as r67734. -- nosy: +loewis resolution: -> fixed status: open -> closed ___ Python tracker ___ _

[issue4228] struct.pack('L', -1)

2008-12-13 Thread Martin v. Löwis
Changes by Martin v. Löwis : -- priority: normal -> deferred blocker ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue4228] struct.pack('L', -1)

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Thanks for the patch. Committed (along with a test case) as r67733, in the 2.5 branch. Porting to the other branches still needs to happen. Armin, if you want to make these changes, please go ahead. -- priority: release blocker -> normal resolution:

[issue4303] [2.5 regression] ctypes fails to build on arm-linux-gnu

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: As the ARM buildbot is still down, we have no way of analysing or fixing this problem, so I'm closing this as "won't fix". -- resolution: -> wont fix status: open -> closed ___ Python tracker

[issue4368] A bug in ncurses.h still exists in FreeBSD 4.9 - 4.11

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Thanks for the patch. Committed as r67732. -- nosy: +loewis resolution: -> fixed status: open -> closed ___ Python tracker ___ ___

[issue4446] Distutils Metadata Documentation Missing "platforms" Keyword

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Thanks for the patch. Committed for 2.5 as r67731; integration into the other branches still needs to happen. -- assignee: loewis -> georg.brandl priority: release blocker -> normal versions: -Python 2.5, Python 2.5.3

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, I don't think bit_length() warrants a specific test which will slow down the whole pybench suite. pybench tracks interpreter speed for common and generally useful operations, while I think bit_length() is only a niche method. -- nosy: +pitrou ___

[issue4469] CVE-2008-5031 multiple integer overflows

2008-12-13 Thread Martin v. Löwis
Martin v. Löwis added the comment: Backported r55839 and r61350, as r67726 -- nosy: +loewis resolution: -> fixed status: open -> closed ___ Python tracker ___ __

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Changes by Mark Dickinson : Added file: http://bugs.python.org/file12338/bit_length_pybench.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Changes by Mark Dickinson : Added file: http://bugs.python.org/file12337/bit_length7_opt.patch ___ Python tracker ___ ___ Python-bugs-list mail

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: Three files: (1) bit_length7.patch just does the numbits->bit_length renaming; otherwise it's the same as numbits-6b.patch. (2) bit_length7_opt.patch uses the fast bitcount method that Raymond pointed out. (3) bit_length_pybench.patch adds a test for bit

[issue4649] Fix a+b to a + b

2008-12-13 Thread Retro
Retro added the comment: What is recommended in PEP 8, you are engouraged to follow that; not you as a Python coder but you as a member of the Python community where PEP 8 is the coding style specification. Python's built-in modules have such a lovely coding style because they all follow PEP 8.

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: > Did you look at the O(lg n) algorithm yet? Any thoughts? So there are two places this could be applied: the int_numbits method and _PyLong_NumBits. I'd be quite surprised if this offered any noticeable speedup in either case. Might be worth a try, thoug

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: It was probably true. The issue is how well the words self-separate visually and whether an underscore would create a detrimental mental pause. So fromkeys() and fromhex() read fine and would feel awkward with an underscore. But bitlength causes me a menta

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: > I thought I recalled Guido having a preference for float.fromhex over Can't find anything to back this up. It looks like I'm just making this up. ___ Python tracker __

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: > Perhaps n.bit_length() with an underscore. I thought I recalled Guido having a preference for float.fromhex over float.from_hex when that got implemented. But either spelling seems good to me. ___ Python tracker

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Perhaps n.bit_length() with an underscore. The name sounds good to my ear and sensibilities. ___ Python tracker ___ _

[issue3439] create a numbits() method for int and long types

2008-12-13 Thread Mark Dickinson
Mark Dickinson added the comment: About the name: Java's Bignum has a 'significantBits' method, which apparently returns the position of the MSB (i.e., numbits - 1). GMP has mpz_sizeinbase; mpz_sizeinbase(n, 2) is almost the same as numbits, except that mpz_sizeinbase(0, 2) is 1, not 0. Ma

[issue4630] IDLE no longer respects .Xdefaults insertOffTime

2008-12-13 Thread Mark Summerfield
Mark Summerfield added the comment: Although I stand by my criticism of IDLE not offering the option of switching off cursor blink, I've now discovered that the problem was with Fedora 10 no longer executing xrdb .Xdefaults; once I added that line to my .bash_profile the cursor blinking stopped.

[issue4654] os.path.realpath() get the wrong result

2008-12-13 Thread dirlt
New submission from dirlt : I found the problem when i install a small tool which I wrote on the each machine in the company.the problem is simplified as follows: there are three files 1./home/share/temp/a a regular file 2./home/share/a.lnk which is symbolic link to the /home/share/temp/a 3./home