[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What about SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW? -- ___ Python tracker ___ ___ Python-bugs-list m

[issue14012] Misc tarfile fixes

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Lets push it. Lars? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue18685] Restore re performance to pre-PEP393 level

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Using #include "_sre.c" in _sre.c looks weird. Instead of huge sections > delimited by "#ifdef SRE_RECURSIVE", I would prefer something similar to the > stringlib. ".h" template files included more than once. I also expect shorter > files: _sre.c is close

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not really thrilled by the current implementation. The way it is done leads to duplication among socket constants. Also, if I create a socket from a numeric value (because a well-known socket family is known yet known by Python), then socket.family will fa

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +neologix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
New submission from raymontag: Hello, I would like to see an implementation for SSL/TLS pinning in the sll module of the standard library. At this moment it's only possible to give the client a CAcert and check if the server's certificate is signed with this CA by creating a ssl.Context objec

[issue13647] Python SSL stack doesn't securely validate certificate (as client)

2013-08-14 Thread Christian Heimes
Changes by Christian Heimes : -- nosy: +christian.heimes ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue15464] ssl: add set_msg_callback function

2013-08-14 Thread Christian Heimes
Changes by Christian Heimes : -- assignee: -> christian.heimes ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: TLS cert pinning should be possible with the implementation of #18293 -- nosy: +christian.heimes, giampaolo.rodola, janssen, pitrou stage: -> needs patch versions: +Python 3.4 ___ Python tracker

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: Yep, that's exactly what I meant :) -- resolution: -> duplicate status: open -> closed ___ Python tracker ___ __

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: If you want to check for a specific server certificate, then I guess it should be enough to expose the cert's fingerprint in the data returned by getpeercert(). -- ___ Python tracker

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: getpeercert() doesn't return Subject Public Key Info yet. It's on my TODO list. Chrome uses SPKI (PK algo + mod + exp) to pin certs, https://www.imperialviolet.org/2011/05/04/pinning.html -- ___ Python tracker

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: Yeah, this was my first idea, too. Are there at this moment other possibilities to implement pinning myself with the options the module provides me? -- ___ Python tracker

[issue18736] Invalid charset in HTML pages inside documentation in CHM format

2013-08-14 Thread Basil Peace
New submission from Basil Peace: HTML pages inside CHM documentation use the following tag to set applied character set: `iso8859_1` is neither valid character set according to IANA registry nor is recognized by most browsers (I've checked IE, Firefox and Opera). This isn't notable for t

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Are there at this moment other possibilities to implement pinning > myself with the options the module provides me? I don't think so. Perhaps you could use the serialNumber, but I'm not sure how safe it is, even when restricting to a single CA cert. -

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: sha256(conn.getpeercert(True)) works until the cert gets e.g. more SAN fields. -- ___ Python tracker ___ _

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: That's not a good idea, a serial number could be faked. -- ___ Python tracker ___ ___ Python-bugs-list ma

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > sha256(conn.getpeercert(True)) works until the cert gets e.g. more > SAN fields. Indeed, that's simply comparing the certificate by binary value. At this point you don't even need a CA anymore, I guess :-) -- ___ P

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I have added documentation now so I think it is ready to merge > (except for a change to Makefile). Good for me. This is a very nice addition! -- ___ Python tracker _

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread raymontag
raymontag added the comment: Great, that matches my needs exactly -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, good point. My only issue with the patch is that www.python.org will be resolved for every test method, even those that don't use remote_addr. This will make test_timeout unnecessarily slower. -- ___ Python trac

[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-14 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- assignee: ncoghlan -> neologix stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bug

[issue18731] Increased test coverage for uu and telnet

2013-08-14 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue18727] test for writing dictionary rows to CSV

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: You can probably use a StringIO for the file object, no need to create a temporary file. -- nosy: +pitrou stage: -> patch review versions: +Python 3.4 -Python 3.3 ___ Python tracker

[issue18736] Invalid charset in HTML pages inside documentation in CHM format

2013-08-14 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: > I'm not really thrilled by the current implementation. The way it is done > leads to duplication among socket constants. Can you clarify which duplication you mean specifically? In the code review tool, Serhiy proposed that instead of listing all the constants

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: > What about SOCK_STREAM, SOCK_DGRAM, and SOCK_RAW? > This is a proof of concept. As I mentioned in the original message starting this issue - the SOCK_* constants will get the same treatment as AF_* constants, once we decide what the right treatment is. ---

[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: We can do this in the setUpClass() method. Or we can wrap the resolve_address() method with the @functools.lru_cache() decorator. -- nosy: +serhiy.storchaka ___ Python tracker

[issue18606] Add statistics module to standard library

2013-08-14 Thread Mark Dickinson
Mark Dickinson added the comment: Steven: were you planning to start a discussion thread on python-dev for PEP 450? I see that there's some activity on python-list and on python-ideas, but I think most core devs would expect the main discussions to happen on the python-dev mailing list. (An

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Can you clarify which duplication you mean specifically? In the code > review > tool, Serhiy proposed that instead of listing all the constants > explicitly > in the Python code, we can just do: > > AddressFamily = IntEnum('AddressFamily', >{name:

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Christian Heimes
New submission from Christian Heimes: ABCs are missing one important introspection feature. They have no API to get registered virtual subclasses. The patch implements a new method get_virtual_subclasses(recurse=False). ABC.get_virtual_subclasses() returns the direct virtual subclasses of an A

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not sure "recurse" is a relevant distinction here. A subclass of a subclass is still a subclass. "Virtual" subclasses should not be different. At the very least, if "recurse" is kept, I would expect it to be True by default. -- nosy: +pitrou

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Another problem is what happens when an implementation uses non-"virtual" inheritance: >>> issubclass(collections.UserDict, collections.abc.Mapping) True >>> collections.UserDict in collections.abc.Mapping.get_virtual_subclasses(True) False IOW, I think this g

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm surprised that test_repr is not failed. '%i' % socket.AddressFamily.AF_INET returns 'AddressFamily.AF_INET' instead of '2' as I expected. Is not this a bug in IntEnum implementation? -- ___ Python tracker

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ran some benchmark numbers: $ ./python -m timeit -s "from pprint import saferepr; s='é\"x' * 1000" "saferepr(s)" -> before patch: 555 usec per loop -> after patch: 10.9 usec per loop $ ./python -m timeit -s "from pprint import saferepr; s='xxx' * 1000" "safer

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: It's called get_VIRTUAL_subclasses() for a reason. You can get the real subclasses of an ABC with standard tool, e.g. recurse into __subclasses__(). For virtual subclasses you have to deal with the internals like _abc_registry. I could implement all four cas

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: Attaching a new patch that uses Serhiy's suggestion to avoid the duplication, and uses Antoine's suggestion to keep socket.family working even if the family is an unknown numeric constant. Note that the latter is challenging to test - I need families the OS kno

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 6:24 AM, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > I'm surprised that test_repr is not failed. '%i' % > socket.AddressFamily.AF_INET returns 'AddressFamily.AF_INET' instead of '2' > as I expected. Is not this a bu

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It's called get_VIRTUAL_subclasses() for a reason. You can get the > real subclasses of an ABC with standard tool, e.g. recurse into > __subclasses__(). What use case are you trying to solve? If I want to find out all classes which implement an ABC, I don't ca

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: We can just remove "if typ is str:" case at all. A general case works for strings. But for performance (this will slowdown Antoine's tests by 15-20%) we should left it and may be even extend it to other builtin types: builtin_type = (str, int, float, NoneTy

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Issue18738 created. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Ethan Furman
New submission from Ethan Furman: While `.format()` works fine with enum, %-formatting does not: --> class AF(enum.IntEnum): ... IPv4 = 1 ... IPv6 = 2 ... --> AF.IPv4 --> '%s' % AF.IPv4 'AF.IPv4' --> '%r' % AF.IPv4 '' --> '%d' % AF.IPv4 'AF.IPv4' --> '%i' % AF.IPv4 'AF.IPv4' --> '%x'

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: `.format()` is surprised too. >>> '{:}'.format(AF.IPv4) 'AF.IPv4' >>> '{:10}'.format(AF.IPv4) ' 1' -- ___ Python tracker ___

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: The manual list of AF_ prefixes looks ugly. We are going to run into the same problem for every module. How about an additional constructor that takes a name, dict and string prefix? class IntEnum(int, Enum): @classmethod def from_moduledict(cls, nam

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eric V. Smith
Changes by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: In Objects/unicodeobject.c when it gets into mainformatlong, an IntEnum is recognized as an integer (passes PyLong_Check) and goes into formatlong. There, in the cases of 'd', 'i', 'u' it has: case 'u': /* Special-case boolean: we want 0/1 */

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: Christian, this is an interesting idea - but I suggest we review it once we actually get to convert "many modules". For the time being the manual listing is gone in the recent patch, and for a number of constant families in the same module (i.e. SOCK_* that wil

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: > I thing the AddressFamily enum class and the family property should be > documented. > I'm leaving the documentation to the end when we decide on the implementation strategy. Once that happens I'll post a patch with .rst changes, etc. -- _

[issue18606] Add statistics module to standard library

2013-08-14 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I thing the AddressFamily enum class and the family property should be documented. -- ___ Python tracker ___

[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nitpick: If we have grouped this constants in an enum class perhaps it will be good if they will be enumerated in the order of its values. Or no? -- ___ Python tracker _

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: '{:}'.format(AF.IPv4) is incorrect, but '{:10}'.format(AF.IPv4) behaves as it should. -- ___ Python tracker ___ _

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Looks like Objects/unicodeobject.c needs the same enhancement that Modules/_json.c received: convert int/float subclasses into actual ints/floats before continuing. -- ___ Python tracker

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: Ethan, str.format uses __format__. We don't seem to provide a custom one. -- ___ Python tracker ___ _

[issue18738] % formatting incomplete for Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 6:55 AM, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > `.format()` is surprised too. > > >>> '{:}'.format(AF.IPv4) > 'AF.IPv4' > >>> '{:10}'.format(AF.IPv4) > ' 1' > > Oh, this looks like a bug in str.format (

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eli Bendersky
Changes by Eli Bendersky : -- title: % formatting incomplete for Enum -> String formatting (% and str.format) issues with Enum ___ Python tracker ___ ___

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Gotcha. I'm on it. -- assignee: -> ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3b82e0d83bf9 by Richard Oudkerk in branch 'default': Issue #8713: Support alternative start methods in multiprocessing on Unix. http://hg.python.org/cpython/rev/3b82e0d83bf9 -- nosy: +python-dev ___ Pytho

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Gregory P. Smith
New submission from Gregory P. Smith: This is a very odd inconsistency in math.log behavior. That said, it is probably only a single bit imprecision at the end of the float result. Still, 10 == 10L so I'd expect math.log of both to give the same result. oss/cpython/2.7:LOAS$ ./python Python

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: Fascinating, how did you find the issue? -- nosy: +christian.heimes, mark.dickinson ___ Python tracker ___ ___

[issue18698] importlib.reload() does not return the module in sys.modules

2013-08-14 Thread Brett Cannon
Brett Cannon added the comment: I think you mean in 3.3 and yes. =) Patch LGTM so I say fix in 3.3 and merge into default. -- assignee: -> eric.snow ___ Python tracker ___

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-14 Thread Richard Oudkerk
Richard Oudkerk added the comment: > Good for me. This is a very nice addition! Thanks. I do see a couple of failed assertions on Windows which presumably happen in a child process because they do not cause a failure: Assertion failed: !collecting, file ..\Modules\gcmodule.c, line 1617

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: The %-formatting needs to be handled by str, correct? What is '{:}' supposed to mean? -- ___ Python tracker ___ _

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: > What is '{:}' supposed to mean? > It should be the same as '{}'. That is, an empty format string. -- ___ Python tracker ___ _

[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I do see a couple of failed assertions on Windows which presumably > happen in a child process because they do not cause a failure: > > Assertion failed: !collecting, file ..\Modules\gcmodule.c, line > 1617 > > The assertion is in _PyGC_CollectNoFail(

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Christian Heimes
Christian Heimes added the comment: I like to do something similar to marker interfaces [1] with ABCs. For introspection and documentation I need a way to get all non-abstract classes that are implemented by an ABC. How about I change the implementation to get_subclasses(direct=False) to retur

[issue18737] Get virtual subclasses of an ABC

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I like to do something similar to marker interfaces [1] with ABCs. > For introspection and documentation I need a way to get all > non-abstract classes that are implemented by an ABC. You mean that implement an ABC? But you also need to return real subclasses

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Which is the same as '%s', yes? In that case, the current behavior of '{:}'.format(AF.IPv4) is correct, isn't it? -- ___ Python tracker ___

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Tim Peters
Tim Peters added the comment: Yup - 2.7 evaluates this in a less precise way, as log(10L) = log(10./16 * 2**4) = log(0.625) + log(2)*4 >>> log(10L) == log(0.625) + log(2)*4 True This patterns works well even for longs that are far too large to represent as a double; e.g., >>> log(1L << 5

[issue18740] str is number methods don't recognize '.'

2013-08-14 Thread Ron Adam
New submission from Ron Adam: Shouldn't at least isdecimal return True? >>> '123.0'.isdecimal() False >>> '123.0'.isalnum() False >>> '123.0'.isnumeric() False >>> '123.0'.isdigit() False -- components: Interpreter Core messages: 195186 nosy: ron_adam priority: normal severity: normal s

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Gregory P. Smith
Gregory P. Smith added the comment: We found this while refactoring an API to be more consistent about returning longs vs ints in specific cases. This resulted in another unittest that was using math.log for a nicer display of the value by magnitude to fail as the result was slightly differen

[issue18740] str is number methods don't recognize '.'

2013-08-14 Thread Ned Deily
Ned Deily added the comment: isdecimal() is working as documented, isn't it? A period character serving as a decimal point is not the same as a decimal character. "Return true if all characters in the string are decimal characters and there is at least one character, false otherwise. Decimal

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: I think: >>> '{:}'.format(AF.IPv4) 'AF.IPv4' is correct, assuming str(AF.IPv4) is 'AF.IPv4'. I'm not sure what: >>> '{:10}'.format(AF.IPv4) should produce. There's a special case for an empty format string calling str(). I think that specifying __format__() w

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > I think that specifying __format__() would be best, except then you need to > decide what sort of format specification language you want to support, and > deal with all of the implementation details. Or, maybe just have Enum

[issue18718] datetime documentation contradictory on leap second support

2013-08-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5063dab96843 by David Wolever in branch '2.7': Issue #18718: datetime documentation contradictory on leap second support http://hg.python.org/cpython/rev/5063dab96843 -- nosy: +python-dev ___ Python track

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: >> >> I think that specifying __format__() would be best, except then you need to >> decide what sort of format specification language you want to support, and >> deal with all of the implementation details. Or, maybe just have Enum's >> __format__ be: >> >>

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Tim Peters
Tim Peters added the comment: FYI, the improvement was made in these 2 changesets: c8dc4b5e54fb a9349fd3d0f7 If desired, those could presumably be grafted back into the 2.7 branch. The commit messages refer to issue #9599, but that appears to be mistaken. -- _

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > For the format version, what gets called is: > > int_subclass.__format__('d'), which is int.__format__(int_subclass, > 'd'), which produces '1', assuming int(int_subclass) is 1. Ah, I didn't realize. Thanks. > So, there's n

[issue18739] math.log of a long returns a different value of math.log of an int

2013-08-14 Thread Tim Peters
Tim Peters added the comment: OK, the correct one is issue #9959. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue18740] str is number methods don't recognize '.'

2013-08-14 Thread Brett Cannon
Brett Cannon added the comment: Ned is right, everything is working as documented and intended: as a way to avoid using a regex to test a simple case instead of trying to do anything fancy like identify a number. -- nosy: +brett.cannon resolution: -> rejected status: open -> closed _

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 11:48 AM, Ethan Furman wrote: > > Ethan Furman added the comment: > > > Eric V. Smith added the comment: > > > > For the format version, what gets called is: > > > > int_subclass.__format__('d'), which is int.__format__(int_subclass, > > '

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: For format, I think the question is "should an IntEnum format like an int, with the wacky exception of a specifier of '', or should it always format like a str?" I assumed we'd want it to look like the str() version of itself, always. But it's debatable. I ag

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 11:56 AM, Eric V. Smith wrote: > > Eric V. Smith added the comment: > > For format, I think the question is "should an IntEnum format like an int, > with the wacky exception of a specifier of '', or should it always format > like a str?" >

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue18293] ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated certificates

2013-08-14 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue18735] SSL/TLS pinning for the ssl module

2013-08-14 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: This technique is used in Mercurial and I use it in my projects too. -- ___ Python tracker ___ ___

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: > Eric V. Smith added the comment: > > I assumed we'd want it to look like the str() version of itself, always. But > it's debatable. An IntEnum's str and repr should be (and any format or % codes that are the equivalent) the Enum str and repr. The % and forma

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: On Wed, Aug 14, 2013 at 12:07 PM, Ethan Furman wrote: > > Ethan Furman added the comment: > > > Eric V. Smith added the comment: > > > > I assumed we'd want it to look like the str() version of itself, always. > But it's debatable. > > An IntEnum's str and repr s

[issue18740] str is number methods don't recognize '.'

2013-08-14 Thread Ron Adam
Ron Adam added the comment: I get the same resluts if I make the string by str(123.0). I was thinking it should test True for the isdecimal case for that. It seems I missunderstood their purpose/use. This seems like it would be a very common misunderstanding. It appears, (Because it isn't s

[issue18740] str is number methods don't recognize '.'

2013-08-14 Thread Brett Cannon
Brett Cannon added the comment: Feel free to submit an issue suggesting better docstrings as that sounds like it could stand to get some TLC. -- ___ Python tracker ___ _

[issue13504] Meta-issue for "Invent with Python" IDLE feedback

2013-08-14 Thread Kurt B. Kaiser
Changes by Kurt B. Kaiser : -- nosy: +kbk ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.or

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: I think IntEnum should act like a str for format() purposes. After all, having a useful string representation is a prime reason it exists. If you want it to act like a str() sometimes, and an int() at others, you're going to have to parse the format specifier a

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: Okay, I see your points. I can certainly agree with going with the str representation when no numeric code is specified. But, if a numeric code is specified (x, b, d, etc.) then the numeric value should be used. Agreed? -- ___

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Ethan Furman
Ethan Furman added the comment: On 08/14/2013 11:55 AM, Eli Bendersky wrote: > > I'm not sure I understand. The discrepancy between {:} and {:10} is clearly > a problem. Ah, you're right. -- ___ Python tracker ___

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which adds fast path for builtin scalar types. Or we can just remove a special case for strings. -- Added file: http://bugs.python.org/file31292/pprint_safe_repr_scalars.patch ___ Python tracker

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eli Bendersky
Eli Bendersky added the comment: > > Okay, I see your points. I can certainly agree with going with the str > representation when no numeric code is specified. But, if a numeric code > is specified (x, b, d, etc.) then the numeric value should be used. > > Agreed? > Yes. I suggest to wait a d

[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: "locally visible" is, I think a very misleading term. How is with ignore_error, acquire_resource as r: doo_stuff_with_resource(r) #can be silently skipped any more locally visible than with acquire_resource_ignore_error as r: doo_stuff_with reso

[issue18727] test for writing dictionary rows to CSV

2013-08-14 Thread Muhammad Jehanzeb
Muhammad Jehanzeb added the comment: Thanks Antoine, Attached is the updated version of patch using StringIO -- Added file: http://bugs.python.org/file31293/issue18727_v2.patch ___ Python tracker _

[issue18738] String formatting (% and str.format) issues with Enum

2013-08-14 Thread Eric V. Smith
Eric V. Smith added the comment: If IntEnum.__format__ is going to parse the format string, it's a little fragile. For example, say we modify int.__format__ to understand a "Z" presentation type. Who's going to remember to update IntEnum.__format__? For reference, the existing integer formats

[issue4749] Issue with RotatingFileHandler logging handler on Windows

2013-08-14 Thread Piotr Dobrogost
Changes by Piotr Dobrogost : -- nosy: +piotr.dobrogost ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

  1   2   >