[issue8017] c_char_p.value does not return a bytes object in Windows.

2010-02-24 Thread DavidCzech
New submission from DavidCzech : c_char_p.value doesn't return a bytes object on Windows. http://docs.python.org/3.1/library/ctypes.html#fundamental-data-types states that c_char_p is either a "bytes object or None" in Python, not str. -- test_c_bug.py -- import ctypes test_stri

[issue7232] Support of 'with' statement fo TarFile class

2010-02-24 Thread Meador Inge
Meador Inge added the comment: Built on Brian's patch by adding the following items: * Added a unit test case to cover exceptional conditions. * Added doc strings on __enter__ and __exit__ (more consistent with the surrounding code). * Spelling error in doc update: s/manaager/mana

[issue6247] should we include argparse

2010-02-24 Thread R. David Murray
R. David Murray added the comment: PEP 389 has been accepted. -- components: +Library (Lib) -Extension Modules priority: -> normal resolution: -> accepted stage: -> committed/rejected status: open -> closed ___ Python tracker

[issue8011] traceback tb_lineno example needs correction for Python3

2010-02-24 Thread Ezio Melotti
Ezio Melotti added the comment: I think this can be changed on 2.x as well, since the traceback.tb_lineno function "has no use in versions past 2.3" (so maybe it should be deprecated too, at least in the doc). Also the except should catch an IndexError. -- assignee: georg.brandl -> ez

[issue8014] Setting a T_INT attribute raises internal error

2010-02-24 Thread Benjamin Peterson
Benjamin Peterson added the comment: 2010/2/24 Mark Dickinson : > > Mark Dickinson added the comment: > > Here's a patch that raises TypeError if either PyLongAs_Size_t or > PyLong_As_Ssize_t gets called with a valid non-integer PyObject *. > > I'm not sure where the most appropriate place for

[issue6722] collections.namedtuple: confusing example

2010-02-24 Thread Vincent Borghi
Vincent Borghi added the comment: In fact, thanks to the person (Alexey Shamrin) who created this issue (issue found while googling for "namedtuple"), I have understood the namedtuple example in the documentation. I think like him the verbose=True example that cames first is very confusing.

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-24 Thread Vlastimil Brom
Vlastimil Brom added the comment: Thanks, its indeed a very nice addition to the library... Just a marginal remark; it seems, that in script-names also some non BMP characters are covered, however, in the unicode ranges thee only BMP. http://www.unicode.org/Public/UNIDATA/Blocks.txt Am I missi

[issue3871] cross and native build of python for mingw32 with distutils

2010-02-24 Thread Roumen Petrov
Roumen Petrov added the comment: updated patch to trunk: - apply cleanly - support builddir <> sourcedir - regression tests pass if run from any drive (windows hosts) -- Added file: http://bugs.python.org/file16364/python-trunk-20100225-MINGW.patch _

[issue8014] Setting a T_INT attribute raises internal error

2010-02-24 Thread Mark Dickinson
Mark Dickinson added the comment: Here's a patch that raises TypeError if either PyLongAs_Size_t or PyLong_As_Ssize_t gets called with a valid non-integer PyObject *. I'm not sure where the most appropriate place for a test is. -- assignee: -> mark.dickinson keywords: +patch priority

[issue8014] Setting a T_INT attribute raises internal error

2010-02-24 Thread Mark Dickinson
Mark Dickinson added the comment: Might it be T_PYSSIZET rather than T_INT? In which case it's PyLong_AsSsize_t that's at fault: it should raise TypeError for non-integers. What's slightly less clear is whether PyLong_AsSsize_t should also try to call int to convert to int, as PyLong_AsLon

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Ezio Melotti wrote: > Just to clarify: > "u'%c' % some_int" should behave like unichr(some_int); > "u'%c' % some_chr" should behave like "u'%s' % some_chr". That's correct. I guess that in practice "u'%c' % some_chr" is not all that common. Otherwise, the

[issue8014] Setting a T_INT attribute raises internal error

2010-02-24 Thread Benjamin Peterson
Benjamin Peterson added the comment: It seems that T_INT uses PyLong_AsLong to get a integer, and 2.x uses PyInt_AsLong. PyInt_AsLong tries to convert the number to an integer, but PyLong_AsLong just throws up if the type is not correct. Mark, thoughts? -- nosy: +benjamin.peterson, ma

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-24 Thread Matthew Barnett
Matthew Barnett added the comment: issue2636-20100224.zip is a new version of the regex module. It includes support for matching based on Unicode scripts as well as on Unicode blocks and properties. -- Added file: http://bugs.python.org/file16362/issue2636-20100224.zip

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Ezio Melotti
Ezio Melotti added the comment: Just to clarify: "u'%c' % some_int" should behave like unichr(some_int); "u'%c' % some_chr" should behave like "u'%s' % some_chr". -- ___ Python tracker _

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Ezio Melotti
Ezio Melotti added the comment: At least from point of view, the difference between ints and chars is: * "u'%c' % 0xB5" means "create a Unicode char with codepoint 0xB5", i.e. the Unicode char µ U+00B5 MICRO SIGN; * "u'%c' % '\xB5'" means "create a Unicode char converting the byte '\xB5' to Un

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Eric Smith
Eric Smith added the comment: Of course. Sorry about that. But then why not copy unichr()? It calls PyUnicode_FromOrdinal. I guess my real question is: Should "'%c' % i" be identical to "chr(i)" and should "u'%c' % i" be identical to "unichr(i)"? And by "identical" I mean return the same re

[issue5965] Format Specs: doc 's' and implicit conversions

2010-02-24 Thread Eric Smith
Eric Smith added the comment: That looks good. I tweaked it a little and fixed a few other problems with the patch. New patch attached. -- Added file: http://bugs.python.org/file16360/issue5965-1.diff ___ Python tracker

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Eric Smith
Eric Smith added the comment: I'm working on a similar issue for int.__format__('c'). What's not clear to me is why this doesn't work the same as chr(i). That is, shouldn't chr(i) == ('%c' % i) hold for i in range(256)? And if that's so, why not just copy chr's implementation: if (x

[issue7900] posix.getgroups() failure on Mac OS X

2010-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Wed, Feb 24, 2010 at 12:45 PM, Martin v. Löwis wrote: .. > I still think that the sysconf version should be the correct one. If OSX > fails to work correctly under > that version, and causes Python to raise an exception - then that's a > platform bug

[issue8015] pdb "commands" command throws you into postmortem if you enter an empty command

2010-02-24 Thread Ilya Sandler
New submission from Ilya Sandler : Here is a sample session: cheetah:~/comp/python/trunk> ./python ./Lib/pdb.py hello > /home/ilya/comp/python/trunk/hello(1)() -> print i (Pdb) b 1 Breakpoint 1 at /home/ilya/comp/python/trunk/hello:1 (Pdb) commands 1 (com) Traceback (most recent call l

[issue8013] time.asctime segfaults when given a time in the far future

2010-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Looks like a case of missing null check. Patch attached. -- keywords: +patch nosy: +Alexander.Belopolsky Added file: http://bugs.python.org/file16359/issue8013.diff ___ Python tracker

[issue7900] posix.getgroups() failure on Mac OS X

2010-02-24 Thread Martin v . Löwis
Martin v. Löwis added the comment: I still think that the sysconf version should be the correct one. If OSX fails to work correctly under that version, and causes Python to raise an exception - then that's a platform bug, and should only accept minimal work arounds. So I propose to close this

[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Looks good. A documentation typo: gmtime() -- convert seconds since Epoch to UTC tuple\n\ +timegm() - Convert a UTC tuple to seconds since the Epoch.\n\ Note the use of -- in the existing items. I understand that the choice of float for return value

[issue8014] Setting a T_INT attribute raises internal error

2010-02-24 Thread Walter Dörwald
New submission from Walter Dörwald : In the current py3k branch setting an attribute of an object with PyMemberDefs raises an internal error: $ ./python.exe Python 3.2a0 (py3k:78419M, Feb 24 2010, 17:56:06) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "l

[issue8013] time.asctime segfaults when given a time in the far future

2010-02-24 Thread Wilfredo Sanchez
Wilfredo Sanchez added the comment: I get this on Python 2.6, not 2.5. And it seems to be limited to 64-bit. -- ___ Python tracker ___ __

[issue4199] add shorthand global and nonlocal statements

2010-02-24 Thread Jeremy Hylton
Jeremy Hylton added the comment: I guess there's some question about whether the syntax in the PEP was considered carefully when it was approved. If so, I'm not sure that we want to re-open the discussion. On the other hand, it's been a long time since the PEP was approved and we do have a mor

[issue4111] Add Systemtap/DTrace probes

2010-02-24 Thread Skip Montanaro
Skip Montanaro added the comment: Jesus> can I ask if this (very useful) feature is on time for Python 2.7? You can ask, but I suspect you'd be disappointed in the answer. Do you have time to look at the issue? The biggest sticking point in my mind is coming up with a uniform set of probes wh

[issue7309] crasher in str(Exception())

2010-02-24 Thread Eric Smith
Eric Smith added the comment: > A much better solution would IMHO be to forbid setting the encoding, > object and reason attributes to objects of the wrong type in the first > place. Unfortunately this would require an extension to PyMemberDef for > the T_OBJECT and T_OBJECT_EX types. Agreed th

[issue7309] crasher in str(Exception())

2010-02-24 Thread Walter Dörwald
Walter Dörwald added the comment: On 24.02.10 15:28, Eric Smith wrote: > Eric Smith added the comment: > > Fixed: > > trunk: r78418 > release26-maint: r78419 > > Still working on porting to py3k and release31-maint. A much better solution would IMHO be to forbid setting the encoding, objec

[issue8011] traceback tb_lineno example needs correction for Python3

2010-02-24 Thread Michael Newman
New submission from Michael Newman : In the second example given in "27.8.1. Traceback Examples" at: http://docs.python.org/3.1/library/traceback.html http://docs.python.org/py3k/library/traceback.html which has the lumberjack: The last line won't work in Python 3.1 and 3.2: print("*** tb_linen

[issue5965] Format Specs: doc 's' and implicit conversions

2010-02-24 Thread Eric Smith
Eric Smith added the comment: Here's my proposed changes. Please review. I put the string type 's' into its own table. That's probably overkill, but I think it gets lost if it's just mentioned in the text. Feel free to change that, though. Also, I'm not wild about my wording for the int->flo

[issue7958] test_platform failure on OS X 10.6

2010-02-24 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Looking at the code, the whole approach to finding the project base appears to be very fragile. I'd suggest to use a landmark file for finding the project base, say "Modules/main.c", and a function which searches all directories on the os.path.realpath(s

[issue5965] Format Specs: doc 's' and implicit conversions

2010-02-24 Thread Eric Smith
Eric Smith added the comment: I think the only remaining issue here is that 's' isn't documented. The exceptions are now more meaningful, and commas have been documented. -- versions: +Python 3.2 -Python 3.0 ___ Python tracker

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Ezio Melotti
Ezio Melotti added the comment: Ok, adding a fast path shouldn't make the code more complicated, so I'll include it in the patch, thanks for the feedback. -- ___ Python tracker

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Marc-André's remark was that if char<0x80 (the vast majority), it's not necessary to call any decode function: just copy the byte. Other cases (error, or non-default encoding) may use a slower path. -- ___ Py

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Ezio Melotti
Ezio Melotti added the comment: I was trying to decode mainly to get a UnicodeDecodeError automatically. If I check if the char is not in the ASCII range (i.e. >0x7F) I think I'd have to set the error message for the UnicodeDecodeError manually and possibly duplicate it (unless we use a differ

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Amaury Forgeot d'Arc wrote: > > Amaury Forgeot d'Arc added the comment: > >>> But why is it necessary to check for chars above 0x7f? >> The Python default encoding has to be ASCII compatible, > Yes, but it is not necessarily as strict. > for example, afte

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > > But why is it necessary to check for chars above 0x7f? > The Python default encoding has to be ASCII compatible, Yes, but it is not necessarily as strict. for example, after I manage to set the default encoding to latin-1, u"%s" % chr(0x80) works; I su

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Amaury Forgeot d'Arc wrote: > > Amaury Forgeot d'Arc added the comment: > >> Could you please check for chars above 0x7f first and then use >> PyUnicode_Decode() instead of the PyUnicode_FromStringAndSize() API > > I concur: PyUnicode_FromStringAndSize()

[issue8010] tkFileDialog.askopenfiles crashes on Windows 7

2010-02-24 Thread Patrick Holz
New submission from Patrick Holz : When using the function "tkFileDialog.askopenfiles()" on Windows 7 (32-bit) the following error occurs after choosing one or more arbitrary files: Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit(Intel)] on win32 Type "help", "copyright", "

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > Could you please check for chars above 0x7f first and then use > PyUnicode_Decode() instead of the PyUnicode_FromStringAndSize() API I concur: PyUnicode_FromStringAndSize() decodes with utf-8 whereas the expected conversion char->unicode should use the

[issue8004] add small program to serve docs

2010-02-24 Thread Éric Araujo
Éric Araujo added the comment: Indeed, I forgot the hard-coded path has been removed, and didn’t notice the makefile was in Doc. Perfect then, and thanks for pointing these things to my sleepy self :) -- ___ Python tracker

[issue4199] add shorthand global and nonlocal statements

2010-02-24 Thread Georg Brandl
Georg Brandl added the comment: > I also notice that the Grammar in the PEP is more complicated: > nonlocal_stmt ::= > "nonlocal" identifier ("," identifier)* >["=" (target_list "=")+ expression_list] > | "nonlocal" identifier augop expression_list > > The Grammar in the p

[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()

2010-02-24 Thread Francesco Del Degan
Francesco Del Degan added the comment: Those are the new updated patches with ifdef wrapped timegm function, docs, and a conversion test. -- Added file: http://bugs.python.org/file16351/timemodule-gmtime-2-trunk.diff ___ Python tracker

[issue1441530] socket read() can cause MemoryError in Windows

2010-02-24 Thread Márcio Faustino
Márcio Faustino added the comment: I've been also receiving the same error while using "imaplib.IMAP4_SSL" to download large e-mails. A simple change in the "read" and "readline" functions to use instead a "cStringIO.StringIO" buffer object works for me. -- nosy: +marcio ___

[issue7649] "u'%c' % char" broken for chars in range '\x80'-'\xFF'

2010-02-24 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: > --- python/trunk/Objects/unicodeobject.c (original) > > +++ python/trunk/Objects/unicodeobject.cWed Feb 24 00:16:07 2010 > > @@ -8170,6 +8170,7 @@ > > size_t buflen, > > PyObject *v) > > { > > +PyObject *s; > > /*