Re: [Python-Dev] backported Enum

2013-06-29 Thread Nick Coghlan
On 29 June 2013 06:30, Ethan Furman wrote: >> I would also not be shocked if some people expect failed value >> lookups to raise an IndexError, though I expect they would >> adapt if they get something else that makes sense. >> >> Would it be wrong to create an EnumError that subclasses >> (ValueE

Re: [Python-Dev] add new lambda syntax

2013-06-29 Thread Pynix Wang
http://aruld.info/lambda-expressions-in-java-8-adopts-c-style-syntax/ Lambda expressions in Java 8 adopts C# style syntax. On Sat, Jun 29, 2013 at 1:39 AM, Thomas Wouters wrote: > > > > On Fri, Jun 28, 2013 at 7:01 PM, Amaury Forgeot d'Arc > wrote: > >> 2013/6/28 Pynix Wang >> >>> I want use

Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-29 Thread Nadeem Vawda
On Thu, Jun 27, 2013 at 12:07 AM, Victor Stinner wrote: > I would to parse an integer in [0; UINT_MAX] to fix the zlib module on > 64-bit system: > http://bugs.python.org/issue18294 > > How should I implement that? Use "O" format and then use > PyLong_Check(), PyLong_AsLong(), and check value <= U

Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-29 Thread Serhiy Storchaka
29.06.13 18:16, Nadeem Vawda написав(ла): I ran into the same problem in the _lzma module. My solution was to define a custom converter that does an explicit check before returning the value (see http://hg.python.org/cpython/file/default/Modules/_lzmamodule.c#l134). Definitely Argument Clinic s

[Python-Dev] winsound.c fix to support python3

2013-06-29 Thread Tamir Friedman
Hello, My name is Tamir Friedman, and I suggest to fix a bug in PlaySound in winsound library. It's doesn't support the SND_MEMORY feature because its accepts only "str" and rejects "bytes" type. therefore i include the fixed source file: OLD: ---

Re: [Python-Dev] [Python-checkins] cpython: Fix memory leak in pyexpat PyUnknownEncodingHandler

2013-06-29 Thread R. David Murray
I don't know if this is the commit at fault or not, but we are seeing segfaults in test_xml_etree on the buildbots now. --David On Sat, 29 Jun 2013 20:43:22 +0200, christian.heimes wrote: > http://hg.python.org/cpython/rev/bd0834b59828 > changeset: 84375:bd0834b59828 > user:Christian

Re: [Python-Dev] cpython: Fix memory leak in pyexpat PyUnknownEncodingHandler

2013-06-29 Thread Christian Heimes
Am 29.06.2013 21:29, schrieb R. David Murray: > I don't know if this is the commit at fault or not, but we are seeing > segfaults in test_xml_etree on the buildbots now. Yeah, it's my fault. Thanks! >> u = PyUnicode_Decode((char*) template_buffer, 256, name, "replace"); >> -if (u == NULL

Re: [Python-Dev] winsound.c fix to support python3

2013-06-29 Thread Terry Reedy
On 6/29/2013 11:59 AM, Tamir Friedman wrote: Hello, My name is Tamir Friedman, and I suggest to fix a bug in PlaySound in winsound library. It's doesn't support the SND_MEMORY feature because its accepts only "str" and rejects "bytes" type. therefore i include the fixed source file: Thank you f

[Python-Dev] Issue 4199: combining assignment with global & nonlocal

2013-06-29 Thread A.M. Kuchling
Issue 4199 begins with a self-explanatory comment: PEP 3104 says that the nonlocal and global statements should allow a shorthand. ("global x; x = 3" == "global x = 3") This patch implements that. Benjamin posted his patch on 2008-10-24. It got postponed to 3.2 because it was t

Re: [Python-Dev] PyArg_ParseTupe(): parse unsigned integer and check for overflow

2013-06-29 Thread Larry Hastings
On 06/29/2013 06:24 PM, Serhiy Storchaka wrote: Definitely Argument Clinic should use converters for unsigned integers without wraparound by default. Argument Clinic 1.0 is a thin layer over PyArg_ParseTuple. But it will support these sorts of converters, and if people have bright ideas abo

Re: [Python-Dev] Issue 4199: combining assignment with global & nonlocal

2013-06-29 Thread Guido van Rossum
I agree that there are problems with the idea of combining assignment and global statements, because the ambiguity of "global x, y = p, q" is just too much to handle. The only case would be if there was only a single variable, but that fails the test of easy generalization. So let's close it. --Gu

Re: [Python-Dev] Issue 4199: combining assignment with global & nonlocal

2013-06-29 Thread Benjamin Peterson
Agreed. The currently supported syntax (a global/nonlocal line and an assignment) is not too painful to figure out the ambiguity of the proposed syntax. 2013/6/29 Guido van Rossum : > I agree that there are problems with the idea of combining assignment > and global statements, because the ambigui