[issue21507] set and frozenset constructor should use operator.length_hint to guess the size of the iterator

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agree with Josh's arguments. Similar idea was already proposed and rejected (issue17338). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21507 ___

[issue21509] json.load fails to read UTF-8 file with (BOM) Byte Order Marks

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Currently json.load/loads don't support binary input. See issue17909 and issue19837. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21509 ___

[issue21507] set and frozenset constructor should use operator.length_hint to guess the size of the iterator

2014-05-15 Thread STINNER Victor
STINNER Victor added the comment: I think the argument against using PyObject_LengthHint for the general iterable case is that for inputs other than sets or dicts, the assumption is that significant deduplication will occur. Oh... I'm dumb :) Sorry. Another option for frozenset only: we may

[issue21027] difflib new cli interface

2014-05-15 Thread STINNER Victor
STINNER Victor added the comment: After more thought, I think this should remain in tools as a demo. I disagree, I like the command line interface. It's very useful on Windows for example. It's also useful on UNIX embedded devices where Python is installed, but only a few UNIX tools. If you

[issue19837] Wire protocol encoding for the JSON module

2014-05-15 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19837 ___ ___ Python-bugs-list

[issue17909] Autodetecting JSON encoding

2014-05-15 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17909 ___ ___ Python-bugs-list

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This issue was mainly resolved in issue12892. The surrogatepass error handler now works with UTF-16* and UTF-32* encodings. But for other encodings it behaves as for UTF-8 (preserve old behavior). Should we change the behavior for non-UTF encodings end

[issue19186] expat symbols should be namespaced in pyexpat again

2014-05-15 Thread Peter Kruse
Peter Kruse added the comment: Fascinating, you are right, very good, thanks for your time and looking into this. Peter -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19186 ___

[issue15809] 2.7 IDLE console uses incorrect encoding.

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Alternative solution is to force UTF-8 in IDLE console. But I think this will be more surprising, especially for Windows users. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15809

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which disallows the surrogatepass handler for non-utf encodings. Please test it on Windows. -- type: behavior - enhancement versions: +Python 3.5 -Python 3.1, Python 3.2, Python 3.3 ___ Python

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka wrote: Here is a patch I don't see your patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13916 ___

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, sorry. -- keywords: +patch Added file: http://bugs.python.org/file35257/surrogatepass_non_utf.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13916

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Martin v . Löwis
Martin v. Löwis added the comment: LGTM -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13916 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21510] fma documentation should provide better example.

2014-05-15 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +mark.dickinson, skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21510 ___ ___

[issue21510] fma documentation should provide better example.

2014-05-15 Thread Mark Dickinson
Mark Dickinson added the comment: I wouldn't want to drop the simple example: I suspect that many of those looking at fma won't have the first idea what it does, and that first example shows clearly that it's a fused multiply-add. But +1 for an example that demonstrates the single rounding,

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5e98a50e0f55 by Serhiy Storchaka in branch 'default': Issue #13916: Disallowed the surrogatepass error handler for non UTF-* http://hg.python.org/cpython/rev/5e98a50e0f55 -- nosy: +python-dev ___ Python

[issue21510] fma documentation should provide better example.

2014-05-15 Thread Jayanth Koushik
Jayanth Koushik added the comment: @Mark: I agree. And perhaps it is also worth mentioning (on an unrelated note), that the decimal fma is not based on the internal cmath fma (it could not be) and unlike the cmath fma, it is no faster than an unfused multiply-add. --

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13916

[issue17909] Autodetecting JSON encoding

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: All dependencies for this issue are resolved now. Here is updated patch, synchronized with tip. -- Added file: http://bugs.python.org/file35258/json_detect_encoding_2.patch ___ Python tracker

[issue21487] Assorted ipaddress performance improvements

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: I find logical operations on negative numbers confusing in Python, so I'd rather stick with the first implementation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21487

[issue17909] Autodetecting JSON encoding

2014-05-15 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file30133/json_detect_encoding.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17909 ___

[issue21486] optimize v4 v6 netmask parsing

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What I want to say, the patch LGTM, but after committing issue14373 we should simplify the code by using functools.lru_cache(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21486

[issue21486] optimize v4 v6 netmask parsing

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Actually, using lru_cache(maxsize=None) would enable a simple infinite cache like in the patch. But it's not like a lot of code would be saved. -- ___ Python tracker rep...@bugs.python.org

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread STINNER Victor
STINNER Victor added the comment: It makes sense to restrict surrogatepass to UTF-* encodings. UTF-8, UTF-16 and UTF-32 encoders reject surrogate characters, but not UTF-7. Is it a bug? I'm asking because PyCodec_SurrogatePassErrors() doesn't support UTF-7. IMO your change is important enough

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread STINNER Victor
STINNER Victor added the comment: Windows buildbots are unhappy. http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/8355/steps/test/logs/stdio == ERROR: test_surrogatepass_handler

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch, which adds support for cp65001 and fixes test_cp1252. Please test it on Windows Vista. Lone surrogates are not illegal in UTF-7 (see RFC 1642), so error handler is not called and explicit support of UTF-7 is not needed. Could you please

[issue21508] C API PyArg_ParseTuple doc is innacurate

2014-05-15 Thread Steve
Steve added the comment: I would prefer the function to return bool. But what I prefer is irrelevant, what counts is accuracy and clarity. And to this end, the return type and the comment have to match. For a int return value, the document should mention a condition relative to an integer

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread STINNER Victor
STINNER Victor added the comment: Here is a patch, which adds support for cp65001 The name of the encoding is cp65001, not something like cp-utf8. And there is no alias like cp_65001, there is only cp65001. -- ___ Python tracker

[issue17909] Autodetecting JSON encoding

2014-05-15 Thread Chris Rebert
Chris Rebert added the comment: You'll need to also update the Character Encodings subsection of the json docs. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17909 ___

[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But an exception reports about CP_UTF8. -- title: disallow the surrogatepass handler for non utf-* encodings - disallow the surrogatepass handler for non utf-* encodings ___ Python tracker rep...@bugs.python.org

[issue21511] Thinko in Lib/quopri.py

2014-05-15 Thread Paul Sokolovsky
New submission from Paul Sokolovsky: Lib/quopri.py for version 3.3..3.5-tip contains following code: ESCAPE = b'=' ... line = input.readline() if not line: break i, n = 0, len(line) if n 0 and line[n-1:n] == b'\n': ... elif i+1 n and line[i+1] ==

[issue21512] time module becomes None after raise SystemExit

2014-05-15 Thread Ryder Lewis
New submission from Ryder Lewis: I'm not sure if this is a bug or expected behavior, but basically what I want to do is log the timestamp when an application exits. Sample script to illustrate the issue: try.py import time class A(): def __init__(self):

[issue21512] time module becomes None after raise SystemExit

2014-05-15 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +benjamin.peterson, pitrou resolution: - not a bug status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21512 ___

[issue21512] time module becomes None after raise SystemExit

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, let's call it a limitation rather than a bug. When creating a global variable (such as a in your example), that variable is kept alive at least as long as the module containing it. However, modules usually live until very late in the interpreter shutdown

[issue21512] time module becomes None after raise SystemExit

2014-05-15 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- resolution: not a bug - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21512 ___

[issue21486] optimize v4 v6 netmask parsing

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2158614e1607 by Antoine Pitrou in branch 'default': Issue #21486: Optimize parsing of netmasks in ipaddress.IPv4Network and ipaddress.IPv6Network. http://hg.python.org/cpython/rev/2158614e1607 -- nosy: +python-dev

[issue21487] Assorted ipaddress performance improvements

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2711677cf874 by Antoine Pitrou in branch 'default': Issue #21487: Optimize ipaddress.summarize_address_range() and ipaddress.{IPv4Network,IPv6Network}.subnets(). http://hg.python.org/cpython/rev/2711677cf874 -- nosy: +python-dev

[issue15809] 2.7 IDLE console uses incorrect encoding.

2014-05-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: Idle 3.x has Martin's patch, except that the 'if' clause is merely commented out rather than removed. (Perhaps someone wanted to test the removal first. It should now be deleted.) My 2.7 Idle has Default Source Encoding ... [x] None. Since there is nothing

[issue20826] Faster implementation to collapse consecutive ip-networks

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8867874a2b7d by Antoine Pitrou in branch 'default': Issue #20826: Optimize ipaddress.collapse_addresses(). http://hg.python.org/cpython/rev/8867874a2b7d -- nosy: +python-dev ___ Python tracker

[issue20826] Faster implementation to collapse consecutive ip-networks

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: I've now committed this. exhuma, if you have any further observations or results, don't hesitate to post them! -- resolution: - fixed stage: patch review - commit review status: open - closed ___ Python tracker

[issue21487] Assorted ipaddress performance improvements

2014-05-15 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21487 ___

[issue21486] optimize v4 v6 netmask parsing

2014-05-15 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21486 ___

[issue15809] 2.7 IDLE console uses incorrect encoding.

2014-05-15 Thread Martin v . Löwis
Changes by Martin v. Löwis mar...@v.loewis.de: -- nosy: -loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15809 ___ ___ Python-bugs-list

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4621bb82ceec by Antoine Pitrou in branch '3.4': Issue #21364: remove recommendation of broken pattern. http://hg.python.org/cpython/rev/4621bb82ceec New changeset dbf728f9a2f0 by Antoine Pitrou in branch 'default': Issue #21364: remove

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the report, Armin. I've removed that recommendation and changed the surrounding wording to insist that standard streams are always text streams. -- resolution: - fixed stage: - resolved status: open - closed

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Armin Ronacher
Armin Ronacher added the comment: To avoid further problems may I also recommend documenting how exactly people are supposed to wrap sys.stdout and so forth. Clearly putting a StringIO there is insufficient as StringIO does not have a buffer. Something like this maybe? import io buf =

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: To avoid further problems may I also recommend documenting how exactly people are supposed to wrap sys.stdout and so forth. Clearly putting a StringIO there is insufficient as StringIO does not have a buffer. I would like to know of some situations where

[issue21513] speed up some ipaddress properties

2014-05-15 Thread Antoine Pitrou
New submission from Antoine Pitrou: Some properties on IPv4Address and IPv6Address instantiate one or several network objects each time they are computed. Instead these characteristic networks can be computed once and for all at module import. Patch attached. (note: the lru_cache() decorator

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Armin Ronacher
Armin Ronacher added the comment: I would like to know of some situations where you want to write some code that accesses standard streams as binary *and* don't control the application setup (i.e. library code rather than application code). It seems to me that a library should take the

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Armin Ronacher
Armin Ronacher added the comment: Pretty much, yes. Just that you probably want 'replace' instead. surrogate-escape does not do anything useful here I think. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21364

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: The same situations people wrapped streams before on python 2: * code.py users. Werkzeug's traceback system implements a remote python shell through it. * any system that wants to unittest shell scripts on a high level. * any system that wants to

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread R. David Murray
R. David Murray added the comment: Note that in 3.4 we have contextlib.replace_stdout, but it doesn't give any examples of how to construct file-like objects that will work well with it. -- ___ Python tracker rep...@bugs.python.org

[issue21364] Documentation Recommends Broken Pattern

2014-05-15 Thread R. David Murray
R. David Murray added the comment: I mean redirect_stdout. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21364 ___ ___ Python-bugs-list mailing

[issue21513] speed up some ipaddress properties

2014-05-15 Thread Josh Rosenberg
Changes by Josh Rosenberg shadowranger+pyt...@gmail.com: -- nosy: +josh.rosenberg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21513 ___ ___

[issue21508] C API PyArg_ParseTuple doc is innacurate

2014-05-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Changing the docs isn't the main hurdle; the problem is that if we told people they could test == 1, rather than != 0, then new success return codes couldn't be added without a long period of warning. I don't think the convention is consistently 0 means

[issue18104] Idle: make human-mediated GUI tests usable

2014-05-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0a6d51ccff54 by Terry Jan Reedy in branch '2.7': Issue #18104: revise docstrings, remove obsolete comments. http://hg.python.org/cpython/rev/0a6d51ccff54 New changeset 6d2982ff441f by Terry Jan Reedy in branch '3.4': Issue #18104: revise

[issue21507] set and frozenset constructor should use operator.length_hint to guess the size of the iterator

2014-05-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Not sure how much that really helps. If I understand you correctly, it would be a memory optimization that would require a round of rehashing to use? If you wanted to make a change that got guaranteed better performance, you might add support for dict's

[issue21046] Document formulas used in statistics

2014-05-15 Thread Alextp
Alextp added the comment: @Ezio: of course, much of these funcs CANNOT be expressed as simple formulas. Only with some text. I shown example descriptions for almost all- above. -- ___ Python tracker rep...@bugs.python.org

[issue17909] Autodetecting JSON encoding

2014-05-15 Thread akira
akira added the comment: Both json standard (ECMA-404) [1] and the new json rfc 7159 [2] do not mention the encoding detection. [1] http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf [2] https://tools.ietf.org/html/rfc7159#section-8.1 From the rfc: JSON text SHALL be

[issue17909] Autodetecting JSON encoding

2014-05-15 Thread Chris Rebert
Chris Rebert added the comment: I agree that the state of encoding detection in the new RFC seems unclear, given that the old RFC prefaced the part about the encoding detection with: Since the first two characters of a JSON text will always be ASCII characters But in the new RFC: Appendix

[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys

2014-05-15 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18820 ___ ___ Python-bugs-list

[issue19361] Specialize exceptions thrown by JSON parser

2014-05-15 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19361 ___ ___ Python-bugs-list

[issue13212] json library is decoding/encoding when it should not

2014-05-15 Thread Chris Rebert
Chris Rebert added the comment: Note that, per the new JSON RFC 7159 (https://tools.ietf.org/html/rfc7159 ), top-level non-collection values are now de-jure permissible in JSON: Appendix A. Changes from RFC 4627 o Changed the definition of JSON text so that it can be any JSON

[issue21509] json.load fails to read UTF-8 file with (BOM) Byte Order Marks

2014-05-15 Thread Chris Rebert
Chris Rebert added the comment: The new JSON RFC now at least mentions BOM handling: https://tools.ietf.org/html/rfc7159#section-8.1 : Implementations MUST NOT add a byte order mark to the beginning of a JSON text. In the interests of interoperability, implementations that parse JSON texts

[issue21514] update json module docs in light of RFC 7159 ECMA-404

2014-05-15 Thread Chris Rebert
New submission from Chris Rebert: json module docs: https://docs.python.org/3/library/json.html New superseding JSON RFC: https://tools.ietf.org/html/rfc7159 Errata to the new RFC: http://www.rfc-editor.org/errata_search.php?rfc=7159 ECMA-404:

[issue21401] python2 -3 does not warn about str/unicode to bytes conversions and comparisons

2014-05-15 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21401 ___ ___ Python-bugs-list

[issue1043134] Add preferred extensions for MIME types

2014-05-15 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1043134 ___ ___ Python-bugs-list

[issue1521950] shlex.split() does not tokenize like the shell

2014-05-15 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1521950 ___ ___ Python-bugs-list

[issue13826] Having a shlex example in the subprocess.Popen docs is confusing

2014-05-15 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13826 ___ ___ Python-bugs-list

[issue13197] subprocess: move shell arguments to a separate keyword param

2014-05-15 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13197 ___ ___ Python-bugs-list