[issue29990] Range checking in GB18030 decoder

2017-04-05 Thread STINNER Victor
STINNER Victor added the comment: An incorrect implementation of a decoder might lead to security vulnerabilities: http://unicodebook.readthedocs.io/issues.html#security-vulnerabilities *But* UTF-8 decoder of Python 2 is *not* strict and nobody complained. I suggest that, once the changed is me

[issue30005] Pickling and copying exceptions doesn't preserve non-__dict__ attributes

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- dependencies: +Pickling and copying ImportError doesn't preserve name and path ___ Python tracker ___ ___

[issue30005] Pickling and copying exceptions doesn't preserve non-__dict__ attributes

2017-04-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Pickling and copying exceptions preserves only __dict__ attributes. This includes writeable internal fields initialized in constructor: >>> import pickle, copy >>> e = StopIteration(12) >>> e.value = 34 >>> e.value 34 >>> e2 = pickle.loads(pickle.dumps(e, 4

[issue28837] 2to3 does not wrap zip correctly

2017-04-05 Thread Benjamin Peterson
Benjamin Peterson added the comment: New changeset 93b4b47e3a720171d67f3b608de406aef462835c by Benjamin Peterson (Stuart Berg) in branch 'master': bpo-28837: Fix lib2to3 handling of map/zip/filter calls when followed with a 'trailer', e.g. zip()[x] (#24) https://github.com/python/cpython/commi

[issue30004] in regex-howto, improve example on grouping

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +akuchling ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue29990] Range checking in GB18030 decoder

2017-04-05 Thread Xiang Zhang
Xiang Zhang added the comment: Yes, 0x80 doesn't matter here. It's nice to make the backporting PRs. But let's wait some time for ezio and haypo's comments and reviews. Get the master PR merged first and then continue on backporting. :-) -- ___ Pyt

[issue30004] in regex-howto, improve example on grouping

2017-04-05 Thread Cristian Barbarosie
New submission from Cristian Barbarosie: In the Regular Expression HOWTO https://docs.python.org/3.6/howto/regex.html#regex-howto the last example in the "Grouping" section has a bug. The code is supposed to find repeated words, but it catches false repetitions. >>> p = re.compile(r'(\b\w+)\s+\

[issue29990] Range checking in GB18030 decoder

2017-04-05 Thread Ma Lin
Ma Lin added the comment: > except 0x80 (€) I suppose the English edition is not the final release of GB18030-2000. At the end of official Chinese edition of GB18030-2005, listed the difference between GB18030-2000 and GB18030-2005 clearly, it doesn't mention 0x80 (€), so GB18030-2000 should

[issue30003] Remove hz codec

2017-04-05 Thread Ma Lin
New submission from Ma Lin: hz is a Simplified Chinese codec, available in Python since around 2004. However, hz encoder has a serious bug, it forgets to escape ~ >>> 'hi~'.encode('hz') b'hi~'# the correct output should be b'hi~~' As a result, we can't finish a roundtrip: >>> b'hi~'.decode(

[issue30001] CPython contribution docs reference missing /issuetracker page

2017-04-05 Thread Mariatta Wijaya
Mariatta Wijaya added the comment: Thanks for the report, Alex. The issue tracker for the devguide is at https://github.com/python/devguide Do you mind filling the issue there? I'm closing this since this tracks only issues for CPython. Thanks :) -- nosy: +Mariatta stage: -> resolved

[issue29990] Range checking in GB18030 decoder

2017-04-05 Thread Xiang Zhang
Changes by Xiang Zhang : -- stage: -> patch review versions: +Python 2.7, Python 3.5, Python 3.6 ___ Python tracker ___ ___ Python-bu

[issue29990] Range checking in GB18030 decoder

2017-04-05 Thread Xiang Zhang
Xiang Zhang added the comment: The table in wikipedia is somewhat complex. I find ftp://ftp.software.ibm.com/software/globalization/documents/gb18030m.pdf and the table in it is same as https://pan.baidu.com/share/link?shareid=2606985291&uk=3341026630 (except 0x80) but in English. I agree wit

[issue30002] Minor change to https://docs.python.org/3.6/extending/building.html

2017-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm not really sure that is a standard or even a best practice. I think some people do it and some don't. -- nosy: +rhettinger ___ Python tracker _

[issue30002] Minor change to https://docs.python.org/3.6/extending/building.html

2017-04-05 Thread Arthur Goldberg
New submission from Arthur Goldberg: The core example on this page starts: from distutils.core import setup, Extension module1 = Extension('demo', sources = ['demo.c']) ... I suggest that 'sources = ['demo.c']' be changed to 'sources = ['demomodule.c']', because this woul

[issue30001] CPython contribution docs reference missing /issuetracker page

2017-04-05 Thread AJ Jordan
New submission from AJ Jordan: https://cpython-devguide.readthedocs.io/pullrequest.html#licensing (and presumably other pages in this project) references https://cpython-devguide.readthedocs.io/issuetracker, but this page returns 404 Not Found. -- assignee: docs@python components: Doc

[issue30000] Inconsistency in the zlib module

2017-04-05 Thread Ellison Marks
New submission from Ellison Marks: In the zlib module, three of the methods support the wbits parameter, those being zlib.compressobj, zlib.decompress and zlib.decompressobj. zlib.compress does not support the wbits parameter. Looking at the source for these functions, those that support the w

[issue29999] repr() of ImportError misses keyword arguments name and path

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1179 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29999] repr() of ImportError misses keyword arguments name and path

2017-04-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: The repr of standard exceptions usually looks as exception constructor used for creating that exception. But the repr of ImportError misses keyword arguments name and path. >>> ImportError('test', name='somename', path='somepath') ImportError('test',) Pro

[issue25229] distutils doesn't add "-Wl, " prefix to "-R" on Linux if the C compiler isn't named 'gcc'

2017-04-05 Thread François Bissey
François Bissey added the comment: I am seeing this with clang on linux. It breaks the building pyzmq. I'll concur with Calvin that using just "-R" is wrong in the first place. Some compiler may pass it directly to the linker. But even in the linker, interpreting "-R" as a rpath if the argumen

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Eryk Sun
Eryk Sun added the comment: > Though I don't have any idea if it works on Windows, but it seems > properly factored. Generally it should. However, os.get_terminal_size is unnecessarily limited to the standard handles with a hard-coded mapping 0 => StandardInput, 1 => StandardOutput, and 2 =>

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: * In IDLE sys.stdout.isatty() returns True, but sys.stdout.fileno() raises an exception. Terminal width can't be determined and the default 80 is used. * You always can pass explicit width to pprint. This may be needed even with default width 80. Now on wide

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: This is not a problem for doctests, since the output stream is not a terminal; the check for terminal-ness seems reasonable. (Though I don't have any idea if it works on Windows, but it seems properly factored.) -- ___

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: Some thoughts: * I'm not sure the terminal width will always be knowable, for example when using IDLE. * I often need smaller widths when printing short dicts and lists. The smaller widths better show the parallel structure. I think having it fill the wi

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1178 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Pickling and copying ImportError doesn't preserve name and path attributes. >>> import copy, pickle >>> e = ImportError('test', name='n', path='p') >>> e.name 'n' >>> e.path 'p' >>> e2 = pickle.loads(pickle.dumps(e, 4)) >>> e2.name >>> e2.path >>> e2 = copy.

[issue29997] Suggested changes for https://docs.python.org/3.6/extending/extending.html

2017-04-05 Thread Fred L. Drake, Jr.
Changes by Fred L. Drake, Jr. : -- nosy: +fdrake ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue29997] Suggested changes for https://docs.python.org/3.6/extending/extending.html

2017-04-05 Thread Arthur Goldberg
Arthur Goldberg added the comment: Also, Incorrect number agreement: s/strategy that minimizes this kind of errors/strategy that minimizes this kind of error/ -- ___ Python tracker __

[issue29997] Suggested changes for https://docs.python.org/3.6/extending/extending.html

2017-04-05 Thread Arthur Goldberg
New submission from Arthur Goldberg: I've just taught myself how to write C extensions to Python with https://docs.python.org/3.6/extending/extending.html. I think it's quite good. Nevertheless, I've some suggested improvements. These all use the vi s/// replacement syntax. Ambiguous 'it': s/

[issue28765] _sre.compile(): be more strict on types of indexgroup and groupindex

2017-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patch makes some operations slightly faster. $ ./python -m perf timeit -s 'import re; m = re.match(r"(?P\d+)(?:\.(?P\d*))?", "12.34")' -- --duplicate 100 'm.lastgroup' Unpatched: Median +- std dev: 204 ns +- 1 ns Patched:Median +- std dev: 167 ns +-

[issue28765] _sre.compile(): be more strict on types of indexgroup and groupindex

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1177 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29993] error of parsing encoded words in email of standard library

2017-04-05 Thread R. David Murray
R. David Murray added the comment: Actually, looking at the issue related to the patch, we conferred at the time, Barry, and decided on no backports. It was applied only to default. Sijian: the reason we put the issue number in the commit message is because the issue often contains relevant

[issue29962] Add math.remainder operation

2017-04-05 Thread Mark Dickinson
Changes by Mark Dickinson : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue29993] error of parsing encoded words in email of standard library

2017-04-05 Thread R. David Murray
R. David Murray added the comment: I consciously decided not to backport this to 2.7 at the time, though I'm not sure I said that out loud. I think it is too much of a behavior change for 2.7. -- resolution: -> rejected stage: -> resolved status: open -> closed _

[issue29962] Add math.remainder operation

2017-04-05 Thread Mark Dickinson
Mark Dickinson added the comment: New changeset a0ce375e10b50f7606cb86b072fed7d8cd574fe7 by Mark Dickinson in branch 'master': bpo-29962: add math.remainder (#950) https://github.com/python/cpython/commit/a0ce375e10b50f7606cb86b072fed7d8cd574fe7 -- ___

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1176 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: pprint() uses width=80 by default. But default output stream is sys.stdout which often is connected to a terminal, and terminals now usually have larger width than 80 columns. Proposed patch change the default value of the width parameter in pprint(). If

[issue29640] _PyThreadState_Init and fork race leads to inconsistent key list

2017-04-05 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +neologix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue29992] Expose parse_string in JSONDecoder

2017-04-05 Thread Bob Ippolito
Bob Ippolito added the comment: I agree with that sentiment. If we were to want to support this use case I would rather put together a coherent way to augment the parsing/encoding of anything than bolt it on to what we have. -- ___ Python tracker <

[issue29692] contextlib.contextmanager may incorrectly unchain RuntimeError

2017-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Then the exception for the __exit__ method should be documented in PEP 8. -- ___ Python tracker ___ __

[issue29993] error of parsing encoded words in email of standard library

2017-04-05 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Apr 05, 2017, at 03:26 PM, Raymond Hettinger wrote: >Barry, is this something that should go back to 2.7 or is that pretty much >settled business at this point? I think we should not backport this. It's a behavior change and my concern would be that anybod

[issue29692] contextlib.contextmanager may incorrectly unchain RuntimeError

2017-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: PEP 8's rule makes sense elsewhere, but for context managers I think an implicit return None is the norm and that making it explicit wouldn't improve readability. -- nosy: +rhettinger ___ Python tracker

[issue29569] threading.Timer class: Continue periodical execution till action returns True

2017-04-05 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pytho

[issue29993] error of parsing encoded words in email of standard library

2017-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: Barry, is this something that should go back to 2.7 or is that pretty much settled business at this point? -- nosy: +rhettinger ___ Python tracker _

[issue29992] Expose parse_string in JSONDecoder

2017-04-05 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- components: +Library (Lib) versions: +Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

2017-04-05 Thread Dominic Mayers
Changes by Dominic Mayers : Removed file: http://bugs.python.org/file46775/Issue29947_for_discussion_03.patch ___ Python tracker ___ ___ Pyth

[issue29947] In SocketServer, why not passing a factory instance for the RequestHandlerClass instead of the class itself?

2017-04-05 Thread Dominic Mayers
Dominic Mayers added the comment: An improved version of the patch, I hope. I will remove the old patch, because it's really does not help to see the old versions. -- Added file: http://bugs.python.org/file46781/Issue29947_for_discussion_04.patch ___

[issue29992] Expose parse_string in JSONDecoder

2017-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: I agree with Serhiy that the JSON module is already complex enough that adding more features will have a negative net effect on usability. Bob, what do you think? -- assignee: -> bob.ippolito nosy: +bob.ippolito ___

[issue13290] get vars for object with __slots__

2017-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: > On any case, feel free to mark this as "rejected" or "wont fix" Okay, will do. And though I think the idea had some significant downsides, it is was creative and we appreciate the suggestion. -- resolution: -> rejected stage: needs patch -> reso

[issue26789] Please do not log during shutdown

2017-04-05 Thread Charles Bouchard-Légaré
Changes by Charles Bouchard-Légaré : -- nosy: +Charles Bouchard-Légaré ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue29995] re.escape() escapes too much

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1175 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue13290] get vars for object with __slots__

2017-04-05 Thread João Bernardo
João Bernardo added the comment: Being the OP, at that time I felt it was important to have a vars() function that worked on __slots__ to ease something I was developing. The truth for me is: __slots__ is not really relevant anymore. The benefits it brings are not enough to make the feature us

[issue29995] re.escape() escapes too much

2017-04-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: re.escape() escapes all the characters except ASCII letters, numbers and '_'. This is too excessive, makes escaping and compiling slower and makes the pattern less human-readable. Characters "!\"%&\',/:;<=>@_`~" as well as non-ASCII characters are always l

[issue29353] Incorrect handling of HTTP response with "Content-Type: message/rfc822" header

2017-04-05 Thread R. David Murray
R. David Murray added the comment: I'm not surprised that trying to render a message parsed with 'headersonly' fails. headersonly treats the entire message body as a single string payload. I'm not sure what the correct behavior should be for the email package, but the fact that this doesn't

[issue28415] PyUnicode_FromFormat integer format handling different from printf about zeropad

2017-04-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: (Response to what I believe is latest patch.) In msg278666, my two suggestions were 'either...or', not both. The list came from Antti's msg278528, but the correct list for Python appears to be different, and different for bytes and unicode. When I made the

[issue29994] site.USER_SITE is None for Windows embeddable Python 3.6

2017-04-05 Thread Brecht Machiels
New submission from Brecht Machiels: Previous versions of the embeddable Python: Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import site >>> site.USER_SI

[issue29992] Expose parse_string in JSONDecoder

2017-04-05 Thread Tobias Oberstein
Tobias Oberstein added the comment: I agree, my use case is probably exotic: transparent roundtripping of binaries over JSON using a beginning \0 byte marker to distinguish plain string and base64 encoded binaries. FWIW, I do think however that adding "parse_string" kw param to the ctor of JS

[issue29992] Expose parse_string in JSONDecoder

2017-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: JSONDecoder constructor already has too much parameters. Adding new parameters will decrease usability. For such uncommon case I think overriding a method in a subclass is the best solution. -- nosy: +ezio.melotti, rhettinger, serhiy.storchaka _

[issue29993] error of parsing encoded words in email of standard library

2017-04-05 Thread sijian liang
New submission from sijian liang: This issue is fixed in python3 see https://github.com/python/cpython/commit/07ea53cb218812404cdbde820647ce6e4b2d0f8e -- components: email messages: 291171 nosy: barry, r.david.murray, sijian liang priority: normal severity: normal status: open title: er

[issue29878] Add global instances of int 0 and 1

2017-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset bae6881b4215b2613ad08ef0dc7bed7743c2b8cc by Serhiy Storchaka in branch 'master': Update Argument Clinic generated code for bpo-29878. (#1001) https://github.com/python/cpython/commit/bae6881b4215b2613ad08ef0dc7bed7743c2b8cc -- ___

[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-05 Thread Martin Panter
Martin Panter added the comment: Not in general. I think you would have to make special cases for partial functions, __wrapped__, and whatever else there is, and combinations of these. It would be very hard to determine the correct result for test2 in test2 = lambda: test(a=10) # test2() retu

[issue29878] Add global instances of int 0 and 1

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1174 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29992] Expose parse_string in JSONDecoder

2017-04-05 Thread Tobias Oberstein
New submission from Tobias Oberstein: Though the JSONDecoder already has all the hooks internally to allow for a custom parse_string (https://github.com/python/cpython/blob/master/Lib/json/decoder.py#L330), this currently is not exposed in the constructor JSONDecoder.__init__. It would be nic

[issue29991] http client marks valid multipart headers with defects.

2017-04-05 Thread Martin Panter
Martin Panter added the comment: Looks like a duplicate of Issue 29353, which has a more complete patch proposed. However, see my comment about a problem with using heartersonly=True. My policy-flag.v2.patch for Issue 24363 may help (the details have faded from my mind, but I suspect it will e

[issue10076] Regex objects became uncopyable in 2.5

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1173 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue10076] Regex objects became uncopyable in 2.5

2017-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since the pattern and the match objects can be considered as immutable, it is worth to implement __copy__ and __deepcopy__ returning the object itself. Proposed PR does this. It also fixes signatures of __deepcopy__ methods. Since copying didn't work in all

[issue29991] http client marks valid multipart headers with defects.

2017-04-05 Thread Paresh Verma
New submission from Paresh Verma: When http client parses a multipart response, it always taints the headers with defects. e.g. Use the attached file to start a simple http server, using current python exec, with commands: ```python .\example_bug.py server``` and run client with: ```python .\ex

[issue29955] logging decimal point should come from locale

2017-04-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: Since the date format itself isn't localized (fortunately), there is no reason to localize the decimal point either. People wanting a localized logging format can easily override the default configuration. And this proposal would break compatibility with exi