Re: [Python-Dev] dict __contains__ raises TypeError on unhashable input

2013-07-20 Thread Benjamin Peterson
2013/7/19 Ethan Furman : > While working on issue #18508 I stumbled across this: > > Traceback (most recent call last): > ... > File "/usr/local/lib/python3.4/enum.py", line 417, in __new__ > if value in cls._value2member_map: > TypeError: unhashable type: 'list' > > I'll wrap it in a try-exc

Re: [Python-Dev] dict __contains__ raises TypeError on unhashable input

2013-07-20 Thread Nick Coghlan
On 20 July 2013 09:47, Ethan Furman wrote: > While working on issue #18508 I stumbled across this: > > Traceback (most recent call last): > ... > File "/usr/local/lib/python3.4/enum.py", line 417, in __new__ > if value in cls._value2member_map: > TypeError: unhashable type: 'list' > > I'll w

Re: [Python-Dev] dict __contains__ raises TypeError on unhashable input

2013-07-20 Thread Ronald Oussoren
On 20 Jul, 2013, at 1:47, Ethan Furman wrote: > While working on issue #18508 I stumbled across this: > > Traceback (most recent call last): > ... > File "/usr/local/lib/python3.4/enum.py", line 417, in __new__ >if value in cls._value2member_map: > TypeError: unhashable type: 'list' > > I

Re: [Python-Dev] dict __contains__ raises TypeError on unhashable input

2013-07-20 Thread Antoine Pitrou
On Fri, 19 Jul 2013 16:47:36 -0700 Ethan Furman wrote: > While working on issue #18508 I stumbled across this: > > Traceback (most recent call last): > ... >File "/usr/local/lib/python3.4/enum.py", line 417, in __new__ > if value in cls._value2member_map: > TypeError: unhashable type: 'l

Re: [Python-Dev] Dash

2013-07-20 Thread Serhiy Storchaka
19.07.13 22:32, Ben Finney написав(ла): Serhiy Storchaka writes: I'm asking only about this case, when the dash is used to denote a break in a sentence or to set off parenthetical statements. That's two separate cases: * denote a break in a sentence * set off parenthetical statements In Wi

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Serhiy Storchaka
20.07.13 15:12, christian.heimes написав(ла): http://hg.python.org/cpython/rev/c92f4172d122 changeset: 84723:c92f4172d122 user:Christian Heimes date:Sat Jul 20 14:11:28 2013 +0200 summary: Use strncat() instead of strcat() to silence some warnings. CID 486616, CID 486617, CI

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Antoine Pitrou
On Sat, 20 Jul 2013 15:23:46 +0300 Serhiy Storchaka wrote: > 20.07.13 15:12, christian.heimes написав(ла): > > http://hg.python.org/cpython/rev/c92f4172d122 > > changeset: 84723:c92f4172d122 > > user:Christian Heimes > > date:Sat Jul 20 14:11:28 2013 +0200 > > summary: > >Us

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Serhiy Storchaka
20.07.13 15:36, Antoine Pitrou написав(ла): On Sat, 20 Jul 2013 15:23:46 +0300 Serhiy Storchaka wrote: 20.07.13 15:12, christian.heimes написав(ла): http://hg.python.org/cpython/rev/c92f4172d122 changeset: 84723:c92f4172d122 user:Christian Heimes date:Sat Jul 20 14:11:28 201

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Antoine Pitrou
On Sat, 20 Jul 2013 15:48:09 +0300 Serhiy Storchaka wrote: > 20.07.13 15:36, Antoine Pitrou написав(ла): > > On Sat, 20 Jul 2013 15:23:46 +0300 > > Serhiy Storchaka wrote: > >> 20.07.13 15:12, christian.heimes написав(ла): > >>> http://hg.python.org/cpython/rev/c92f4172d122 > >>> changeset: 84

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Christian Heimes
> This will wrong when strlen(fname) is 30. strncat() will copy only 30 > bytes, without terminal NUL. That's not how strncat() works. strncat(dest, src, n) writes n+1 chars to the end of dest: n chars from src and +1 for the final NUL char. For this reason dest must be large enough to hold strlen

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Christian Heimes
Am 20.07.2013 14:23, schrieb Serhiy Storchaka: > This will wrong when strlen(fname) is 30. strncat() will copy only 30 > bytes, without terminal NUL. http://linux.die.net/man/3/strncat The strncat() function is similar, except that * it will use at most n bytes from src; and * src does not need

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Serhiy Storchaka
20.07.13 16:27, Christian Heimes написав(ла): This will wrong when strlen(fname) is 30. strncat() will copy only 30 bytes, without terminal NUL. That's not how strncat() works. strncat(dest, src, n) writes n+1 chars to the end of dest: n chars from src and +1 for the final NUL char. For this re

Re: [Python-Dev] cpython: Use strncat() instead of strcat() to silence some warnings.

2013-07-20 Thread Christian Heimes
Am 20.07.2013 15:56, schrieb Serhiy Storchaka: > Oh, true. strncat() always results NUL-terminated string. It's strncpy() > can produce not NUL-terminated string. Sorry for noise. You're welcome! Better safe than sorry. :) ___ Python-Dev mailing list P

Re: [Python-Dev] dict __contains__ raises TypeError on unhashable input

2013-07-20 Thread Ethan Furman
On 07/20/2013 03:21 AM, Ronald Oussoren wrote: On 20 Jul, 2013, at 1:47, Ethan Furman wrote: While working on issue #18508 I stumbled across this: Traceback (most recent call last): ... File "/usr/local/lib/python3.4/enum.py", line 417, in __new__ if value in cls._value2member_map: Typ

Re: [Python-Dev] dict __contains__ raises TypeError on unhashable input

2013-07-20 Thread Guido van Rossum
On Sat, Jul 20, 2013 at 6:37 PM, Ethan Furman wrote: > On 07/20/2013 03:21 AM, Ronald Oussoren wrote: >> >> >> On 20 Jul, 2013, at 1:47, Ethan Furman wrote: >> >>> While working on issue #18508 I stumbled across this: >>> >>> Traceback (most recent call last): >>> ... >>> File "/usr/local/lib/p