[issue16563] re.match loops forever on simple regexp

2012-11-27 Thread Mark Dickinson
Mark Dickinson added the comment: Closing as a duplicate of issue 1662581. -- nosy: +mark.dickinson resolution: - duplicate status: open - closed superseder: - the re module can perform poorly: O(2**n) versus O(n**2) ___ Python tracker

[issue1662581] the re module can perform poorly: O(2**n) versus O(n**2)

2012-11-27 Thread Mark Dickinson
Mark Dickinson added the comment: Given the number of times this comes up, I think it's a least worth an upgrade from 'low' priority to 'normal' priority. -- priority: low - normal versions: +Python 3.4 -Python 3.3 ___ Python tracker

[issue16560] Python sighandlers delayed for no reason

2012-11-27 Thread Zdenek Pavlas
Zdenek Pavlas added the comment: This patch isn't safe Yes, it's broken. Does not work unless thread support was enabled, and locking initialized. There are probably other bugs, too. Not meant to be included, really. But IMO the correct implementation should work along these lines. the

[issue16563] re.match loops forever on simple regexp

2012-11-27 Thread Mark Dickinson
Mark Dickinson added the comment: @lpd: you may want to look at the 'regex' module on PyPI [1] to see if it solves your problems. The idea is that some form of this should eventually go into the standard library, but we've been lacking volunteers for the huge code review task involved. [1]

[issue2636] Adding a new regex module (compatible with re)

2012-11-27 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636 ___ ___

[issue16560] Python sighandlers delayed for no reason

2012-11-27 Thread Charles-François Natali
Charles-François Natali added the comment: the reason why signal handlers are called synchronously from the main loop is because you can't call arbitrary called on behalf of a signal handler: the must be async safe. Could you elaborate, please? Suppose Python has called a C module. From

[issue4945] json checks True/False by identity, not boolean value

2012-11-27 Thread anatoly techtonik
anatoly techtonik added the comment: On Tue, Nov 27, 2012 at 12:15 AM, Ezio Melotti rep...@bugs.python.orgwrote: I'm not sure the documentation should be changed. While boolean values are accepted, user should prefer True/False, so the fact that you can pass other things shouldn't be

[issue11175] allow argparse FileType to accept encoding and errors arguments

2012-11-27 Thread Lucas Maystre
Lucas Maystre added the comment: OK, I'll give it a try. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11175 ___ ___ Python-bugs-list mailing

[issue4945] json checks True/False by identity, not boolean value

2012-11-27 Thread Mark Dickinson
Mark Dickinson added the comment: user should prefer True/False I disagree: I don't see any reason why the normal duck-typing rules shouldn't hold here. So +1 for the documentation changes from me. -- nosy: +mark.dickinson ___ Python tracker

[issue16560] Python sighandlers delayed for no reason

2012-11-27 Thread Zdenek Pavlas
Zdenek Pavlas added the comment: for example, if you call malloc() from within a signal handler, you can get a deadlock or a crash if the signal was received while the process was in the middle of an malloc() call. Thanks, I see the problem. malloc() implements locking (when threads are

[issue13936] datetime.time(0, 0, 0) evaluates to False despite being a valid time

2012-11-27 Thread Danilo Bargen
Danilo Bargen added the comment: I disagree, I think this bug should be reopened and fixed. A use case that I just ran into: I'm using a Django form with time fields that aren't required, but that are only valid in combination (if there's a open time there has to be a close time). if not

[issue16564] email.generator.BytesGenerator fails with bytes payload

2012-11-27 Thread Alexander Kruppa
New submission from Alexander Kruppa: I'm trying to use the email.* functions to craft HTTP POST data for file upload. Trying something like filedata = open(data, rb).read() postdata = MIMEMultipart() fileattachment = MIMEApplication(filedata, _encoder=email.encoders.encode_noop)

[issue16564] email.generator.BytesGenerator fails with bytes payload

2012-11-27 Thread R. David Murray
R. David Murray added the comment: Yes, the way BytesGenerator works is basically a hack to get the email package itself working. Use cases outside the email package were not really considered in the (short) timeframe during which it was implemented. The longer term plan calls for redoing

[issue16564] email.generator.BytesGenerator fails with bytes payload

2012-11-27 Thread R. David Murray
R. David Murray added the comment: Hmm. Let me rephrase that. *Internally* it doesn't support bytes payloads, it encodes bytes payloads as surrogateescaped ascii, as you have oserved. Which is why this is on the borderline, and could possibly be considered a bug fix, because from an

[issue11175] allow argparse FileType to accept encoding and errors arguments

2012-11-27 Thread Lucas Maystre
Lucas Maystre added the comment: Added some documentation for the patch. Let me know what you think. -- Added file: http://bugs.python.org/file28139/filetype11175.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11175

[issue4945] json checks True/False by identity, not boolean value

2012-11-27 Thread Ezio Melotti
Ezio Melotti added the comment: I don't see any reason why the normal duck-typing rules shouldn't hold here. The rules should apply, the only problem is in the documentation. The documentation here could answer two questions: 1) what should I pass to these args to make them work? 2) can I

[issue16507] Patch selectmodule.c to support WSAPoll on Windows

2012-11-27 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16507 ___ ___

[issue16556] Update string.Formatter.vformat documentation to say **kwargs

2012-11-27 Thread Roundup Robot
Roundup Robot added the comment: New changeset d805982336a0 by Ezio Melotti in branch '2.7': #16556: Fix inconsistency between kwds and kwargs. Patch by Taavi Burns. http://hg.python.org/cpython/rev/d805982336a0 New changeset 565c3bbed7d3 by Ezio Melotti in branch '3.2': #16556: Fix

[issue16556] Update string.Formatter.vformat documentation to say **kwargs

2012-11-27 Thread Ezio Melotti
Ezio Melotti added the comment: The patch looked OK, so I committed it. Regarding similar cleanups I think it's OK to do them only if the inconsistency is in the same function. If different functions use kwds or kwargs in different places but they do it consistently, then it doesn't matter.

[issue16556] Update string.Formatter.vformat documentation to say **kwargs

2012-11-27 Thread Éric Araujo
Éric Araujo added the comment: Oh, I had totally missed that the mismatch was between the function signature in the docs and another part of the doc (I thought it was between the real function signature and the doc). Good catch! -- ___ Python

[issue16555] Add es_cu to locale aliases

2012-11-27 Thread Éric Araujo
Éric Araujo added the comment: Ah, ok. Sounds good to me. (I think this can go in stable branches, like other update to registries (e.g. mimetypes), but other core devs may disagree.) -- nosy: +lemburg, loewis title: Add es_cu to locale library. - Add es_cu to locale aliases

[issue4945] json checks True/False by identity, not boolean value

2012-11-27 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4945 ___ ___

[issue16562] Optimize dict equality test

2012-11-27 Thread Martin v . Löwis
Martin v. Löwis added the comment: The patch looks good to me. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16562 ___ ___

[issue4555] Smelly exports (global symbols in python not prefixed with Py or _Py)

2012-11-27 Thread Martin v . Löwis
Martin v. Löwis added the comment: I'd like to focus this issue; it has been open long enough, and deserves to get closed once the original issue is resolved - which was that make smelly reports symbols. I think dmalcolm's patch is quite a good start for that. It may well be that other

[issue16333] Trailing whitespace in json dump when using indent

2012-11-27 Thread Ezio Melotti
Ezio Melotti added the comment: Do you mean that when indentation is used, the separator only appears on line ends? Apparently: ./python -c 'from json import dumps; print(dumps([[[1,2,3]]*3]*3, indent=2))' -- ___ Python tracker

[issue16562] Optimize dict equality test

2012-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: And here is a synthetic microbenchmark: $ ./python -m timeit -s n=10**3; k=2; a={(i,)*k:i for i in range(n)}; b={(i,)*k:i for i in range(n)} a == b Vanilla: 251 usec per loop Patched: 195 usec per loop $ ./python -m timeit -s n=10**3; k=2; a={(i,)*k:i for

[issue4945] json checks True/False by identity, not boolean value

2012-11-27 Thread Chris Jerdonek
Chris Jerdonek added the comment: On the whole, the patch looks okay to me. I think we should strive for correctness in the documentation where possible. While keeping True would keep the forward implications correct and document the preferred value, there is often an implied assumption

[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames

2012-11-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: Victor, could you please backport to 3.3? -- assignee: ronaldoussoren - haypo nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___

[issue16565] Increase Py_AddPendingCall array size

2012-11-27 Thread Felipe Cruz
New submission from Felipe Cruz: Current pending calls limit is too small and it can be easily reached in very intensive async file io applications. There is a little hack in pyaio[1] which sleeps if Py_AddPendingCall returns 0 but It's not totally clear to me why the size of pendind calls

[issue16562] Optimize dict equality test

2012-11-27 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16562 ___ ___ Python-bugs-list

[issue16464] urllib.request: opener not resetting content-length

2012-11-27 Thread Roundup Robot
Roundup Robot added the comment: New changeset 618ea5612e83 by Andrew Svetlov in branch 'default': Issue #16464: reset Request's Content-Length header on .data change. http://hg.python.org/cpython/rev/618ea5612e83 -- nosy: +python-dev ___ Python

[issue16464] urllib.request: opener not resetting content-length

2012-11-27 Thread Andrew Svetlov
Andrew Svetlov added the comment: Pushed. Thanks, Alexey. -- versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16464 ___

[issue16464] urllib.request: opener not resetting content-length

2012-11-27 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- assignee: - asvetlov resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16464

[issue16566] Structure._anonymous_ should not allow strings

2012-11-27 Thread anatoly techtonik
New submission from anatoly techtonik: http://docs.python.org/2/library/ctypes.html#ctypes.Structure._anonymous_ An optional sequence that lists the names of unnamed (anonymous) fields. If you feed it a string, such as _offset, it will print a very interesting error: ... File

[issue16566] Structure._anonymous_ should not allow strings

2012-11-27 Thread anatoly techtonik
anatoly techtonik added the comment: s/A_OFFSET_UNION/_OFFSET_UNION/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16566 ___ ___

[issue16566] Structure._anonymous_ should not allow strings

2012-11-27 Thread anatoly techtonik
anatoly techtonik added the comment: The union definition for the curious: class _OFFSET(Structure): _fields_ = [ ('Offset', DWORD), ('OffsetHigh', DWORD)] class _OFFSET_UNION(Union): _anonymous_ = '_offset' _fields_ = [

[issue16566] Structure._anonymous_ should not allow strings

2012-11-27 Thread STINNER Victor
STINNER Victor added the comment: An optional sequence that lists the names of unnamed (anonymous) fields Yes, it must be a sequence. _anonymous_ = '_offset' This is a string, not a sequence. Just use _anonymous_ = ['_offset']. -- nosy: +haypo resolution: - invalid status: open -

[issue16203] Proposal: add re.fullmatch() method

2012-11-27 Thread Ezra Berch
Ezra Berch added the comment: Patch attached. I've taken a slightly different approach than what has been discussed here: rather than define a new fullmatch() function and method, I've defined a new re.FULLMATCH flag for match(). So an example would be re.match('abc','abc',re.FULLMATCH) The

[issue16566] Structure._anonymous_ should not allow strings

2012-11-27 Thread anatoly techtonik
anatoly techtonik added the comment: ctypes should throw proper exception if a string is used instead of sequence. It doesn't do this. -- resolution: invalid - status: closed - open ___ Python tracker rep...@bugs.python.org

[issue16438] Numeric operator predecence confusing

2012-11-27 Thread Ezio Melotti
Ezio Melotti added the comment: I'm still unable to figure out how to do it You could look at Doc/library/unittest.rst, there are some tables that span multiple lines. If you want a newline in the output too I think you have to add a blank line in the cell. --

[issue2537] re.compile(r'((x|y+)*)*') should fail

2012-11-27 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2537 ___ ___

[issue16566] Structure._anonymous_ should not allow strings

2012-11-27 Thread Meador Inge
Meador Inge added the comment: A string *is* a sequence. That is actually part of the problem. Consider a slight variation on the original repro case: class _OFFSET(Structure): ... _fields_ = [ ... ('Offset', c_int), ... ('OffsetHigh', c_int)] ... [70412 refs] class

[issue16438] Numeric operator predecence confusing

2012-11-27 Thread Kiet Tran
Kiet Tran added the comment: That document actually doesn't have any table that spans multiple lines. Here's the html page: http://docs.python.org/dev/library/unittest.html Actually, I already know how to make a table span multiple lines from this stackoverflow page:

[issue5066] IDLE documentation for Unix obsolete/incorrect

2012-11-27 Thread Todd Rovito
Todd Rovito added the comment: Version 2 of the patch change include: -help.txt removed all tabs and replaced with spaces, as suggested by Roger -help.txt re-inserted the section on running IDLE without a subprocess as suggested by Roger -Added a note on line 162 (idle.rst) about how the Python

[issue5066] IDLE documentation for Unix obsolete/incorrect

2012-11-27 Thread Todd Rovito
Todd Rovito added the comment: For version 2 of the patch -Line 340 (idle.rst) where the Emacs bindings are rendered seemed to work fine on my computer without the spaces but I think ezio is correct spaces should be present so I added them **SHOULD BE** -Line 340 (idle.rst) where the

[issue16566] Structure._anonymous_ should not allow strings

2012-11-27 Thread Nick Coghlan
Nick Coghlan added the comment: Yes, if you pass string when you meant to pass [string], you will often get awful error messages. This is one of the downsides of strings being iterable, but we're not going to add if isinstance(obj, str): throw TypeError(msg) special cases everywhere to

[issue16562] Optimize dict equality test

2012-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: The patch looks correct. If the tests pass, go ahead and apply it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16562 ___

[issue15990] solidify argument/parameter terminology

2012-11-27 Thread Chris Jerdonek
Chris Jerdonek added the comment: Attaching new patch to address Ezio's suggestions on Rietveld. I will also respond to those comments on Rietveld shortly. -- Added file: http://bugs.python.org/file28142/issue-15990-5-default.patch ___ Python

[issue15990] solidify argument/parameter terminology

2012-11-27 Thread Chris Jerdonek
Chris Jerdonek added the comment: For some reason, Rietveld is erroring out every time I try to reply to one of the comments. So I am pasting the reply below: [Issue in the Rietveld tracker here: http://code.google.com/p/rietveld/issues/detail?id=394 ] On 2012/11/26 22:07:50, ezio.melotti

[issue2927] expose html.parser.unescape

2012-11-27 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2927 ___ ___ Python-bugs-list

[issue16549] regression: -m json.tool module is broken

2012-11-27 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16549 ___ ___ Python-bugs-list

[issue16209] add a class str entry to the docs

2012-11-27 Thread Chris Jerdonek
Chris Jerdonek added the comment: Attaching new patch to address Ezio's suggestions on Rietveld. -- Added file: http://bugs.python.org/file28143/issue-16209-3-default.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16209

[issue15716] Ability to specify the PYTHONPATH via a command line flag

2012-11-27 Thread Brian Curtin
Brian Curtin added the comment: Colin - it should work in the same way that setting PYTHONPATH as an environment variable would work, e.g., semi-colon is the separator on Windows. -- nosy: +brian.curtin ___ Python tracker rep...@bugs.python.org

[issue16547] IDLE raises an exception in tkinter after fresh file's text has been rendered

2012-11-27 Thread Roger Serwy
Roger Serwy added the comment: I was able to trigger this problem on 2.7 as well. Changing type to behavior as the core interpreter is not crashing. Lukas, the only way I can trigger the traceback is by closing the editor while the colorizer is still colorizing. Clicking randomly on the

[issue1286] fileinput, StringIO, and cStringIO do not support the with protocol

2012-11-27 Thread Eric Snow
Eric Snow added the comment: Keep in mind that it's pretty easy to roll your own CM wrapper: @contextlib.contextmanager def closes(file): yield file file.close() Then you can do this: with closes(StringIO()) as test: test.write(hi!) return test.getvalue() This works for 2.5

[issue1286] fileinput, StringIO, and cStringIO do not support the with protocol

2012-11-27 Thread Ezio Melotti
Ezio Melotti added the comment: http://docs.python.org/2/library/contextlib.html#contextlib.closing -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1286 ___

[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2012-11-27 Thread Campbell Barton
Campbell Barton added the comment: patch attached, simply wraps putenv() -- keywords: +patch Added file: http://bugs.python.org/file28144/pyos_putenv.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16129

[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2012-11-27 Thread Christian Heimes
Christian Heimes added the comment: At first glance your proposed fix looks like an easy hack to get around the issue. However it's not going to work properly. Embedded Python interpreters should isolate themselves from the user's environment. When `Py_IgnoreEnvironmentFlag` is enabled,

[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2012-11-27 Thread Nick Coghlan
Nick Coghlan added the comment: Claiming this one, mainly because I want people to largely leave the already hairy initialisation process alone until we get a chance to discuss it at the language summit next year. I plan to write up a comprehensive overview of the initialisation sequence

[issue12370] Use of super overwrites use of __class__ in class namespace

2012-11-27 Thread Eric Snow
Eric Snow added the comment: I agree with Benjamin re: __args__ and __kw__. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12370 ___ ___

[issue10914] Python sub-interpreter test

2012-11-27 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10914 ___ ___ Python-bugs-list

[issue1286] fileinput, StringIO, and cStringIO do not support the with protocol

2012-11-27 Thread Eric Snow
Eric Snow added the comment: borrowed the time machine did we? ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1286 ___ ___ Python-bugs-list

[issue16499] CLI option for isolated mode

2012-11-27 Thread Nick Coghlan
Changes by Nick Coghlan ncogh...@gmail.com: -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ ___ Python-bugs-list

[issue16567] Implementing .= for variable operator

2012-11-27 Thread Erik VanderWerf
New submission from Erik VanderWerf: I don't know if this has been suggested before, none of my searches returned anything. Sorry if it has been rejected already. Anyone who has used Python at least a little bit will know that you can use +=, -=, *=, and /= to apply a change to a variable and

[issue12370] Use of super overwrites use of __class__ in class namespace

2012-11-27 Thread Nick Coghlan
Nick Coghlan added the comment: From a quick scan of the patch, I suspect the current implementation will also break this code: class Outer: class InnerParent: pass class InnerChild(InnerParent): pass The evaluation of the other args to build_class needs to happen before

[issue15627] Add a method to importlib.abc.SourceLoader for converting source to a code object

2012-11-27 Thread Eric Snow
Eric Snow added the comment: Sorry, just now digging out of a massive backlog here. The originally proposed name of source_to_code() might be more appropriate than compile_source(). The relationship to compilation is not compulsory and the name/docstring/docs might imply that. If you're

[issue13475] Add '-p'/'--path0' command line option to override sys.path[0] initialisation

2012-11-27 Thread Eric Snow
Eric Snow added the comment: This proposal only affects the initialization of sys.path[0], and not any of the other sys.path entries made by site.py or otherwise. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13475