[issue4580] slicing of memoryviews when itemsize != 1 is wrong
Nick Coghlan ncogh...@gmail.com added the comment: I still don't see the problem: Py_buffer is a minimal description of a region of memory. No more, no less. It doesn't *do* anything, it's just a description. memoryview is an object that will (when it's finished) provide an easy way to access the memory of another object. Having a fairly raw low level API (Py_buffer/PyObject_GetBuffer/PyBuffer_Release) and a higher level, more convenient, but higher overhead API (memoryview) seems like a perfectly natural split to me. Multi-level APIs are a great way of freeing the more abstract interface from the need to handle every single possible edge case - we can quite reasonably tell people that care about the more obscure edge cases to drop down a level and handle them with the raw API. We just need to finish the job of making the convenience wrapper actually able to handle the task we would like it to handle. Your latest patch goes a long way towards doing that for the 1 dimensional case - if Travis doesn't get to it first, I plan on taking a look a closer look at it this weekend. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4580 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4580] slicing of memoryviews when itemsize != 1 is wrong
Nick Coghlan ncogh...@gmail.com added the comment: Trying another way of getting the point across... if Py_buffer wasn't defined in PEP 3118, there would have to be some *other* API there whereby the memoryview implementation could ask an object for a description of the data layout of the object's buffer. It is Py_buffer which allows the implementation of memoryview to even be contemplated. The one point where the PEP is silent (and I think this might be what you've been attempting to get at) is as to whether or not it is OK for a client to *modify* the contents of the Py_buffer structure before passing it back in to PyBuffer_Release. And to that I would say that a robust type implementation shouldn't be assuming *anything* about the contents of the Py_buffer passed to PyBuffer_Release. If it needs to do more than decrement a reference count when the buffer is released (e.g. releasing memory allocated for shapes and strides information), then it should be doing its own internal bookkeeping based on the address of the Py_buffer object originally passed to PyObject_GetBuffer. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4580 ___ ___ 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
Guilherme Polo ggp...@gmail.com added the comment: On Wed, Dec 10, 2008 at 6:44 AM, Martin v. Löwis rep...@bugs.python.org wrote: Martin v. Löwis mar...@v.loewis.de added the comment: What problem is solved by ScrolledText.diff that isn't already solved by scrolledtext_masterstr.diff? None. The later is a cleanup of ScrolledText.py. ___ 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
[issue4342] (Tkinter) Please backport these
Guilherme Polo ggp...@gmail.com added the comment: On Wed, Dec 10, 2008 at 6:15 AM, Martin v. Löwis rep...@bugs.python.org wrote: Martin v. Löwis mar...@v.loewis.de added the comment: I'm skeptical about backporting r59654. Doing so might break existing applications. I don't see in what way it would break existing applications. The indices returned by that command in Tcl should all be represented as strings in Python, so I see this at max causing a double attempt to convert it to str. ___ 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
[issue4342] (Tkinter) Please backport these
Guilherme Polo ggp...@gmail.com added the comment: On Wed, Dec 10, 2008 at 6:21 AM, Martin v. Löwis rep...@bugs.python.org wrote: Martin v. Löwis mar...@v.loewis.de added the comment: Can you remind me what problem was fixed with r59653? I can't find the Tk tracker anymore on which this apparently was reported. I had trouble finding it too, it was redirected to somewhere else and marked as private because of spam. I asked a tk developer for the issue and he kindly pasted the comments here: http://paste.tclers.tk/1381?v=raw I didn't want to go offtopic here but it raises a question about handling bgerror and I don't know where else I should ask this so.. I have been working on a new _tkinter (before I went traveling, back now) and I have been supporting the use of bgerror but would like to know what kind of problems it used to cause to Tkinter or _tkinter. For IDLE specifically I had to disable it. If it fixes a problem with supporting Tcl 8.5, then I will also reject the request. Supporting Tcl 8.5 is a new feature, and should thus not be added to 2.5.3. Only Tcl up to 8.4 is support by Python 2.5. But if it doesn't affect anything in the current usage, why not backport such patch ? Even though you can say that tcl 8.5 is not supported by python 2.5, _tkinter doesn't enforce this. ___ 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
[issue4639] Build failure on OpenBSD 4.4-current regarding lstat()
New submission from Edd vex...@gmail.com: Hi, I just had to move the extern lstat... outside the ifndef HAVE_LSTAT to get python 2.6.1 to build on OpenBSD 4.4-current/i386. I'm not suggesting this is correct, but it fixes the build for my platform at least. --- Modules/posixmodule.c.orig Fri Dec 12 11:08:54 2008 +++ Modules/posixmodule.c Fri Dec 12 11:54:16 2008 @@ -208,10 +208,11 @@ #ifdef HAVE_SYMLINK extern int symlink(const char *, const char *); #endif /* HAVE_SYMLINK */ +#endif /* !HAVE_UNISTD_H */ + #ifdef HAVE_LSTAT extern int lstat(const char *, struct stat *); #endif /* HAVE_LSTAT */ -#endif /* !HAVE_UNISTD_H */ #endif /* !_MSC_VER */ Im using gcc-4.2 Thanks -- components: Build messages: 77667 nosy: vext01 severity: normal status: open title: Build failure on OpenBSD 4.4-current regarding lstat() type: compile error versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4639 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4640] optparse - dosn't distinguish between '--option' and '-option'
New submission from Krzysztof Szawala kszaw...@slb.com: I am using optparse for command-line parameters parsing. To follow common naming convention I defined -d (minus followed by a single character option) and --debug (double minus followed by a word). It looks like optparse doesn't complain when -debug (single minus) is specified and morover it doesn't recognize it as --debug. I am using Python 2.5.2. Problem was observed on Linux but also occurs on Windows. -- components: Extension Modules messages: 77668 nosy: kszawala severity: normal status: open title: optparse - dosn't distinguish between '--option' and '-option' type: behavior versions: Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4640 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4641] optparse - dosn't distinguish between '--option' and '-option'
New submission from Krzysztof Szawala kszaw...@slb.com: I am using optparse for command-line parameters parsing. To follow common naming convention I defined -d (minus followed by a single character option) and --debug (double minus followed by a word). It looks like optparse doesn't complain when -debug (single minus) is specified and morover it doesn't recognize it as --debug. I am using Python 2.5.2. Problem was observed on Linux but also occurs on Windows. -- components: Extension Modules messages: 77669 nosy: kszawala severity: normal status: open title: optparse - dosn't distinguish between '--option' and '-option' type: behavior versions: Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4642] optparse - dosn't distinguish between '--option' and '-option'
New submission from Krzysztof Szawala kszaw...@slb.com: I am using optparse for command-line parameters parsing. To follow common naming convention I defined -d (minus followed by a single character option) and --debug (double minus followed by a word). It looks like optparse doesn't complain when -debug (single minus) is specified and morover it doesn't recognize it as --debug. I am using Python 2.5.2. Problem was observed on Linux but also occurs on Windows. -- components: Extension Modules messages: 77670 nosy: kszawala severity: normal status: open title: optparse - dosn't distinguish between '--option' and '-option' type: behavior versions: Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4642 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4580] slicing of memoryviews when itemsize != 1 is wrong
Antoine Pitrou pit...@free.fr added the comment: We just need to finish the job of making the convenience wrapper actually able to handle the task we would like it to handle. Your latest patch goes a long way towards doing that for the 1 dimensional case - if Travis doesn't get to it first, I plan on taking a look a closer look at it this weekend. Ok, thanks. I hope we can at least solve this bunch of severe problems before 3.0.1 :-) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4580 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4643] cgitb.html fails if getattr call raises exception
New submission from Allan Crooks a...@users.sourceforge.net: If cgitb.html tries to get the value of an attribute from an object, and the getattr call causes an exception to be raised (other than an AttributeError), then cgitb.html fails to work: If you run the attached file in Python 2.5.2 or 2.6, you get the following output: A: the letter a B: Something went wrong - attempting to generate HTML stack trace. Error generating HTML stack trace! Traceback (most recent call last): File attrtest.py, line 21, in module html_text = cgitb.html(sys.exc_info()) File C:\python26\lib\cgitb.py, line 133, in html vars = scanvars(reader, frame, locals) File C:\python26\lib\cgitb.py, line 84, in scanvars value = getattr(parent, token, __UNDEF__) File attrtest.py, line 8, in __getattr__ return str(slf) # Intentional NameError NameError: global name 'slf' is not defined The problem is in the scanvars function - it offers no protection against any unexpected exceptions that occur (that escape the getattr call) - which can be a problem if it is the same problematic code that caused cgitb.html to be called in the first place. I think scanvars should catch any exceptions that come from the getattr call and either mention that the attribute value could not be determined, or simply omit the mention of the attribute at all. If the line in the attached file is commented out, then the next line is caught appropriately and formatted correctly (the offending code occurs in the same block, but doesn't cause the same problem because it raises an AttributeError). -- components: Library (Lib) files: attrtest.py messages: 77672 nosy: amc1 severity: normal status: open title: cgitb.html fails if getattr call raises exception versions: Python 2.5.3, Python 2.6, Python 3.0 Added file: http://bugs.python.org/file12330/attrtest.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4643 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4644] Minor documentation fault in 2to3 script
New submission from Allan Crooks a...@users.sourceforge.net: When I run the following command: C:\temp\python26\Tools\scripts\2to3.py --help Usage: refactor.py [options] file|dir ... It mentions that the script name is refactor.py, rather than 2to3.py (I guess that was the scripts original name?) -- components: 2to3 (2.x to 3.0 conversion tool) messages: 77673 nosy: amc1 severity: normal status: open title: Minor documentation fault in 2to3 script type: behavior versions: Python 2.6, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4644 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4643] cgitb.html fails if getattr call raises exception
Changes by Allan Crooks a...@users.sourceforge.net: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4643 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4616] tarfile does not set the creation date and time of the extracted directories
Lars Gustäbel l...@gustaebel.de added the comment: I checked the necessary changes in the trunk and the py3k, release26-maint, and release30-maint branches (r67717-r67720). Thank you for your report. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4616 ___ ___ 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: Victor, This looks good. If it's okay with you, I'll work on the documentation a little (we need an entry in whatsnew, and a description of the semantics of numbits for 0 and negative integers.) Then I think this will be ready. I prefer to keep the fast path (use _PyLong_NumBits) as *you* proposed in another message: Message75767. Sorry---I wasn't clear. I wasn't suggesting getting rid of the fast path---I was suggesting inlining the _PyLong_NumBits code in long_numbits (leaving _PyLong_NumBits itself intact, of course). It would eliminate all the messing around with exceptions. But I think the current code is fine. ___ 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
STINNER Victor victor.stin...@haypocalc.com added the comment: I'll work on the documentation Ok, cool. a description of the semantics of numbits for 0 and negative integers About the negative integer: the documentation should be number of bits of the *absolute value* of x and by convention, 0.numbits() is 0. But you're right, the documentation is not clear. ___ 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: Here's Victor's patch, but with extra documentation. No code has been changed. Two more questions about the code, Victor; specifically about long_numbits: - why do you use PyLong_FromSize_t rather than PyInt_FromSize_t? - isn't the if (ndigits == 0) check redundant? ___ 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: Oops. Here's the patch. Added file: http://bugs.python.org/file12331/numbits-6a.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
[issue4642] optparse - dosn't distinguish between '--option' and '-option'
Mark Dickinson dicki...@gmail.com added the comment: Duplicate of issue #4640. -- nosy: +marketdickinson resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4642 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4641] optparse - dosn't distinguish between '--option' and '-option'
Mark Dickinson dicki...@gmail.com added the comment: Duplicate of issue #4640. -- nosy: +marketdickinson resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4641 ___ ___ 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
STINNER Victor victor.stin...@haypocalc.com added the comment: - why do you use PyLong_FromSize_t rather than PyInt_FromSize_t? I choosed to use consistent result type. But now I would prefer int :-) I see that PyInt_FromSize_t() returns a long if the value doesn't fit in an int. So it's correct. - isn't the if (ndigits == 0) check redundant? I'm paranoid: if _PyLong_NumBits() fails but the number is zero, the function may crash. But this case is impossible: _PyLong_NumBits() can only fails with an OverflowError. Can you fix these two issues (use PyInt_FromSize_t and remove the if)? ___ 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 choosed to use consistent result type. But now I would prefer int :-) I see that PyInt_FromSize_t() returns a long if the value doesn't fit in an int. So it's correct. Cool. I think int is better, simply because the result is almost always going to fit into an int in practice, and because calculations with ints are faster. I'm paranoid Yeah, me too. I removed the check, but also changed the assert to check that Py_SIZE is nonzero. Can you fix these two issues (use PyInt_FromSize_t and remove the if)? Done. Added 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
[issue3439] create a numbits() method for int and long types
Changes by Mark Dickinson dicki...@gmail.com: Removed file: http://bugs.python.org/file12331/numbits-6a.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
[issue4640] optparse - dosn't distinguish between '--option' and '-option'
David W. Lambert lamber...@corning.com added the comment: When I use it on python 3 optparse reports no such option -e, which is correct since the form -debug permits a run of single character options. -- nosy: +LambertDW ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4640 ___ ___ 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()
STINNER Victor victor.stin...@haypocalc.com added the comment: It was easy to remove the itertools dependency: only itertools.chain() was really used and a simple for ...: yield is enough to get the same behaviour (test_tokenize.py runs fine). With the new version of the patch, the bootstrap works correctly. Added file: http://bugs.python.org/file12333/linecache_refactor-2.patch ___ 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
[issue4016] improve linecache: reuse tokenize.detect_encoding() and io.open()
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file11678/linecache_refactor.patch ___ 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
[issue3439] create a numbits() method for int and long types
Mark Dickinson dicki...@gmail.com added the comment: As far as I'm concerned, this patch is ready to be applied. Raymond, care to give a second opinion? -- assignee: marketdickinson - rhettinger stage: patch review - commit review ___ 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
[issue4645] configparser DEFAULT
New submission from Shawn Ashlee shawn.ash...@rackspace.com: using .add_section() and .set() for the DEFAULT section adds it twice: [u...@srv ~]$ cat test_configparser.py #!/usr/bin/env python import ConfigParser a = ConfigParser.SafeConfigParser() # borked a.add_section('DEFAULT') a.set('DEFAULT', 'foo', 'bar') # working a.add_section('working') a.set('working', 'foo', 'bar') b = open('testing', 'w') a.write(b) b.close() [u...@srv ~]$ python test_configparser.py [u...@srv ~]$ cat testing [DEFAULT] foo = bar [DEFAULT] [working] foo = bar Tested with 2.4 and 2.5, py3k no longer allows DEFAULT to be passed, so this is a python 3k issue. -- components: Extension Modules messages: 77686 nosy: shawn.ashlee severity: normal status: open title: configparser DEFAULT versions: Python 2.4, Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4645 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4646] distutils chokes on empty options arg in the setup function
New submission from Thomas Heller thel...@ctypes.org: Distutils setup function accepts an 'options' named argument which allows to pass options to subcommands in a dictionary (At the moment I cannot find where this is documented). When an empty dictionary is passed, distutils spits out a warning: C:\sf\comtypespy3 setup.py clean c:\python30\lib\distutils\dist.py:259: UserWarning: Unknown distribution option: 'options' warnings.warn(msg) running clean ... I believe the bug is in all versions of Python; since it never has been fixed (or even found) I'm not sure if it is worth fixing. However, patch is attached. -- components: Distutils files: distutils.patch keywords: patch, patch messages: 77687 nosy: theller severity: normal status: open title: distutils chokes on empty options arg in the setup function type: behavior versions: Python 2.5.3, Python 2.6, Python 2.7, Python 3.0 Added file: http://bugs.python.org/file12334/distutils.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4646 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4477] Speed up PyEval_EvalFrameEx when tracing is off.
Jeffrey Yasskin jyass...@gmail.com added the comment: Merged to 3.1 in r67611, 3.0.x in r67721, and 2.6.x in r67722. -- keywords: -needs review status: open - closed versions: +Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4477 ___ ___ 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: The code looks fine. For speed, you could insert the following just before the while-loop: while (n = 256) { n = 8; result += 8; } Am not sure the numbits is the right-name. Is there precedent in other languages or texts on bit-twiddling techniques? For numbits(0b0100), I could forsee people predicting a result of 4, 3, or 1 depending on their world-view of what numbits might mean. Personally, I tend to think in term of high-bit location or somesuch. ___ 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
[issue4647] Builtin parser module fails to parse relative imports
New submission from Kay Schluehr k...@fiber-space.de: I've added the following test method: test_parser.py -- class RoundtripLegalSyntaxTestCase(unittest.TestCase): def test_relative_import_statement(self): self.check_suite(from . import sys) The test fails raising the message: Traceback (most recent call last): File test_parser.py, line 182, in test_relative_import_statement self.check_suite(from . import sys) File test_parser.py, line 29, in check_suite self.roundtrip(parser.suite, s) File test_parser.py, line 20, in roundtrip self.fail(could not roundtrip %r: %s % (s, why)) AssertionError: could not roundtrip 'from . import sys': Expected node type 1, got 23. Apparently the parser expects a NAME token and gets a DOT token. This behaviour affects Python 2.5 and Python 2.6. Unchecked for Python 3.0. -- components: Interpreter Core messages: 77690 nosy: schluehk severity: normal status: open title: Builtin parser module fails to parse relative imports type: behavior versions: Python 2.5, Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4647 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4617] SyntaxError when free variable name is also an exception target
Terry J. Reedy tjre...@udel.edu added the comment: -1 as I understand the proposal. Your code is bugged and should fail as soon as possible. If I understand correctly, you agree that the SyntaxError is correct as the language is currently defined, but you want the definition changed. It is not clear if you only want implicit deletes at the end of except clauses to work or if you only want explicit deletes to work. If the latter, you want def f(): e = 1 del e def g(): print(e) return g to compile. I would not. Your reason After all, the variable referenced has no value before it is set, (duh, right) makes no sense to me in this context. g must have a valid value of e to run. So you seem to be suggesting that detection of buggy code should be delayed. -- nosy: +tjreedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4617 ___ ___ 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 don't see in what way it would break existing applications. The indices returned by that command in Tcl should all be represented as strings in Python, so I see this at max causing a double attempt to convert it to str. I can't quite follow your terminology: what indices? I can imagine many cases where conversion using Python's str() gives a different result than the conversion through Tcl objects. For example, if Python returns a bool, 2.5 will pass 'True' to Tcl. 2.6 will convert this to a Tcl boolean, whose string representation is '1'. If you are saying that the Python command *should* return strings always, then this assumption is precisely a candidate for breakage: people might currently be returning all kinds of things to Tcl in callbacks (even outside Tkinter), and we might break these applications. ___ 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
[issue4617] SyntaxError when free variable name is also an exception target
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Not sure the del e idea was a good solution to the garbage collection problem. Amaury's code looks correct to me. Maybe the existing e variable should be overwritten and the left intact (as it used to be) or perhaps it should be made both temporary and invisible like the induction variable in a list comprehension. Phillip, any thoughts? -- assignee: - pje nosy: +pje, rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4617 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4648] Fix n//x to n/x in the Docs
New submission from Retro vinet...@gmail.com: Please look at the example code in the following Python 3.0 documentation/tutorial: http://docs.python.org/3.0/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops The line 4 has a little fix to be made: from ... print(n, 'equals', x, '*', n//x) to ... print(n, 'equals', x, '*', n/x) You probably noticed that n//x was proposed to be fixed to n/x. Please note that this is Python 3.0 code. It's a small fix so I hope you won't mind to fix this. -- assignee: georg.brandl components: Documentation messages: 77694 nosy: Retro, georg.brandl severity: normal status: open title: Fix n//x to n/x in the Docs versions: Python 3.0, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4648 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4648] Fix n//x to n/x in the Docs
Martin v. Löwis mar...@v.loewis.de added the comment: The code is correct as it stands. If you still think this is a problem, please explain why you think the example should be changed. -- nosy: +loewis resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4648 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4617] SyntaxError when free variable name is also an exception target
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Terry, my motivation is that the sample code above runs correctly with python 2.6, but python 3.0 cannot even compile it. The sample looks valid python code, and should run. Yes, the same 'e' is used both as a nested variable and as an exception target, but this should not matter with our dynamic language. First I thought to turn the implicit del e into something else (and change PEP3110), but then I saw that the error can not delete variable referenced in nested scope is actually a limitation of the interpreter that is easy to remove. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4617 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4342] (Tkinter) Please backport these
Guilherme Polo ggp...@gmail.com added the comment: On Fri, Dec 12, 2008 at 9:06 PM, Martin v. Löwis rep...@bugs.python.org wrote: Martin v. Löwis mar...@v.loewis.de added the comment: I don't see in what way it would break existing applications. The indices returned by that command in Tcl should all be represented as strings in Python, so I see this at max causing a double attempt to convert it to str. I can't quite follow your terminology: what indices? I can imagine many cases where conversion using Python's str() gives a different result than the conversion through Tcl objects. For example, if Python returns a bool, 2.5 will pass 'True' to Tcl. 2.6 will convert this to a Tcl boolean, whose string representation is '1'. If you are saying that the Python command *should* return strings always, then this assumption is precisely a candidate for breakage: people might currently be returning all kinds of things to Tcl in callbacks (even outside Tkinter), and we might break these applications. Are we talking about the same commit ? 59654 as in your original about it breaking existing code. ___ 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
[issue4648] Fix n//x to n/x in the Docs
Retro vinet...@gmail.com added the comment: For Python 2.x that example code is fine, but Python 3.0 has this switched now. Please read http://www.python.org/dev/peps/pep-0238/. True division in Python 3.0 is done with one division operator. Please fix that code example to reflect that. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4648 ___ ___ 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: Are we talking about the same commit ? 59654 as in your original about it breaking existing code. Oops, no. I now see that r59654 is fine for backporting. My last message was about r59653, which probably does introduce backward compatibility problems. The other changes seem to introduce new features, so they are out of scope. ___ 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
[issue4648] Fix n//x to n/x in the Docs
Martin v. Löwis mar...@v.loewis.de added the comment: For Python 2.x that example code is fine, but Python 3.0 has this switched now. Please read http://www.python.org/dev/peps/pep-0238/. True division in Python 3.0 is done with one division operator. Please fix that code example to reflect that. I still don't understand. The example doesn't, and shouldn't, use true division. It does, and should, use floor division, to display the divisors of a non-prime. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4648 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4648] Fix n//x to n/x in the Docs
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Retro, the code is correct as it stands. Floor division is intended (int // int -- int). I think you've misunderstood true division where the / operator used to mean floor division when supplied with integer arguments but now returns a float instead. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4648 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4645] configparser DEFAULT
Quentin Gallet-Gilles qgal...@gmail.com added the comment: This is already fixed in 2.6 since r60976, the related issue is #1781 I'm not sure this is a good candidate for 2.4.6 and 2.5.3 : this isn't a security fix, but I doubt fixing this would break existing code as I can't imagine people relying on this behavior. Adding Martin to the nosy list so he can pronounce. -- nosy: +loewis, quentin.gallet-gilles ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4645 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4617] SyntaxError when free variable name is also an exception target
Phillip J. Eby p...@telecommunity.com added the comment: I could argue either way on this one; it's true that deleting a nested-scope variable is sometimes desirable, but it also seems to me like closing over an except: variable is a Potentially Bad Idea. In neither case, however, do I think it's appropriate to drop the temporary nature of the variable. I could perhaps get behind resetting the variable to None instead of deleting it, but of course the PEP would need changing. There's also a question of whether we should do the same thing with with ... as variables. (Btw, I'm not sure why this one's assigned to me; ISTM I might have proposed the current except/as GC semantics, but I'm not familiar with the actual implementation in 2.6 or 3.0) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4617 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4617] SyntaxError when free variable name is also an exception target
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Guido, any thoughts? -- assignee: pje - gvanrossum nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4617 ___ ___ 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
New submission from Retro vinet...@gmail.com: http://docs.python.org/3.0/tutorial/controlflow.html#defining-functions Please visit the above link and see line 6 in the example code. ... a, b = b, a+b should be fixed to ... a, b = b, a + b because PEP 8 recommends to - Use spaces around arithmetic operators: Yes: i = i + 1 No: i=i+1 -- assignee: georg.brandl components: Documentation messages: 77705 nosy: Retro, georg.brandl, loewis, rhettinger severity: normal status: open title: Fix a+b to a + b versions: Python 2.5, Python 2.5.3, Python 2.6, Python 2.7, Python 3.0, Python 3.1 ___ 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
[issue4649] Fix a+b to a + b
Retro vinet...@gmail.com added the comment: And please fix the code example mentioned in issue4648. Line 4 has a little fix to be made: from ... print(n, 'equals', x, '*', n//x) to ... print(n, 'equals', x, '*', n // x) ___ 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
[issue4647] Builtin parser module fails to parse relative imports
Benjamin Peterson musiccomposit...@gmail.com added the comment: This has been fixed in 2.6.1 and will be in 2.5.3. -- nosy: +benjamin.peterson resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4647 ___ ___ 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
David W. Lambert lamber...@corning.com added the comment: I do think your interpretation of PEP8 is overly strict. Here's the source code of the first j interpreter. (Ken Iverson) typedef char C;typedef long I; typedef struct a{I t,r,d[3],p[2];}*A; #define P printf #define R return #define V1(f) A f(w)A w; #define V2(f) A f(a,w)A a,w; #define DO(n,x) {I i=0,_n=(n);for(;i_n;++i){x;}} I *ma(n){R(I*)malloc(n*4);}mv(d,s,n)I *d,*s;{DO(n,d[i]=s[i]);} tr(r,d)I *d;{I z=1;DO(r,z=z*d[i]);R z;} A ga(t,r,d)I *d;{A z=(A)ma(5+tr(r,d));z-t=t,z-r=r,mv(z-d,d,r); R z;} V1(iota){I n=*w-p;A z=ga(0,1,n);DO(n,z-p[i]=i);R z;} V2(plus){I r=w-r,*d=w-d,n=tr(r,d);A z=ga(0,r,d); DO(n,z-p[i]=a-p[i]+w-p[i]);R z;} V2(from){I r=w-r-1,*d=w-d+1,n=tr(r,d); A z=ga(w-t,r,d);mv(z-p,w-p+(n**a-p),n);R z;} V1(box){A z=ga(1,0,0);*z-p=(I)w;R z;} V2(cat){I an=tr(a-r,a-d),wn=tr(w-r,w-d),n=an+wn; A z=ga(w-t,1,n);mv(z-p,a-p,an);mv(z-p+an,w-p,wn);R z;} V2(find){} V2(rsh){I r=a-r?*a-d:1,n=tr(r,a-p),wn=tr(w-r,w-d); A z=ga(w-t,r,a-p);mv(z-p,w-p,wn=nwn?wn:n); if(n-=wn)mv(z-p+wn,z-p,n);R z;} V1(sha){A z=ga(0,1,w-r);mv(z-p,w-d,w-r);R z;} V1(id){R w;}V1(size){A z=ga(0,0,0);*z-p=w-r?*w-d:1;R z;} pi(i){P(%d ,i);}nl(){P(\n);} pr(w)A w;{I r=w-r,*d=w-d,n=tr(r,d);DO(r,pi(d[i]));nl(); if(w-t)DO(n,P( );pr(w-p[i]))else DO(n,pi(w-p[i]));nl();} C vt[]=+{~#,; A(*vd[])()={0,plus,from,find,0,rsh,cat}, (*vm[])()={0,id,size,iota,box,sha,0}; I st[26]; qp(a){R a='a'a='z';}qv(a){R a'a';} A ex(e)I *e;{I a=*e; if(qp(a)){if(e[1]=='=')R st[a-'a']=ex(e+2);a= st[ a-'a'];} R qv(a)?(*vm[a])(ex(e+1)):e[1]?(*vd[e[1]])(a,ex(e+2)):(A)a;} noun(c){A z;if(c'0'||c'9')R 0;z=ga(0,0,0);*z-p=c-'0';R z;} verb(c){I i=0;for(;vt[i];)if(vt[i++]==c)R i;R 0;} I *wd(s)C *s;{I a,n=strlen(s),*e=ma(n+1);C c; DO(n,e[i]=(a=noun(c=s[i]))?a:(a=verb(c))?a:c);e[n]=0;R e;} main(){C s[99];while(gets(s))pr(ex(wd(s)));} -- nosy: +LambertDW ___ 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
[issue4644] Minor documentation fault in 2to3 script
Benjamin Peterson musiccomposit...@gmail.com added the comment: Thanks for the report! Fixed in r67723. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4644 ___ ___ 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: Let's set a good example in the documentation and follow PEP 8. For God's sake, this is the documentation of Python! Where else to set a good example than here? Let's see some PEP 8 in action, in the documentation! ___ 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
[issue4649] Fix a+b to a + b
David W. Lambert lamber...@corning.com added the comment: That phrase of PEP 8 means to me Use spaces to visually group expressions according to precedence. ___ 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
[issue4649] Fix a+b to a + b
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This is silly. The current version better communicates its intended purpose. -- resolution: - wont fix status: open - closed ___ 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
[issue4605] 3.0 documentation mentions using maketrans from within the string module.
Benjamin Peterson musiccomposit...@gmail.com added the comment: Thanks for the report! Fixed in r67724. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4605 ___ ___ 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: FWIW, here is a link to faster algorithms: http://www-graphics.stanford.edu/~seander/bithacks.html#IntegerLog ___ 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
[issue4650] getopt need re-factor...
New submission from Wang Chun yaohua2...@gmail.com: I created #4629 a couple of days ago. And besides that issue, for Python 3.x, I guess we can remove getopt.error since Python 3.x does not have to backward compatible with Python 2.x. And another issue is, GetoptError does not render right error message with unicode_literals enabled in Python 2.6. -- components: Library (Lib) messages: 77715 nosy: wangchun severity: normal status: open title: getopt need re-factor... versions: Python 3.0, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4650 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4651] getopt need re-factor...
New submission from Wang Chun yaohua2...@gmail.com: I created #4629 a couple of days ago. And besides that issue, for Python 3.x, I guess we can remove getopt.error since Python 3.x does not have to backward compatible with Python 2.x. And another issue is, GetoptError does not render right error message with unicode_literals enabled in Python 2.6. -- components: Library (Lib) messages: 77716 nosy: wangchun severity: normal status: open title: getopt need re-factor... versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 ___ 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
[issue4616] tarfile does not set the creation date and time of the extracted directories
Changes by Lars Gustäbel l...@gustaebel.de: -- resolution: - fixed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4616 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4652] IDLE does not work with Unicode
New submission from Aki Wakabayashi zzyzx2...@gmail.com: I have installed python 3.0 on Ubuntu 8.10 yesterday and played around with the new unicode features and had no problems with Japanese characters(both in interactive and script mode). However, after rebooting, IDLE will no longer let me input any Japanese characters. (I have it set to UFT-8, if it makes any difference anymore) The terminal works fine. It lets me input Japanese and runs commands correctly. So I used gedit and saved a simple print(Hello(in Japanese chars)), and run it with IDLE 3.0 but I get a blank line . (Can I also make sure that I'm opening IDLE correctly? This is how I do it: 1)Open Terminal 2)~$ Python.3.0 3) input idlelib.idle Thank You in advance. -- components: IDLE messages: 77717 nosy: zzyzx severity: normal status: open title: IDLE does not work with Unicode type: performance versions: Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4652 ___ ___ 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
New submission from Johnny Lee typo...@gmail.com: I ran my typo.pl perl script that locates possible C/C++ typos. I found four that looked valid. Two of the typos were in the Python directory {pythonrun.c, dynload_win.c}, two were in PC/bdist_wininst {install.c, extract.c}. Python/dynload_win.c: Win32 API FormatMessageW() expects the 6th parameter to be the count of characters, NOT the count of bytes. Python/pythonrun.c: The source code contains if (ferr != NULL || ferr != Py_None). This does not work as expected - if ferr == NULL, then the second part of the if expression will succeed. Look at the code handling fout about 8 lines up to see the correct code. PC/bdist_wininst/extract.c: Win32 API CreateFileMapping returns NULL on error, not INVALID_HANDLE_VALUE. PC/bdist_wininst/install.c: Win32 API CreateFileMapping returns NULL on error, not INVALID_HANDLE_VALUE. -- components: Installation, Interpreter Core files: py30diff.txt messages: 77718 nosy: typo.pl severity: normal status: open title: Patch to fix typos for Py3K versions: Python 3.0 Added file: http://bugs.python.org/file12335/py30diff.txt ___ 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