[issue29977] re.sub stalls forever on an unmatched non-greedy case

2017-04-04 Thread Robert Lujo

New submission from Robert Lujo:

Hello, 

I assume I have hit some bug/misbehaviour in re module. I will provide you 
"working" example:

import re
RE_C_COMMENTS= re.compile(r"/\*(.|\s)*?\*/", 
re.MULTILINE|re.DOTALL|re.UNICODE)
text = "Special section /* 
valves:\n\n\nsilicone\n\n\n\n\n\n\nHarness:\n\n\nmetal and plastic 
fibre\n\n\n\n\n\n\nInner 
frame:\n\n\nmultibutylene\n\n\n\n\n\n\nWeight:\n\n\n147 
g\n\n\n\n\n\n\n\n\n\n\n\n\n\nSelection guide\n"

and then this command takes forever:
RE_C_COMMENTS.sub(" ", text, re.MULTILINE|re.DOTALL|re.UNICODE)

and the same problem you can notice on first 90 chars, it takes 10s on my 
machine:
RE_C_COMMENTS.sub(" ", text[:90], re.MULTILINE|re.DOTALL|re.UNICODE)

Some clarification: I try to remove the C style comments from text with 
non-greedy regular expression, and in this case start of comment (/*) is found, 
and end of comment (*/) can not be found. Notice the multiline and other re 
options.

Python versions used: 

'2.7.11 (default, Jan 22 2016, 16:30:50) \n[GCC 4.2.1 Compatible Apple LLVM 6.0 
(clang-600.0.57)]' / macOs 10.12.13

and:
'2.7.12 (default, Nov 19 2016, 06:48:10) \n[GCC 5.4.0 20160609]' -> 
Linux 84-Ubuntu SMP Wed Feb 1 17:20:32 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

--
components: Regular Expressions
messages: 291107
nosy: Robert Lujo, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.sub stalls forever on an unmatched non-greedy case
type: performance
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



[issue29968] Document that no characters are allowed to proceed \ in explicit line joining

2017-04-04 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Ah, yes, the Ref. Manual, not the devguide, silly mistake.

It definitely isn't a documentation bug (the documentation doesn't state 
something wrong) as much as I think it might be a slight omission. I really 
wasn't aware of how strict the tokenizer is with any characters after `\`.

--

___
Python tracker 

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



[issue29977] re.sub stalls forever on an unmatched non-greedy case

2017-04-04 Thread Gareth Rees

Gareth Rees added the comment:

The problem here is that both "." and "\s" match a whitespace character, and 
because you have the re.DOTALL flag turned on this includes "\n", and so the 
number of different ways in which (.|\s)* can be matched against a string is 
exponential in the number of whitespace characters in the string.

It is best to design your regular expression so as to limit the number of 
different ways it can match. Here I recommend the expression:

/\*(?:[^*]|\*[^/])*\*/

which can match in only one way.

--
nosy: +g...@garethrees.org

___
Python tracker 

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



[issue29977] re.sub stalls forever on an unmatched non-greedy case

2017-04-04 Thread Gareth Rees

Gareth Rees added the comment:

See also issue28690, issue212521, issue753711, issue1515829, etc.

--

___
Python tracker 

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



[issue29977] re.sub stalls forever on an unmatched non-greedy case

2017-04-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a well known issue called catastrophic backtracking. It can't be solved 
with the current implementation of the regular expression engine. The best you 
can rewrite your regular expression. Even replacing "(.|\s)" with just "." can 
help.

--
nosy: +serhiy.storchaka
resolution:  -> wont fix
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



[issue29931] ipaddress.ip_interface __lt__ check seems to be broken

2017-04-04 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Serhiy, just checking whether this needs backport? The PR has the backport to 
3.5 and 3.6 labels, but it's not indicated in this ticket.
If it doesn't need backport, then perhaps we can close this issue.
Thanks.

--
nosy: +Mariatta

___
Python tracker 

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



[issue29971] Lock.acquire() not interruptible on Windows

2017-04-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I am not competent enough to pronounce on the technical detail of what you are 
proposing, but:

> Or maybe refactor to use condition variables in performance-critical code and 
> otherwise use kernel waits, if that makes sense.

That can make sense IMHO.  Lock and RLock are Python-facing objects, so I'm not 
sure using high-performance userspace primitives is really important there 
(after all, people will primarily suffer the evaluation cost of pure Python 
code so, unless you do something silly such as acquire and release a Python 
lock in a loop, the acquisition cost doesn't really matter).  OTOH, the GIL may 
be more performance-critical (and needn't be interrupted), so can use userspace 
CV primitives.

That will however entail a complication of the internal locking API, since we 
basically need two separate PyThread lock APIs: an "interruptible lock" API and 
a "fast lock" API.

--
nosy: +tim.peters

___
Python tracker 

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



[issue29931] ipaddress.ip_interface __lt__ check seems to be broken

2017-04-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: needs patch -> backport needed

___
Python tracker 

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



[issue29972] Skip tests known to fail on AIX

2017-04-04 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 5de85a17029356084b96db63e04d9eb150efd9c0 by Victor Stinner in 
branch 'master':
bpo-29972: Skip tests known to fail on AIX (#979)
https://github.com/python/cpython/commit/5de85a17029356084b96db63e04d9eb150efd9c0


--

___
Python tracker 

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



[issue29978] Remove remove merge=union attribute for Misc/NEWS in 3.6 and 2.7

2017-04-04 Thread Mariatta Wijaya

New submission from Mariatta Wijaya:

In https://github.com/python/cpython/pull/212, merge=union was added to the 
.gitattributes, but was later removed in 
https://github.com/python/cpython/pull/460.

Somehow this attribute made their way into 3.6 and 2.7.

I will remove it.

--
assignee: Mariatta
messages: 291115
nosy: Mariatta
priority: normal
severity: normal
stage: needs patch
status: open
title: Remove remove merge=union attribute for Misc/NEWS in 3.6 and 2.7
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue11066] cgi.py proposals : sys.stdout encoding + rewriting of parsing functions

2017-04-04 Thread Pierre Quentel

Pierre Quentel added the comment:

I close this issue and will open a more specific one for the rewriting of 
parse_multipart()

--
resolution:  -> out of date
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



[issue29931] ipaddress.ip_interface __lt__ check seems to be broken

2017-04-04 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue29979] cgi.parse_multipart is not consistent with FieldStorage

2017-04-04 Thread Pierre Quentel

New submission from Pierre Quentel:

In the cgi module, the parse_multipart() function duplicates code from 
FieldStorage, and the result is not compliant with that of FieldStorage for 
requests sent with multipart/form-data : for non-file fields, the value 
associated with a key is a list of *bytes* in parse_multipart() and a list of 
*strings* for FieldStorage (the bytes decoded with the argument "encoding" 
passed to FieldStorage()).

I will propose a PR on the Github repo with a version of parse_multipart that 
uses FieldStorage and returns the same result (values as strings). The function 
will take an additional argument "encoding".

--
components: Library (Lib)
messages: 291117
nosy: quentel
priority: normal
severity: normal
status: open
title: cgi.parse_multipart is not consistent with FieldStorage
type: behavior
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



[issue29978] Remove remove merge=union attribute for Misc/NEWS in 3.6 and 2.7

2017-04-04 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1159

___
Python tracker 

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



[issue29971] Lock.acquire() not interruptible on Windows

2017-04-04 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-04-04 Thread Charalampos Stratakis

Charalampos Stratakis added the comment:

Currently we haven't updated to Python 3.6.1 at Fedora 26 due to this issue.

While it is a release blocker for 3.6.2, what can be done for 3.6.1?

--

___
Python tracker 

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



[issue29978] Remove remove merge=union attribute for Misc/NEWS in 3.6 and 2.7

2017-04-04 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1160

___
Python tracker 

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



[issue29649] struct.pack_into check boundary error message ignores offset

2017-04-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset f78b119364b521307237a1484ba5f43f42300898 by Serhiy Storchaka 
(Andrew Nester) in branch 'master':
bpo-29649: Improve struct.pack_into() boundary error messages (#424)
https://github.com/python/cpython/commit/f78b119364b521307237a1484ba5f43f42300898


--

___
Python tracker 

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



[issue29649] struct.pack_into check boundary error message ignores offset

2017-04-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your contribution Andrew.

--
resolution:  -> fixed
stage: patch review -> 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



[issue29974] Change typing.TYPE_CHECKING doc example

2017-04-04 Thread Mathias Rav

Changes by Mathias Rav :


--
title: typing.TYPE_CHECKING doc example is incorrect -> Change 
typing.TYPE_CHECKING doc example

___
Python tracker 

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



[issue29974] Change typing.TYPE_CHECKING doc example

2017-04-04 Thread Mathias Rav

Mathias Rav added the comment:

I have updated the patch after feedback from Jelle Zijlstra and Ivan 
Levkevskyi. Indeed the example was correct; the patch now adds wording from PEP 
484 and PEP 526 to clarify why a function parameter annotation needs to be in 
quotes and a local variable annotation does not.

--

___
Python tracker 

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



[issue29978] Remove remove merge=union attribute for Misc/NEWS in 3.6 and 2.7

2017-04-04 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
resolution:  -> fixed
stage: needs patch -> 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



[issue29979] cgi.parse_multipart is not consistent with FieldStorage

2017-04-04 Thread Pierre Quentel

Changes by Pierre Quentel :


--
pull_requests: +1162

___
Python tracker 

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



[issue29979] cgi.parse_multipart is not consistent with FieldStorage

2017-04-04 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Looking forward to this.

--
assignee:  -> orsenthil
nosy: +orsenthil

___
Python tracker 

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



[issue29979] cgi.parse_multipart is not consistent with FieldStorage

2017-04-04 Thread Pierre Quentel

Changes by Pierre Quentel :


--
pull_requests: +1163

___
Python tracker 

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



[issue29968] Document that no characters are allowed to proceed \ in explicit line joining

2017-04-04 Thread R. David Murray

R. David Murray added the comment:

I don't see any omission, myself.  Keep in mind that the language reference is 
as much or more of a specification as it is a reference, so we tend to try to 
use the minimum language that precisely describes the expected behavior. Which 
is why I suggested that if anything the sentence about trailing comments should 
be dropped :)  

And I would vote -1 on allowing trailing whitespace.  (More than -1, actually 
:)  If that's what you meant: you said "proceed \", which doesn't sound like 
*trailing* whitespace.

--

___
Python tracker 

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



[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2017-04-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Reviewing the discussion, I assume this was left open to cover reordering the 
__aenter__ and __aexit__ checks for async with, but that can just as easily be 
handled as a separate issue (which would also be clearer at the NEWS level).

--
stage: patch review -> 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



[issue29851] Have importlib.reload() raise ModuleNotFoundError when a spec can't be found

2017-04-04 Thread Brett Cannon

Brett Cannon added the comment:

That's a good point, Serhiy, since that's what the exception is signaling. So 
yes, the exception should be ModuleNotFounderror.

--
title: Have importlib.reload() raise ImportError when a spec can't be found -> 
Have importlib.reload() raise ModuleNotFoundError when a spec can't be found

___
Python tracker 

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



[issue29980] OSError: multiple exceptions should preserve the exception type if it is common

2017-04-04 Thread R. David Murray

New submission from R. David Murray:

create_connection will try multiple times to connect if there are multiple 
addresses returned by getaddrinfo.  If all connections file it inspects the 
exceptions, and raises the first one if they are all equal.  But since the 
addresses are often different (else why would we try multiple times?), the 
messages will usually be different.  When the messages are different, the code 
raises an OSError with a list of the exceptions so the user can see them all.  
This, however, looses the information as to *what* kind of exception occurred 
(ie: ConnectioRefusedError, etc).

I propose that if all of the exceptions raised are of the same subclass, that 
that subclass be raised with the multi-message list, rather than the base 
OSError.

--
components: asyncio
messages: 291126
nosy: r.david.murray, yselivanov
priority: normal
severity: normal
status: open
title: OSError: multiple exceptions should preserve the exception type if it is 
common

___
Python tracker 

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



[issue29980] OSError: multiple exceptions should preserve the exception type if it is common

2017-04-04 Thread R. David Murray

R. David Murray added the comment:

If all connections fail (not file :)

--

___
Python tracker 

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



[issue29968] Document that no characters are allowed to proceed \ in explicit line joining

2017-04-04 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Gotcha, thanks for the input, David. I'll leave it to you to decide if the 
sentence on the trailing comments warrants removal.

--
resolution:  -> rejected
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



[issue29981] Update Index set, dict, and generator 'comprehensions'

2017-04-04 Thread Terry J. Reedy

New submission from Terry J. Reedy:

The index currently has

comprehensions
   *list*

with *list* linked to 6.2.5 List displays.  I suggest:

1. Link *comprehensions* to 6.2.4. Displays for lists, sets and dictionaries
2. Add subentries *set*, *dict*, and *generator* linked to
2a. 6.2.6. Set displays
2b. 6.2.7. Dictionary displays
2c. 6.2.8. Generator expressions

We don't *call* generator expressions 'generator comprehensions', but that is 
what they are syntactically and one looking for 'comprehensions' should be able 
to find them there.

There is already

*list*
   ...
   *comprehensions*
   ...
*list comprehensions*

with 'list' and 'list comprehensions' linked to glossary entries, while 'list, 
comprehensions' links to the same section as 'comprehensions, list'.  

3. Add 'set/dictionary, comprehensions' sub-entries linked like 'list, com
4. Add Glossary entries and links like 'list comprehensions'

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 291129
nosy: docs@python, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Update Index set, dict, and generator 'comprehensions'
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue29982] tempfile.TemporaryDirectory fails to delete itself

2017-04-04 Thread Max

New submission from Max:

There's a known issue with `shutil.rmtree` on Windows, in that it fails 
intermittently. 

The issue is well known 
(https://mail.python.org/pipermail/python-dev/2013-September/128353.html), and 
the agreement is that it cannot be cleanly solved inside `shutil` and should 
instead be solved by the calling app. Specifically, python devs themselves 
faced it in their test suite and solved it by retrying delete.

However, what to do about `tempfile.TemporaryDirectory`? Is it considered the 
calling app, and therefore should retry delete when it calls `shutil.rmtree` in 
its `cleanup` method?

I don't think `tempfile` is protected by the same argument that `shutil.rmtree` 
is protected, in that it's too messy to solve it in the standard library. My 
rationale is that while it's very easy for the end user to retry 
`shutil.rmtree`, it's far more difficult to fix the problem with 
`tempfile.TempDirectory` not deleting itself - how would the end user retry the 
`cleanup` method (which is called from `weakref.finalizer`)?

So perhaps the retry loop should be added to `cleanup`.

--
components: Library (Lib)
messages: 291130
nosy: max
priority: normal
severity: normal
status: open
title: tempfile.TemporaryDirectory fails to delete itself
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29981] Update Index for set, dict, and generator 'comprehensions'

2017-04-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

See #29983 for expanding the title of the 'atoms' section containing 
subsections on comprehensions.

--
title: Update Index set, dict, and generator 'comprehensions' -> Update Index 
for set, dict, and generator 'comprehensions'

___
Python tracker 

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



[issue29983] Reference TOC: expand 'Atoms' and 'Primaries'

2017-04-04 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Today there is a fairly long python-list thread about the difficult of finding 
info on 'dict comprehensions' in the doc.  Point 1 is missing index entries.  I 
opened #29981 for this.  Point 2 is something I have also noticed: the 
obscurity of 'Atoms' and 'Primaries' as titles of sections in the Expressions 
chapter.  These are fairly esoteric Computer Science language theory terms.  
Compare these to beginner-friendly 'Binary arithmetic operators' and 
'Comparisons'.

My specific suggestions, subject to change:

Atoms, including identifiers, literals, displays, and comprehensions
Primaries: attributes, subscripts, slices, and calls

--
assignee: docs@python
components: Documentation
messages: 291131
nosy: docs@python, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Reference TOC: expand 'Atoms' and 'Primaries'
type: enhancement
versions: Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29983] Reference TOC: expand 'Atoms' and 'Primaries'

2017-04-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

'displays' is partly redundant with 'comprehensions'.  Since many think of 
other 'displays' as a type of literal, leave 'displays' out.  They are well 
indexed.  I think the most likely term people have trouble finding in the TOC 
is 'comprehension'.  It was not immediately obvious to most that should be 
'atoms'.

--

___
Python tracker 

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



[issue13290] get vars for object with __slots__

2017-04-04 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue29905] TypeErrors not formatting values correctly

2017-04-04 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

As per #issue25002 and, specifically #msg250151, the TypeError in `asynchat` 
should probably not be included, I'll just make a PR for the TypeError in 
asyncio/proactor_events

--

___
Python tracker 

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



[issue28681] About function renaming in the tutorial

2017-04-04 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue29970] Severe open file leakage running asyncio SSL server

2017-04-04 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +giampaolo.rodola, haypo

___
Python tracker 

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



[issue29970] Severe open file leakage running asyncio SSL server

2017-04-04 Thread Yury Selivanov

Yury Selivanov added the comment:

I'm assigning this to myself to make sure I don't forget about this. If someone 
wants to tackle this please feel free to reassign.

--
assignee:  -> yselivanov
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



[issue29984] Improve test coverage for 'heapq' module

2017-04-04 Thread Robert Day

New submission from Robert Day:

It's currently at 97%:

Name   Stmts   Miss  Cover   Missing

Lib/heapq.py 262  797%   187, 351-352, 375-376, 606-607

I'm submitting a Github PR to fix it.

--
components: Tests
messages: 291136
nosy: Robert Day
priority: normal
severity: normal
status: open
title: Improve test coverage for 'heapq' module
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



[issue29984] Improve test coverage for 'heapq' module

2017-04-04 Thread Robert Day

Changes by Robert Day :


--
pull_requests: +1165

___
Python tracker 

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-04-04 Thread Maciej Szulik

Changes by Maciej Szulik :


--
nosy: +maciej.szulik

___
Python tracker 

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



[issue28087] macOS 12 poll syscall returns prematurely

2017-04-04 Thread Ennis Massey

Ennis Massey added the comment:

Makes sense it would also fail. They both use the same syscall. Gud job on the 
backport

Sent from my iPhone

> On 4/04/2017, at 4:50 AM, STINNER Victor  wrote:
> 
> 
> STINNER Victor added the comment:
> 
> Ah! Python 2.7 tests succeeded on Sierra!
> 
> http://buildbot.python.org/all/builders/x86-64%20Sierra%202.7/builds/3
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue7659] Attribute assignment on object() instances raises wrong exception

2017-04-04 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

I don't think a change is actually needed here (bumping to decide the fate of 
this issue)

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue29982] tempfile.TemporaryDirectory fails to delete itself

2017-04-04 Thread Eryk Sun

Changes by Eryk Sun :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
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



[issue29966] typing.get_type_hints doesn't really work for classes with ForwardRefs

2017-04-04 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

You could try:

glob = globals.copy()
glob.update(a.__dict__)
glob.update(b.__dict__)

You can do this automatically following MyClass.__mro__ and then collecting 
relevant __module__ attributes on bases.

However, there is little chance this will be fixed in typing itself. It is 
difficult to cover all possible cases, so that users should choose custom 
globals/locals for their needs.

--
nosy: +levkivskyi

___
Python tracker 

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



[issue29977] re.sub stalls forever on an unmatched non-greedy case

2017-04-04 Thread Matthew Barnett

Matthew Barnett added the comment:

A slightly shorter form:

/\*(?:(?!\*/).)*\*/

Basically it's:

match start

while not match end:
consume character

match end

If the "match end" is a single character, you can use a negated character set, 
for example:

[^\n]*

otherwise you need a negative lookahead, for example:

(?:(?!\r\n).)*

--

___
Python tracker 

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



[issue29905] TypeErrors not formatting values correctly

2017-04-04 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
pull_requests: +1166

___
Python tracker 

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



[issue7659] Attribute assignment on object() instances raises wrong exception

2017-04-04 Thread R. David Murray

R. David Murray added the comment:

Agreed.  Time to close this.

--
resolution:  -> not a bug
stage: needs patch -> 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



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

2017-04-04 Thread Dominic Mayers

Dominic Mayers added the comment:

I simplified the patch. Using a class as a factory function is the simplest 
case, so I took advantage of this. I also give one way to pass extra parameters 
to the handler in the factory function, because it's the main reason why we 
cannot always use a class.

--
Added file: http://bugs.python.org/file46774/Issue29947_for_discussion_02.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-04 Thread Dominic Mayers

Changes by Dominic Mayers :


Removed 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



[issue29985] make install doesn't seem to support --quiet

2017-04-04 Thread Chris Jerdonek

New submission from Chris Jerdonek:

When installing from source, the --quiet option works with "configure" and a 
bare "make":

$ ./configure --quiet
$ make --quiet

However, it doesn't seem to work when passed to "make install" (and "make 
altinstall", etc). I tried a number of variations like:

$ make --quiet install
$ make install --quiet
etc.

The install output is quite verbose, so it would be useful to support --quiet. 
This should still allow warnings, etc, through like it does for configure and 
bare make.

--
components: Installation
messages: 291143
nosy: chris.jerdonek
priority: normal
severity: normal
status: open
title: make install doesn't seem to support --quiet
type: enhancement
versions: Python 3.6

___
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-04 Thread Dominic Mayers

Changes by Dominic Mayers :


Removed file: 
http://bugs.python.org/file46774/Issue29947_for_discussion_02.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-04 Thread Dominic Mayers

Changes by Dominic Mayers :


Added file: http://bugs.python.org/file46775/Issue29947_for_discussion_03.patch

___
Python tracker 

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



[issue29986] Documentation recommends raising TypeError from tp_richcompare

2017-04-04 Thread Devin Jeanpierre

New submission from Devin Jeanpierre:

am not sure when TypeError is the right choice. Definitely, most of the time 
I've seen it done, it causes trouble, and NotImplemented usually does something 
better.

For example, see the work in https://bugs.python.org/issue8743 to get set to 
interoperate correctly with other set-like classes --- a problem caused by the 
use of TypeError instead of returning NotImplemented (e.g. 
https://hg.python.org/cpython/rev/3615cdb3b86d).

This advice seems to conflict with the usual and expected behavior of objects 
from Python: e.g. object().__lt__(1) returns NotImplemented rather than raising 
TypeError, despite < not "making sense" for object. Similarly for file objects 
and other uncomparable classes. Even complex numbers only return NotImplemented!


>>> 1j.__lt__(1j)
NotImplemented


If this note should be kept, this section could use a decent explanation of the 
difference between "undefined" (should return NotImplemented) and "nonsensical" 
(should apparently raise TypeError). Perhaps a reference to an example from the 
stdlib.

--
assignee: docs@python
components: Documentation
messages: 291144
nosy: Devin Jeanpierre, docs@python
priority: normal
pull_requests: 1167
severity: normal
status: open
title: Documentation recommends raising TypeError from tp_richcompare

___
Python tracker 

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



[issue29986] Documentation recommends raising TypeError from tp_richcompare

2017-04-04 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

Sorry, forgot to link to docs because I was copy-pasting from the PR:

https://docs.python.org/2/c-api/typeobj.html#c.PyTypeObject.tp_richcompare

https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare

> Note: If you want to implement a type for which only a limited set of 
> comparisons makes sense (e.g. == and !=, but not < and friends), directly 
> raise TypeError in the rich comparison function.

--

___
Python tracker 

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



[issue29986] Documentation recommends raising TypeError from tp_richcompare

2017-04-04 Thread R. David Murray

R. David Murray added the comment:

The documentation is technically correct, as far as I can see.  Issue 8743 is 
not about disallowing certain comparison operations, but rather incorrectly 
implementing the earlier sentence in that same doc section: "If the comparison 
is undefined, it must return Py_NotImplemented".  Perhaps the wording should be 
changed so that instead of saying "only a limited set of comparisons makes 
sense" it says "if you wish to disallow certain comparison operations while 
allowing others".  It should also probably be demoted from being a '.. note', 
since it is, as you note, an exceptional case, not a common one.

But you might be right that it would be better to delete it altogether, since 
it is generally better to let the comparison machinery raise the error if none 
of the types implements the comparison...what would be the rationale for a 
blanket *dis*allowing of a particular comparison operation?  

Let's see what Raymond thinks.

--
nosy: +r.david.murray, rhettinger

___
Python tracker 

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



[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-04 Thread Thomas Antony

New submission from Thomas Antony:

When inspect.isgeneratorfunction is called on the output of functools.partial, 
it returns False even if the original function was a generator function. Test 
case is attached. 

Tested in fresh conda environment running Python 3.6.1

--
files: testcode.py
messages: 291147
nosy: Thomas Antony
priority: normal
severity: normal
status: open
title: inspect.isgeneratorfunction not working with partial functions
versions: Python 3.5
Added file: http://bugs.python.org/file46776/testcode.py

___
Python tracker 

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



[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-04 Thread Thomas Antony

Changes by Thomas Antony :


--
versions: +Python 3.6

___
Python tracker 

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



[issue29988] (async) with blocks and try/finally are not as KeyboardInterrupt-safe as one might like

2017-04-04 Thread Nathaniel Smith

New submission from Nathaniel Smith:

You might hope the interpreter would enforce the invariant that for 'with' and 
'async with' blocks, either '__(a)enter__' and '__(a)exit__' are both called, 
or else neither of them is called. But it turns out that this is not true once 
KeyboardInterrupt gets involved – even if we write our (async) context manager 
in C, or otherwise guarantee that the actual '__(a)enter__' and '__(a)exit__' 
methods are immune to KeyboardInterrupt.

The invariant is *almost* preserved for 'with' blocks: there's one instruction 
(SETUP_WITH) that atomically (wrt signals) calls '__enter__' and then enters 
the implicit 'try' block, and there's one instruction (WITH_CLEANUP_START) that 
atomically enters the implicit 'finally' block and then calls '__exit__'. But 
there's a gap between exiting the 'try' block and WITH_CLEANUP_START where a 
signal can arrive and cause us to exit without running the 'finally' block at 
all. In this disassembly, the POP_BLOCK at offset 7 is the end of the 'try' 
block; if a KeyboardInterrupt is raised between POP_BLOCK and 
WITH_CLEANUP_START, then it will propagate out without '__exit__' being run:

In [2]: def f():
   ...: with a:
   ...: pass
   ...: 

In [3]: dis.dis(f)
  2   0 LOAD_GLOBAL  0 (a)
  3 SETUP_WITH   5 (to 11)
  6 POP_TOP

  3   7 POP_BLOCK
  8 LOAD_CONST   0 (None)
>>   11 WITH_CLEANUP_START
 12 WITH_CLEANUP_FINISH
 13 END_FINALLY
 14 LOAD_CONST   0 (None)
 17 RETURN_VALUE

For async context managers, the race condition is substantially worse, because 
the 'await' dance is inlined into the bytecode:

In [4]: async def f():
   ...: async with a:
   ...: pass
   ...: 

In [5]: dis.dis(f)
  2   0 LOAD_GLOBAL  0 (a)
  3 BEFORE_ASYNC_WITH
  4 GET_AWAITABLE
  5 LOAD_CONST   0 (None)
  8 YIELD_FROM
  9 SETUP_ASYNC_WITH 5 (to 17)
 12 POP_TOP

  3  13 POP_BLOCK
 14 LOAD_CONST   0 (None)
>>   17 WITH_CLEANUP_START
 18 GET_AWAITABLE
 19 LOAD_CONST   0 (None)
 22 YIELD_FROM
 23 WITH_CLEANUP_FINISH
 24 END_FINALLY
 25 LOAD_CONST   0 (None)
 28 RETURN_VALUE

Really the sequence from 3 BEFORE_ASYNC_WITH to 9 SETUP_ASYNC_WITH should be 
atomic wrt signal delivery, and from 13 POP_BLOCK to 22 YIELD_FROM likewise.

This probably isn't the highest priority bug in practice, but I feel like it'd 
be nice if this kind of basic language invariant could be 100% guaranteed, not 
just 99% guaranteed :-). And the 'async with' race condition is plausible to 
hit in practice, because if I have an '__aenter__' that's otherwise protected 
from KeyboardInterrupt, then it can run for some time, and any control-C during 
that time will get noticed just before the WITH_CLEANUP_START, so e.g. 'async 
with lock: ...' might complete while still holding the lock.

The traditional solution would be to define single "super-instructions" that do 
all of the work we want to be atomic. This would be pretty tricky here though, 
because WITH_CLEANUP_START is a jump target (so naively we'd need to jump into 
the "middle" of a hypothetical new super-instruction), and because the 
implementation of YIELD_FROM kind of assumes that it's a standalone instruction 
exposed directly in the bytecode. Probably there is some solution to these 
issues but some cleverness would be required.

A alternative approach would be to keep the current bytecode, but somehow mark 
certain stretches of bytecode as bad places to run signal handlers. The eval 
loop's "check for signal handlers" code is run rarely, so we could afford to do 
relatively expensive things like check a lookaside table that says "no signal 
handlers when 13 < f_lasti <= 22". Or we could steal a bit in the opcode 
encoding or something.

--
components: Interpreter Core
messages: 291148
nosy: ncoghlan, njs, yselivanov
priority: normal
severity: normal
status: open
title: (async) with blocks and try/finally are not as KeyboardInterrupt-safe as 
one might like
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



[issue29986] Documentation recommends raising TypeError from tp_richcompare

2017-04-04 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

Yeah, I agree there might be a use-case (can't find one offhand, but in 
principle), but I think it's rare enough that you're more likely to be led 
astray from reading this note -- almost always, NotImplemented does what you 
want.

In a way this is a special case of being able to raise an exception at all, 
which is mentioned earlier ("if another error occurred it must return NULL and 
set an exception condition.")

--

___
Python tracker 

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



[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-04 Thread Martin Panter

Martin Panter added the comment:

Doesn't seem like a bug to me.

Even if there was special support for "partial" objects, that won't help with 
other ways of producing the same sort of thing.

test2 = functools.partial(test, a=10)

@functools.wraps(test)
def test2():
return test(a=10)

Both ways produce a callable that returns a generator-iterator instance, but 
neither callables are really generator functions.

--
nosy: +martin.panter

___
Python tracker 

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



[issue29989] subprocess.Popen does not handle file-like objects without file descriptors

2017-04-04 Thread Raphael Gaschignard

New submission from Raphael Gaschignard:

>From the documentation of the io module:

fileno()
Return the underlying file descriptor (an integer) of the stream if it exists. 
An OSError is raised if the IO object does not use a file descriptor.

However, when passing a file-like object without a file descriptor (that raises 
OSError when calling f.fileno()) to POpen (for stdout, for example), the raised 
exception is not handled properly.

(However, on inspection of subprocess code, returning -1 will cause the code to 
handle this properly)

I'm not sure whether this is an issue in the io module documentation or in the 
subprocess code.


the core issue seems to be in POpen.get_handles, that seems to expect that -1 
is used to signal "no file descriptor available".

--
messages: 291151
nosy: rtpg
priority: normal
severity: normal
status: open
title: subprocess.Popen does not handle file-like objects without file 
descriptors
type: crash
versions: Python 3.6

___
Python tracker 

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



[issue13290] get vars for object with __slots__

2017-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think this API expansion should not be done.

As a teacher of Python, I find that vars(o) is easily understood as a short-cut 
for o.__dict__ in much the same way as len(o) is a short-cut for o.__len__().  
The proposed change makes this tool harder to teach.

The vars() function is often used for more than viewing a dictionary, it is 
also used in situations where the dictionary can be modified.  The proposed 
feature makes it harder to distinguish cases where it acts like a regular, 
updateable dict.

Further, I believe the addition of invisible magic to vars() will actively 
promote a misunderstanding of how Python works.  When applied to an instance 
variable, it creates an illusion that a dictionary is present when to whole 
point of __slots__ is to suppress an instance dictionary.  

In fact, the actual dictionary entries are the member objects at the class 
level.  This fact would be hidden by the proposed change.  In addition it 
creates confusion by treating __slots__ differently from other class-level 
descriptor entries such as property objects

Another issue is that right now, if a user misspells __slots__ (perhaps as 
__slots_ por __slot__), the indication that something went wrong is that 
running vars() on an instance returns a dictionary rather than raising 
"TypeError: vars() argument must have __dict__ attribute".   The proposed 
change will take away this active affirmation that __slots__ is working and 
will make debugging more difficult (and it will break any existing __slots__ 
tests that use assertRaises(TypeError) with vars() to verify that __slots__ is 
working).

Overall, my assessment is that this proposed API expansion impairs the 
learnabilty and usability of vars().

In the entire long history of vars(), this feature has never been requested.  
Even the OP said, I just realized that it isn't built-out for inclusion 
__slots__; rather than saying, I really think this would have helped me with a 
real debugging problem.  We have zero evidence that this proposed feature would 
be of any value and I have given reasons why it would make the language worse. 

Guido choose not to include this behavior when he added __slots__ back in 
Python 2.2 (when many introspection builtins were changed to accommodate 
new-style classes).  IMO, no reason has surfaced in the last 15 years to 
warrant reversing his decision.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue29990] Range checking in GB18030 decoder

2017-04-04 Thread Ma Lin

New submission from Ma Lin:

This issue is split from issue24117, that issue became a soup of small issues, 
so I'm going to close it.

For 4-byte GB18030 sequence, the legal range is:
0x81-0xFE for the 1st byte
0x30-0x39 for the 2nd byte
0x81-0xFE for the 3rd byte
0x30-0x39 for the 4th byte
GB18030 standard:
https://en.wikipedia.org/wiki/GB_18030
https://pan.baidu.com/share/link?shareid=2606985291&uk=3341026630

The current code forgets to check 0xFE for the 1st and 3rd byte.
Therefore, there are 8630 illegal 4-byte sequences can be decoded by GB18030 
codec, here is an example:

# legal sequence b'\x81\x31\x81\x30' is decoded to U+060A, it's fine.
uchar = b'\x81\x31\x81\x30'.decode('gb18030')
print(hex(ord(uchar)))

# illegal sequence 0x8130FF30 can be decoded to U+060A as well, this should not 
happen.
uchar = b'\x81\x30\xFF\x30'  .decode('gb18030')
print(hex(ord(uchar)))

--
components: Unicode
messages: 291153
nosy: Ma Lin, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Range checking in GB18030 decoder
type: behavior
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



[issue29990] Range checking in GB18030 decoder

2017-04-04 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1168

___
Python tracker 

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



[issue29990] Range checking in GB18030 decoder

2017-04-04 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue24117] Wrong range checking in GB18030 decoder.

2017-04-04 Thread Ma Lin

Changes by Ma Lin :


--
stage: patch review -> 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



[issue29981] Update Index for set, dict, and generator 'comprehensions'

2017-04-04 Thread Louie Lu

Changes by Louie Lu :


--
nosy: +louielu

___
Python tracker 

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



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

2017-04-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +davin

___
Python tracker 

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



[issue29981] Update Index for set, dict, and generator 'comprehensions'

2017-04-04 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +1170

___
Python tracker 

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



[issue29446] Improve tkinter 'import *' situation

2017-04-04 Thread Louie Lu

Changes by Louie Lu :


--
nosy: +louielu

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:


New changeset 43ba8861e0ad044efafa46a7cc04e12ac5df640e by Raymond Hettinger 
(Lisa Roach) in branch 'master':
bpo-29549: Fixes docstring for str.index (#256)
https://github.com/python/cpython/commit/43ba8861e0ad044efafa46a7cc04e12ac5df640e


--

___
Python tracker 

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



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

2017-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Antoine, do you care to make the call on this one?

--
assignee:  -> pitrou
nosy: +pitrou

___
Python tracker 

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



[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-04 Thread Thomas Antony

Thomas Antony added the comment:

Is there any way to distinguish such callables from "normal" functions without 
actually calling them?

--

___
Python tracker 

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



[issue20545] Use specific asserts in unicode tests

2017-04-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed
Added file: http://bugs.python.org/file46777/test_unicode_asserts_3.patch

___
Python tracker 

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



[issue20547] Use specific asserts in bigmem tests

2017-04-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed
Added file: http://bugs.python.org/file46778/test_bigmem_asserts_3.patch

___
Python tracker 

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



[issue16510] Using appropriate checks in tests

2017-04-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed
Added file: http://bugs.python.org/file46779/tests_asserts_7.patch

___
Python tracker 

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



[issue29988] (async) with blocks and try/finally are not as KeyboardInterrupt-safe as one might like

2017-04-04 Thread Nick Coghlan

Nick Coghlan added the comment:

My first thought would be to inject a wordcode instruction that's essentially 
an eval loop directive: "ATOMIC_UNTIL "

ATOMIC_UNTIL would have at least the following properties:

- checks for signals are skipped until the given offset is reached
- checks to release the GIL are skipped until the given offset is reached

It may also have the following defensive coding property:

- only wordcode instructions on a pre-approved whitelist are permitted during 
atomic execution blocks (i.e. we'd only add them to the whitelist on an as 
needed basis, to minimise the risk of undesirable side effects, like being able 
to use wordcode manipulation to put an entire loop inside an atomic block)

The last bit would likely have undesirable performance implications, so it 
would probably be reasonable to only enable the check for debug builds, rather 
than always enforcing it.

--

___
Python tracker 

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



[issue29959] re.match failed to match left square brackets as the first char

2017-04-04 Thread bo qu

bo qu added the comment:

hi Serhiy Storchaka
thank you for your explanation, it helps a lot

2017-04-01 15:44 GMT+08:00 Serhiy Storchaka :

>
> Serhiy Storchaka added the comment:
>
> re.match() checks if the beginning of the string matches the regular
> expression pattern. Use re.search() if you want to find the match not at
> the beginning of the string.
>
> https://docs.python.org/3/library/re.html#re.match
> https://docs.python.org/3/library/re.html#re.search
>
> --
> nosy: +serhiy.storchaka
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue29984] Improve test coverage for 'heapq' module

2017-04-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue29960] _random.Random state corrupted on exception

2017-04-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29960] _random.Random state corrupted on exception

2017-04-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue29990] Range checking in GB18030 decoder

2017-04-04 Thread Ma Lin

Changes by Ma Lin :


--
pull_requests: +1171

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks Lisa.

--
resolution:  -> fixed
stage: patch review -> 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



[issue28754] Argument Clinic for bisect.bisect_left

2017-04-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Now `Py_ssize_t(accept={int, NoneType})` can be used instead of a local 
converter.

--

___
Python tracker 

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



[issue29944] Argumentless super() fails in classes constructed with type()

2017-04-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue29762] Use "raise from None"

2017-04-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 5affd23e6f42125998724787025080a24839266e by Serhiy Storchaka in 
branch 'master':
bpo-29762: More use "raise from None". (#569)
https://github.com/python/cpython/commit/5affd23e6f42125998724787025080a24839266e


--

___
Python tracker 

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



[issue29762] Use "raise from None"

2017-04-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue28754] Argument Clinic for bisect.bisect_left

2017-04-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Wouldn't it be easily to let the OP apply AC to some other module.  Right now, 
it isn't a very good fit and was this a tough one to start with.

--

___
Python tracker 

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



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

2017-04-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This will obviously break some existing code which passes a function returning 
true to Timer.  I concur with Raymond: I don't think this is a good idea.  
Also, the Timer class itself is a rather simplistic answer to the problem of 
scheduling callbacks in the future (it uses a dedicated thread per callback, 
which is extremely wasteful).  You'll find better solutions in more modern 
toolkits, such as asyncio; or you can easily write your own logic yourself.

--
nosy: +tim.peters

___
Python tracker 

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