[issue29863] Add a COMPACT constant to the json module

2017-04-02 Thread Berker Peksag

Berker Peksag added the comment:

+1. See msg287773 for my reasoning.

--
nosy: +berker.peksag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29926] time.sleep ignores _thread.interrupt_main()

2017-04-02 Thread Martin Panter

Martin Panter added the comment:

BTW pthread_kill was only added to Python 3.3, so is not available for Python 
2. I’m not sure what the best fix for 2.7 would be. Maybe it’s not worth it, or 
maybe you can find another way to a signal to the user process or its main 
thread without interfering with any background threads that Idle needs. But I 
don’t know enough about how Idle works to offer a solution.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-02 Thread Michael Selik

Michael Selik added the comment:

This would also enable negative indexing, which currently raises "IndexError: 
no such group".

Edit: I meant whole numbers, not natural numbers.

--
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-02 Thread Michael Selik

Changes by Michael Selik :


--
components: +Regular Expressions
nosy: +ezio.melotti, mrabarnett
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29965] MatchObject __getitem__() should support slicing and len

2017-04-02 Thread Michael Selik

New submission from Michael Selik:

Currently, slicing a MatchObject causes an IndexError and len() a TypeError. 
It's natural to expect slicing and len to work on objects of a finite length 
that index by natural numbers.

--
messages: 291050
nosy: selik
priority: normal
severity: normal
status: open
title: MatchObject __getitem__() should support slicing and len

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29926] time.sleep ignores _thread.interrupt_main()

2017-04-02 Thread Martin Panter

Martin Panter added the comment:

Hi Terry, this patch is what I imagined a fix would look like for Linux. I am 
not familiar with Idle (internally nor externally), so there may be 
improvements you can make.

It works as I expected for normal blocking functions and a tight “for” loop: it 
interrupts any blocking call, and triggers the usual SIGINT handler. If SIGINT 
has a Python handler (e.g. by default), that gets called which usually raises 
KeyboardInterrupt.

My change has a major flaw: it seems to deadlock something if you interrupt 
“input()” or “sys.stdin.readline()”. Perhaps you might have a better clue what 
the problem is. With the default SIGINT handler, this is what I see in the Idle 
window:

>>> input()  # Press Ctrl+C
Traceback (most recent call last):  <-- cursor flashing at end of line

If SIGINT is ignored, or the Python handler doesn’t raise an exception, Ctrl+C 
seems to have the effect of inputting a newline:

>>> input()  # Press Ctrl+C
''
>>> sys.stdin.readline()  # Press Ctrl+C
'\n'

--
keywords: +patch
nosy: +martin.panter
Added file: http://bugs.python.org/file46771/int-unix.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2017-04-02 Thread Dominic Mayers

Dominic Mayers added the comment:

I started to look at the documentation to see what would need to be changed, 
assuming that we agree for a change in the API. Just for the purpose of this 
discussion, I created a patch that only change the comments in socketserver.py.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2017-04-02 Thread Dominic Mayers

Changes by Dominic Mayers :


--
keywords: +patch
Added file: http://bugs.python.org/file46770/Issue29947_for_discussion.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2017-04-02 Thread Dominic Mayers

Changes by Dominic Mayers :


Removed file: http://bugs.python.org/file46768/factorymixinclass

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19225] lack of PyExc_BufferError doc

2017-04-02 Thread Kinebuchi Tomohiko

Kinebuchi Tomohiko added the comment:

I created backporting pull requests for 2.7, 3.5 and 3.6.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19225] lack of PyExc_BufferError doc

2017-04-02 Thread Kinebuchi Tomohiko

Changes by Kinebuchi Tomohiko :


--
pull_requests: +1145

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29964] %z directive has no effect on the output of time.strptime

2017-04-02 Thread Martin Panter

Martin Panter added the comment:

We could change this to a documentation issue if you have any suggestions to 
make the documentation clearer.

I understand the “time” module is mainly a wrapper or emulator of the OS’s own 
strptime, mktime, etc functions, which explains some of these quirks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19225] lack of PyExc_BufferError doc

2017-04-02 Thread Kinebuchi Tomohiko

Changes by Kinebuchi Tomohiko :


--
pull_requests: +1144

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19225] lack of PyExc_BufferError doc

2017-04-02 Thread Kinebuchi Tomohiko

Changes by Kinebuchi Tomohiko :


--
pull_requests: +1143

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29964] %z directive has no effect on the output of time.strptime

2017-04-02 Thread Paul Pinterits

Paul Pinterits added the comment:

No no, the docs are correct. This was definitely my mistake. I'm just trying to 
say that it's rather confusing how there's only partial support for time zones. 
When I saw that there is support for parsing the time zone offset, I assumed 
that the functions provided in the time module would be enough to solve my 
problem - having to rely on the datetime module to have proper time zone 
support caught me by surprise. It's quite counterintuitive.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29964] %z directive has no effect on the output of time.strptime

2017-04-02 Thread Martin Panter

Martin Panter added the comment:

As far as I can see, the documentation only claims that “mktime” converts local 
time. If you saw a suggestion that it supports arbitrary time zones, please 
point it out.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29964] %z directive has no effect on the output of time.strptime

2017-04-02 Thread Paul Pinterits

Paul Pinterits added the comment:

I see. You're right, it does make a difference.

However, this behaviour is quite unexpected. Perhaps I just didn't read the 
docs carefully enough, but it wasn't clear to me that the time module had such 
half-baked support for time zones.

An unsuspecting user, like me, reads the documentation on strptime, which 
directs you to strftime. There you read that %z is a supported directive. Along 
the way you've come across the conversion table, which tells you that mktime() 
can convert struct_time objects to timestamps. But then when you try to parse a 
time string, the information gets lost somewhere along the way:

>>> mktime(strptime("+", "%z")) == mktime(strptime("+0200", "%z"))
True

If you visit the section about struct_time objects, you find this footnote:
"Changed in version 3.3: tm_gmtoff and tm_zone attributes are available on 
platforms with C library supporting the corresponding fields in struct tm."

But even after reading that, I'd still expect the tm_gmtoff attribute to have 
some sort of effect and not get silently discarded.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29964] %z directive has no effect on the output of time.strptime

2017-04-02 Thread Martin Panter

Martin Panter added the comment:

Are you sure? It works for me:

>>> strptime("+0200", "%z").tm_gmtoff
7200
>>> strptime("+", "%z").tm_gmtoff
0

The "struct_time" class is documented as a named tuple, but the time zone 
offset is not one of the tuple elements, so isn’t going to be checked for 
equality.

--
nosy: +martin.panter
resolution:  -> works for me
stage:  -> test needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29964] %z directive has no effect on the output of time.strptime

2017-04-02 Thread Paul Pinterits

New submission from Paul Pinterits:

%z is listed as a supported directive in the python 3 documentation 
(https://docs.python.org/3.5/library/time.html#time.strftime), but it doesn't 
actually do anything:

>>> from time import strptime
>>> strptime('+', '%z') == strptime('+0200', '%z')
True

As far as I can tell, there aren't any footnotes saying that %z might not be 
supported on some platforms, like it was back in python 2.

In case it matters, I'm using python 3.5.3 on linux.

--
components: Library (Lib)
messages: 291041
nosy: Paul Pinterits
priority: normal
severity: normal
status: open
title: %z directive has no effect on the output of time.strptime
type: behavior
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23033] Disallow support for a*.example.net, *a.example.net, and a*b.example.net in certificate wildcard handling.

2017-04-02 Thread Christian Heimes

Christian Heimes added the comment:

Ned, Benjamin,

are you ok with a backport to 2.7 and 3.6? Substring (aka partial) matching of 
wildcards is a MAY feature according to RFC 6125 
https://tools.ietf.org/html/rfc6125#section-6.4.3 . They are a violation of 
CA/B Form's baseline requirements, so no publicaly trusted cert may contain a 
CN or SAN entry with a partial wildcard. Several libraries and languages do not 
implement the feature either. Improper wildcard matching caused a bunch of 
security issues and CVEs in Python.

--
nosy: +benjamin.peterson, ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27863] multiple issues in _elementtree module

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 9c2c42c221d7996070c0c0a2a114ab42fe3ddb9d by Serhiy Storchaka in 
branch '2.7':
bpo-27863: Fixed multiple crashes in ElementTree. (#765) (#903) (#963)
https://github.com/python/cpython/commit/9c2c42c221d7996070c0c0a2a114ab42fe3ddb9d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29553] Argparser does not display closing parentheses in nested mutex groups

2017-04-02 Thread Andrew Nester

Andrew Nester added the comment:

>From my perspective current behaviour is a bit frustrate that's why it would 
>be nice to have this issue fixed, but I would say it's critic one.
At the same time it doesn't introduce any BC breaking changes and kind safe

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27863] multiple issues in _elementtree module

2017-04-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1142

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2017-04-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 68903b656d4e1011525a46cbd1338c6cbab83d6d by Serhiy Storchaka in 
branch '2.7':
bpo-15083: Convert ElementTree doctests to unittests. (#906)
https://github.com/python/cpython/commit/68903b656d4e1011525a46cbd1338c6cbab83d6d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29416] Path.mkdir can get into a recursive error loop

2017-04-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2017-04-02 Thread R. David Murray

R. David Murray added the comment:

Yes, the difficulty in renaming the parameter was why I suggested a doc change 
only.  I'm not sure it it is worth it to go through a deprecation cycle for 
socketserver to change the name, though it certainly would be nice.  Martin and 
I could make that decision, but it would be better to get input from other 
devs.  And, if we make this the documentation issue, we should open a separate 
issue for the parameter rename.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29169] update zlib to 1.2.11

2017-04-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests:  -1029

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29897] itertools.chain behaves strangly when copied with copy.copy

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, this issue is tricky, and I don't have .

If implement __copy__ for builtin compound iterators I would implement 
filter.__copy__ and map.__copy__ something like:

def __copy__(self):
cls, *args = self.__reduce__()
return cls(*map(copy, args))

If the underlying iterators properly support copying, the copying of filter and 
map iterators will be successful. If they don't support copying, the copying of 
filter and map iterators should fail, and don't accumulate elements in the 
tee() object.

But there are open questions.

1. This is a behavior change. What if any code depends on the current behavior? 
This is silly, copy(filter) and copy(map) could just return the original 
iterator if this is a desirable behavior.

2. Depending on the copy module in the method of the builtin type looks 
doubtful. Should we implement copy.copy() in C and provide a public C API?

3. If make a copying of limited depth, shouldn't we use a memo as for 
deepcopy() to prevent unwanted duplications? Otherwise the copied `map(func, 
it, it)` would behave differently from the original. This example is not so 
silly as looked.

4. Is it possible to implement the copying for all compound iterators? For 
example the copying of chain() should change the state of the original object 
(by using __setstate__), so that it makes copies of subiterators before using 
them.

Perhaps all this deserves a PEP.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29963] Remove obsolete declaration PyTokenizer_RestoreEncoding in tokenizer.h

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good catch Jim! Seems the implementation was removed in Python 3. This is a 
private header, so no need to backport the change.

--
nosy: +serhiy.storchaka
stage:  -> patch review
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29963] Remove obsolete declaration PyTokenizer_RestoreEncoding in tokenizer.h

2017-04-02 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
pull_requests: +1141

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29963] Remove obsolete declaration PyTokenizer_RestoreEncoding in tokenizer.h

2017-04-02 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Couldn't trace exactly when it was removed from tokenizer.c but the 
corresponding declaration in the header file survived.

I'm not sure how to tag this small clean-up.

--
messages: 291033
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Remove obsolete declaration PyTokenizer_RestoreEncoding in tokenizer.h
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2017-04-02 Thread Andre Merzky

Andre Merzky added the comment:

This one might be related:

https://bugs.python.org/issue27889

--
nosy: +Andre Merzky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19225] lack of PyExc_BufferError doc

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your patch Kinebuchi. Do you mind to backport it to other 
branches?

--
stage: patch review -> backport needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19225] lack of PyExc_BufferError doc

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset e8c763128fb459c5c98194e4312f31493c0f12df by Serhiy Storchaka 
(cocoatomo) in branch 'master':
bpo-19225: Add a table of warning names and missed exception names in C API doc 
(#881)
https://github.com/python/cpython/commit/e8c763128fb459c5c98194e4312f31493c0f12df


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29654] SimpleHTTPRequestHandler should support browser cache

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your contribution Pierre.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29654] SimpleHTTPRequestHandler should support browser cache

2017-04-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 351adda54bed3afbbf6db7725699679e68722d7d by Serhiy Storchaka 
(Pierre Quentel) in branch 'master':
bpo-29654 : Support If-Modified-Since HTTP header (browser cache) (#298)
https://github.com/python/cpython/commit/351adda54bed3afbbf6db7725699679e68722d7d


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29897] itertools.chain behaves strangly when copied with copy.copy

2017-04-02 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

It is a tricky issue. How deep do you go?what if you are chaining several
of the itertools? Seems like we're entering a semantic sinkhole here.

Deepcopy would be too deep...
The original copy support in these objects stems from the desire to support
pickling.

On 1 Apr 2017 16:12, "Raymond Hettinger"  wrote:

>
> Raymond Hettinger added the comment:
>
> Serhiy, feel free to take this in whatever direction you think is best.
>
> --
> assignee:  -> serhiy.storchaka
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2017-04-02 Thread Dominic Mayers

Dominic Mayers added the comment:

I did not think very far when said that renaming the parameter could not 
possibly break the code ! Oh well ! But, renaming the parameter was not 
important in itself.  It was to make the situation clearer and easier for those 
who write the documentation. Martin mentioned that it is a big change for the 
API. This is what I had in mind. And yes, I should have used 'factory 
function', not 'factory instance'. Oh well ! I am glad things are working and 
that we will move ahead to resolve this issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-04-02 Thread Benjamin Peterson

Benjamin Peterson added the comment:


New changeset 11fa3c7cd1b151e302d4eee0369cafbaf151c8fb by Benjamin Peterson 
(Michael Selik) in branch 'master':
bpo-29957: change LBYL key lookup to dict.setdefault (#938)
https://github.com/python/cpython/commit/11fa3c7cd1b151e302d4eee0369cafbaf151c8fb


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com