[issue4654] os.path.realpath() get the wrong result
New submission from dirlt zhang_...@baidu.com: 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/share/temp/test.py whose contents are #!/usr/bin/env python import os import sys print sys.version print os.uname() print os.path.realpath(/home/share/temp/../a.lnk) print os.path.abspath(/home/share/temp/../a.lnk) and I ran the python script on two different machines,but the version of python interpreters are the same,and both of them are 64 bits machine, but the result of os.path.realpath is different,one is 2.3.4 (#1, Feb 2 2005, 11:44:13) [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] ('Linux', 'tc-com-test00.tc.baidu.com', '2.6.9-52bs', '#2 SMP Fri Jan 26 13:34:38 CST 2007', 'x86_64') /home/share/a.lnk /home/share/a.lnk another is --- 2.3.4 (#1, Dec 11 2007, 05:28:55) [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] ('Linux', 'tc-ecom-dev00.tc.baidu.com', '2.6.9-52bs', '#2 SMP Fri Jan 26 13:34:38 CST 2007', 'x86_64') /home/share/temp/temp/a /home/share/a.lnk But obviously the first one os.path.realpath(...) should be /home/share/temp/a instead of /home/share/a.lnk and the second on os.path.realpath(...) should also be /home/share/temp/a instaed of /home/share/temp/temp/a -- components: Library (Lib) messages: 77719 nosy: dirlt severity: normal status: open title: os.path.realpath() get the wrong result type: behavior versions: Python 2.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4654 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4630] IDLE no longer respects .Xdefaults insertOffTime
Mark Summerfield m...@qtrac.eu 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. However, that is no help to people using Windows for whom the only solution is to manually edit the EditorWindow.py file every time they install a new version of Python. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4630 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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. Mathematica has BitLength. I quite like this. Googling for 'ilog2' returns a good few relevant hits; again, this is really numbits - 1, not numbits. How about n.bitlength? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Perhaps n.bit_length() with an underscore. The name sounds good to my ear and sensibilities. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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 rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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 rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Raymond Hettinger rhettin...@users.sourceforge.net 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 mental double-take when my mind searches for the word separation. It that case, PEP 8 suggests that an underscore be added for clarity. This is probably why Mathematica chose BitLength in titlecase instead of Bitlength. Logic aside, bit_length() just looks and feels better to me. Did you look at the O(lg n) algorithm yet? Any thoughts? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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, though---I'll see if I can get some timings. For int_numbits, it would have to be implemented in a way that works for 32-bit and 64-bit C longs. And if it also just happens to work for other sizes, that would be good, too. I'd probably try something like: while (v 0x) { bitcount += 32; v = 32; } before doing a 32-bit bitcount on what's left. On a 32-bit machine, the whole while loop should just be optimized away to nothing. Similarly, in _PyLong_NumBits it would be good if it could be implemented in a way that doesn't have to change if/when PyLong_SHIFT is changed. I prefer the second variant given (the non-branching version). ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4649] Fix a+b to a + b
Retro vinet...@gmail.com 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. Why must the documentation be an exception not to follow PEP 8? Is there a technical reason? And the lack of space is not an issue. PEP 8 makes it clear to use spaces around arithmetic operators and then it gives some examples what is acceptable and what is not. Let us look at this again, shall we? Yes: i = i + 1 No: i=i+1 Let us convert this into our version from the example code: Yes: a, b = b, a + b No: a,b=b,a+b Only the a+b part is not written according to PEP 8. Python beginners don't start learning the language by first reading PEP 8. They don't even know it exists; and since they are beginners, talking about the coding style is too soon. What they do first is read the Python tutorial and they look at how code is written in the tutorial and get used to that. And so if the code is badly written there, they will also write bad code (bad as in 'with a bad coding style'). So we must set an example for Python beginners (and also other people) to write good-coding-style code. So my point is that people won't need to read PEP 8 if that is applied into the documentation (especially the tutorial); they'll just look at some example code and know how to write code. Please fix those things like a+b to a + b and n//x to n // x. I have added mister van Rossum into this issue report, because I think we need a BDFL opinion. What do you think, mister van Rossum, about this? -- nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4649 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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_length to pybench. On my system (OS X 10.5.5/Core 2 Duo), on a 32-bit non-debug build of the trunk, pybench is showing me a 4-5% speedup for the optimized version. (I also tried a version that uses gcc's __builtin_clzl function; this was around 10% faster than the basic version, but of course it's not portable.) Added file: http://bugs.python.org/file12336/bit_length7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Added file: http://bugs.python.org/file12337/bit_length7_opt.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Added file: http://bugs.python.org/file12338/bit_length_pybench.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4469] CVE-2008-5031 multiple integer overflows
Martin v. Löwis mar...@v.loewis.de added the comment: Backported r55839 and r61350, as r67726 -- nosy: +loewis resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4469 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Antoine Pitrou pit...@free.fr 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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4446] Distutils Metadata Documentation Missing platforms Keyword
Martin v. Löwis mar...@v.loewis.de 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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4446 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4368] A bug in ncurses.h still exists in FreeBSD 4.9 - 4.11
Martin v. Löwis mar...@v.loewis.de added the comment: Thanks for the patch. Committed as r67732. -- nosy: +loewis resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4368 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4303] [2.5 regression] ctypes fails to build on arm-linux-gnu
Martin v. Löwis mar...@v.loewis.de 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 rep...@bugs.python.org http://bugs.python.org/issue4303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4228] struct.pack('L', -1)
Martin v. Löwis mar...@v.loewis.de 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: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4228 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4228] struct.pack('L', -1)
Changes by Martin v. Löwis mar...@v.loewis.de: -- priority: normal - deferred blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4228 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3248] ScrolledText can't be placed in a PanedWindow
Martin v. Löwis mar...@v.loewis.de 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 rep...@bugs.python.org http://bugs.python.org/issue3248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4071] ntpath.abspath fails for long str paths
Martin v. Löwis mar...@v.loewis.de 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. -- priority: release blocker - normal versions: -Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4071 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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 be applied to the trunk. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1683] Thread local storage and PyGILState_* mucked up by os.fork()
Martin v. Löwis mar...@v.loewis.de added the comment: Committed fork-thread-patch-2 as r67736 into 2.5 branch. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1683 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2996] IDLE find in files output not formatted optimally
Martin v. Löwis mar...@v.loewis.de added the comment: I can't reproduce the problem. It works fine for me. -- nosy: +loewis priority: release blocker - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2996 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com added the comment: Slightly improved optimized version. Added file: http://bugs.python.org/file12339/bit_length7_opt.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Removed file: http://bugs.python.org/file12337/bit_length7_opt.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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_length_pybench.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Removed file: http://bugs.python.org/file12338/bit_length_pybench.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4342] (Tkinter) Please backport these
Martin v. Löwis mar...@v.loewis.de 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 rep...@bugs.python.org http://bugs.python.org/issue4342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3106] speedup some comparisons
Antoine Pitrou pit...@free.fr 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 thisother diffthisother diff --- CompareFloats: 166ms 170ms -2.3% 169ms 174ms -2.8% CompareFloatsIntegers: 230ms 231ms -0.7% 233ms 231ms +0.8% CompareIntegers: 247ms 270ms -8.7% 248ms 272ms -9.0% CompareInternedStrings: 196ms 254ms -22.7% 197ms 255ms -22.7% CompareLongs: 143ms 158ms -9.0% 143ms 158ms -9.3% CompareStrings: 156ms 168ms -7.4% 157ms 169ms -7.2% --- Totals: 1139ms 1252ms -9.1% 1148ms 1260ms -8.9% The patch seems fairly uncontroversial to me, I'll commit it soon if there's no opposition. Added file: http://bugs.python.org/file12341/cmps5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3106 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3767] tkColorChooser may fail if no color is selected
Martin v. Löwis mar...@v.loewis.de 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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3767 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Martin v. Löwis mar...@v.loewis.de 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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Changes by Martin v. Löwis mar...@v.loewis.de: Removed file: http://bugs.python.org/file9514/os_times2.PATCH ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Changes by Martin v. Löwis mar...@v.loewis.de: Removed file: http://bugs.python.org/file9518/os_times3.PATCH ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Changes by Martin v. Löwis mar...@v.loewis.de: Removed file: http://bugs.python.org/file9541/posixmodule.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Changes by Martin v. Löwis mar...@v.loewis.de: Removed file: http://bugs.python.org/file9542/test_posix5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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 readable. It's pretty much what Raymond suggested in the first place, plus a table lookup. Added file: http://bugs.python.org/file12342/bit_length7_opt2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1706039] Added clearerr() to clear EOF state
Martin v. Löwis mar...@v.loewis.de 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 rep...@bugs.python.org http://bugs.python.org/issue1706039 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3106] speedup some comparisons
Raymond Hettinger rhettin...@users.sourceforge.net 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 rep...@bugs.python.org http://bugs.python.org/issue3106 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Raymond Hettinger rhettin...@users.sourceforge.net 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 rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4649] Fix a+b to a + b
Guido van Rossum gu...@python.org 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 code should or should not be formatted according to the style guidelines. (This is as opposed to the syntax of the language, which is an absolute set of rules where violations raise a SyntaxError.) In this case, the PEP never meant to say that all arithmetic operators have to be surrounded by spaces. That would make just as little sense as requiring no spaces. The words in the PEP cannot possibly approximate the set of heuristics I have in my mind for this purpose, and I don't think they have to. When I wrote PEP 8 (or actually its precursor), I was merely *suggesting* that certain uses of spaces look better than others. If you are interpreting this as requiring all examples needing to follow the literal style guide, well, Im sorry, but that's not how it was meant, and I am not willing to either change the examples (the specific one you quote looks just fine to me) or to edit the PEP to try and formulate a more complex rule. In my experience, the more baroque the rule the more arguments it elicits. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4649 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4651] getopt need re-factor...
Guido van Rossum gu...@python.org 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: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4651 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Removed file: http://bugs.python.org/file12332/numbits-6b.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3106] speedup some comparisons
Antoine Pitrou pit...@free.fr 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 rep...@bugs.python.org http://bugs.python.org/issue3106 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Fredrik Johansson fredrik.johans...@gmail.com 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 value as ``x.bit_length()``? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary
Antoine Pitrou pit...@free.fr 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: enc = codecs.getincrementalencoder('utf16')('strict') enc.encode('\r') b'\xff\xfe\r\x00' enc.encode('\r') b'\r\x00' I think breaking the API can be ok since the original API is broken (witness this bug). There can even be a compatibility mode where we check whether `encoding` has an encode() method, and if it has, take it as the decoder object rather than the encoding name. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4574 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com 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 rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Removed file: http://bugs.python.org/file12342/bit_length7_opt2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Removed file: http://bugs.python.org/file12339/bit_length7_opt.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3439 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary
Changes by Antoine Pitrou pit...@free.fr: ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4574 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary
Antoine Pitrou pit...@free.fr 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 rep...@bugs.python.org http://bugs.python.org/issue4574 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary
Antoine Pitrou pit...@free.fr 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 rep...@bugs.python.org http://bugs.python.org/issue4574 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Gregory P. Smith g...@krypto.org 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 rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4574] reading UTF16-encoded text file crashes if \r on 64-char boundary
Gregory P. Smith g...@krypto.org 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 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4574 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3978] ZipFileExt.read() can be incredibly slow; patch included
Antoine Pitrou pit...@free.fr 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 tracker rep...@bugs.python.org http://bugs.python.org/issue3978 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4561] Optimize new io library
Antoine Pitrou pit...@free.fr added the comment: Christian, by benchmarks I meant a measurement of text reading with and without the patch. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4561 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4583] segfault when mutating memoryview to array.array when array is resized
Antoine Pitrou pit...@free.fr 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 rep...@bugs.python.org http://bugs.python.org/issue4583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4653] Patch to fix typos for Py3K
Antoine Pitrou pit...@free.fr added the comment: I don't know Windows APIs but the pythonrun.c bug is genuine. -- nosy: +pitrou priority: - high type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4016] improve linecache: reuse tokenize.detect_encoding() and io.open()
Changes by Antoine Pitrou pit...@free.fr: -- priority: - normal stage: - patch review versions: +Python 3.1 -Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4653] Patch to fix typos for Py3K
Johnny Lee typo...@gmail.com added the comment: Here are the URLs to the MSDN documentation for CreateFileMapping and FormatMessage[A|W]: http://msdn.microsoft.com/en-us/library/aa366537.aspx http://msdn.microsoft.com/en-us/library/ms679351.aspx For CreateFileMapping(), from the Return Value section: If the function fails, the return value is NULL. To get extended error information, call GetLastError. For FormatMessage[A|W]: nSize [in] If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the size of the output buffer, in TCHARs. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Changes by Martin v. Löwis mar...@v.loewis.de: Added file: http://bugs.python.org/file9542/test_posix5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Martin v. Löwis mar...@v.loewis.de 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; thanks for pointing this out. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4653] Patch to fix typos for Py3K
Johnny Lee typo...@gmail.com 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 convert the if-statement to a separate function and call that function with fout and then ferr. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4163] textwrap wordsep_re Unicode
Antoine Pitrou pit...@free.fr added the comment: Fixed in r67746 and r67747. Thanks for the patch! -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4258] Use 30-bit digits instead of 15-bit digits for Python integers.
Antoine Pitrou pit...@free.fr 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 usec per loop - 3.1: 0.302 usec per loop - 3.1 + patch: 0.225 usec per loop ./python -m timeit -s a=1;b=77 a+b - 2.6: 0.173 usec per loop - 3.1: 0.229 usec per loop - 3.1 + patch: 0.217 usec per loop But it seems there are some outliers: ./python -m timeit -s a=1**5+1;b=77**3 a//b - 2.6: 1.13 usec per loop - 3.1: 1.12 usec per loop - 3.1 + patch: 1.2 usec per loop -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4258 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4258] Use 30-bit digits instead of 15-bit digits for Python integers.
STINNER Victor victor.stin...@haypocalc.com 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 is small (4%) on 32 bits CPU. But don't trust benchmarks :-p ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4258 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4655] setup.py should not use .pydistutils.cfg
New submission from Jake jah.mailingl...@gmail.com: 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 PYTHONPATH, I ran into import issues. The problem was due to a forgotten file: ~/.pydistutils.cfg So this is clearly a user error, but I wonder if it is something which should be avoided at the setup.py level. When installing python, the installation locations are derived from the results of ./configure. When setup.py is eventually called, the installation locations can change. This seems undesirable. Would it be better if setup.py instructed distutils to ignore any configuration file so that the installation directories matched what was used by the rest of 'make install'? Related: http://bugs.python.org/issue1180 -- components: Installation messages: 1 nosy: jah severity: normal status: open title: setup.py should not use .pydistutils.cfg type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4655 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4223] inspect.getsource doesn't work on functions imported from a zipfile
Nick Coghlan ncogh...@gmail.com 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). In this particular case, it was the differences between the way the two relate for a package vs a normal module that was confusing linecache, but for more exotic cases the filesystem based rules that linecache was attempting to enforce may be completely irrelevant. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4223 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4655] during Python installation, setup.py should not use .pydistutils.cfg
Changes by Jake jah.mailingl...@gmail.com: -- title: setup.py should not use .pydistutils.cfg - during Python installation, setup.py should not use .pydistutils.cfg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4655 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4523] logging module __init__ uses has_key
Benjamin Peterson musiccomposit...@gmail.com added the comment: Fixed in r67748. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4512] Add get_filename method to zipimport
Nick Coghlan ncogh...@gmail.com 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__) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4512 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [issue4631] urlopen returns extra, spurious bytes
Does the same thing happen with 2.6? Jeremy On Thu, Dec 11, 2008 at 8:53 AM, Jean-Paul Calderone rep...@bugs.python.org wrote: Jean-Paul Calderone exar...@divmod.com 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 different transfer encoding. -- nosy: +exarkun ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4631 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4656] Python 3 tutorial has old information about dicts
New submission from Matthew Cowles mdcow...@users.sourceforge.net: [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 arbitrary order if you want it sorted, just apply the sort() method to the list of keys But in What's New in Python 3.0 at: http://docs.python.org/3.0/whatsnew/3.0.html it says: dict methods dict.keys(), dict.items() and dict.values() return “views” instead of lists. For example, this no longer works: k = d.keys(); k.sort(). Use k = sorted(d) instead I expect that it's just a matter of updating the tutorial. -- assignee: georg.brandl components: Documentation messages: 6 nosy: georg.brandl, mdcowles severity: normal status: open title: Python 3 tutorial has old information about dicts versions: Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com