[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-19 Thread Steve Dower


Steve Dower  added the comment:

Reminder to myself (or permission for anyone else) to merge this. My phone 
won't let me actually click the github merge button, unfortunately, but this 
seems good to go.

--

___
Python tracker 

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



[issue34294] re.finditer and lookahead bug

2019-01-19 Thread Ma Lin


Ma Lin  added the comment:

Serhiy Storchaka lost his sight.
Please stop any work and rest, because your left eye will have more burden, and 
your mental burden will make it worse.
Go to hospital ASAP.

If any other core developer want to review this patch, I would like to give a 
detailed explanation, the logic is not very compilcated.

--

___
Python tracker 

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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

Umm looks like I should pass an argument on cmd to reproduce it. I will try to 
reproduce it later

--

___
Python tracker 

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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

No crash at Python 3.7.2+ (heads/3.7:47290e7642, Jan 20 2019, 12:22:44)
and master branch

--
nosy: +corona10

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch, patch, patch
pull_requests: +11378, 11379, 11380
stage:  -> patch review

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +11378
stage:  -> patch review

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch, patch
pull_requests: +11378, 11379
stage:  -> patch review

___
Python tracker 

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



[issue35775] Add a general selection function to statistics

2019-01-19 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Rémi. I've read over your patch and have some comments:

(1) You call sorted() to produce a list, but then instead of retrieving the 
item using ``data[i-1]`` you use ``itertools.islice``. That seems unnecessary 
to me. Do you have a reason for using ``islice``?

(2) select is not very useful on its own, we actually want it so we can 
calculate quantiles, e.g. percentiles, deciles, quartiles. If we want the 
k-quantile (e.g. k=100 for percentiles) then there are k+1 k-quantiles in 
total, including the minimum and maximum. E.g quartiles divide the data set 
into four equal sections, so there are five boundary values including the min 
and max.

So the caller is likely to be calling select repeatedly on the same data set, 
and hence making a copy of that data and sorting it repeatedly. If the data set 
is small, repeatedly making sorted copies is still cheap enough, but for large 
data sets, that will be expensive.

Do you have any thoughts on how to deal with that?

--

___
Python tracker 

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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-19 Thread Eric Fahlgren


Eric Fahlgren  added the comment:

After a bit more digging, it's a side effect of having the locale set with 
'Plural-Forms'.  I've attached the resulting .mo file, but since it's a binary, 
I'm not sure it will work cross-platform, so here's how to recreate it.

> cat en_US/LC_MESSAGES/foo.po
msgid ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

> python /Python37/Tools/i18n/msgfmt.py en_US/LC_MESSAGES/foo.po
> ll en_US/LC_MESSAGES/
-rwx--+ 1 efahlgren Domain Users 89 2019-01-19 14:36 foo.mo*
-rw-r--r--+ 1 efahlgren Domain Users 69 2019-01-19 14:34 foo.po

Then you can reproduce with some setup in your script:

import os
import gettext
import argparse

os.putenv('LANG', 'en_US')  # Just to make sure.
gettext.bindtextdomain('foo', '.')
gettext.textdomain('foo')

p = argparse.ArgumentParser()
p.add_argument('--foo', nargs=None)
p.parse_args()

--
Added file: https://bugs.python.org/file48068/foo.mo

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-01-19 Thread Anthony Sottile

Anthony Sottile  added the comment:

> You’d be surprised how tenacious old versions are. 

heh that's true, at my last job we finally got rid of python2.6 in 2016 :'(

anyway -- I don't mean to discourage this, definitely seems valuable to the 
maintenance of mypy!

--

___
Python tracker 

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



[issue24119] Carry comments with the AST

2019-01-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

See also issue35766.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-01-19 Thread Guido van Rossum

Guido van Rossum  added the comment:

You’d be surprised how tenacious old versions are. 

Anywa, I am working on this on my copious spare time — you can follow my 
progress at 
https://github.com/gvanrossum/cpython/tree/ast-type-comments?files=1 .

--

___
Python tracker 

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



[issue35786] get_lock() method is not present for Values created using multiprocessing.Manager()

2019-01-19 Thread Lorenzo Persichetti


New submission from Lorenzo Persichetti :

According to the documentation of the multiprocessing.Value() class available 
here 
https://docs.python.org/3.6/library/multiprocessing.html#multiprocessing.Value

Operations like += which involve a read and write are not atomic. So if, for 
instance, you want to atomically increment a shared value it is insufficient to 
just do

counter.value += 1
Assuming the associated lock is recursive (which it is by default) you can 
instead do

with counter.get_lock():
counter.value += 1

What happens is that when running the following snippet

import multiprocessing
manager = multiprocessing.Manager()
value = manager.Value('i', 0)
value.get_lock()

the result is 
AttributeError: 'ValueProxy' object has no attribute 'get_lock'

--
assignee: docs@python
components: Documentation, Library (Lib), Windows
messages: 334070
nosy: Lorenzo Persichetti, docs@python, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: get_lock() method is not present for Values created using 
multiprocessing.Manager()
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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-19 Thread Anthony Sottile


Anthony Sottile  added the comment:

Can you provide a reproducer? I'm having difficulty reproducing with this 
script:

import argparse

p = argparse.ArgumentParser()
p.add_argument('--foo', nargs=None)
args = p.parse_args()


$ python3.7 --version
Python 3.7.2
$ python3.7 t.py --foo
usage: t.py [-h] [--foo FOO]
t.py: error: argument --foo: expected one argument

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-01-19 Thread Anthony Sottile


Anthony Sottile  added the comment:

Seems also related to https://bugs.python.org/issue24119

with python2 / python3.5 (hopefully) rapidly falling off in usage I would 
assume the specialized treatment of `# type: ...` comments would become less 
and less necessary

Though I guess there's still `# type: ignore`, though if I recall correctly 
ignores are bubbled up to the module level and are applied on a line-by-line 
basis and wouldn't necessarily need specialized AST treatment (though a second 
parse over the token stream is a bit unfortunate)

--

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-01-19 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> It was discussed before, and there is a closed issue.

That is a non-answer.  The above patch is correct and achieves an essential 
goal of the lru_cache to save space when possible (avoid an unnecessary extra 
tuple per entry).   Also, please apply the other patch to eliminate the 
unnecessary double lookup in lru_cache_extricate_link().   Please also fix the 
naming problem, "extricate" -> "extract".

> It may be unintentionally. In any case, this is a case that should be very 
> rare.

Please just fix the bug.  That code path incorrectly refreshes an old-key that 
has not been called recently.  It fails to add the new key that was just 
called.  It leaves an orphan link causing an unnecessary downstream check for 
root!=next to guard for the broken invariants.  It leaves the full variable set 
when the cache is not longer full (missing link).

FWIW, one principal use case for lru_cache() is to support dynamic programming 
in recursive functions.  So a "call within a call" should not be regarded as 
"rare".

> Seems the comment was placed at wrong place.

Not just that.  The relevant code was omitted.  It is important to check to see 
if the new key has already been added by the user_function().  The knowledge of 
whether that key is present is stale after the user function call.  Please 
follow the pure python code in this regard.

--

___
Python tracker 

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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +bethard

___
Python tracker 

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



[issue35533] argparse standard error usage for exit / error

2019-01-19 Thread Vinay Badhan


Vinay Badhan  added the comment:

Add documentation for exit() function

--
keywords: +patch
nosy: +vinayb21
pull_requests: +11377
stage:  -> patch review

___
Python tracker 

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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-19 Thread Eric Fahlgren


New submission from Eric Fahlgren :

When argparse is configured with an option that takes arguments, then the 
script is invoked with the switch but no arguments, a nonsensical exception is 
raised during gettext processing.

In the 3.7.1 source, the error is at line 2077 of argparse.py, where 
'action.nargs' is not an integer as expected by 'ngettext', but one of None, 
'*' or '?':

default = ngettext('expected %s argument',
   'expected %s arguments',
   action.nargs) % action.nargs
msg = nargs_errors.get(action.nargs, default)

Fix should be pretty trivial, swap the two lines and if 'get' produces None, 
only then compute the default.

  File "C:\Program Files\Python37\lib\argparse.py", line 1749, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "C:\Program Files\Python37\lib\argparse.py", line 1781, in 
parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "C:\Program Files\Python37\lib\argparse.py", line 1987, in 
_parse_known_args
start_index = consume_optional(start_index)
  File "C:\Program Files\Python37\lib\argparse.py", line 1917, in 
consume_optional
arg_count = match_argument(action, selected_patterns)
  File "C:\Program Files\Python37\lib\argparse.py", line 2079, in 
_match_argument
action.nargs) % action.nargs
  File "C:\Program Files\Python37\lib\gettext.py", line 631, in ngettext
return dngettext(_current_domain, msgid1, msgid2, n)
  File "C:\Program Files\Python37\lib\gettext.py", line 610, in dngettext
return t.ngettext(msgid1, msgid2, n)
  File "C:\Program Files\Python37\lib\gettext.py", line 462, in ngettext
tmsg = self._catalog[(msgid1, self.plural(n))]
  File "", line 4, in func
  File "C:\Program Files\Python37\lib\gettext.py", line 168, in _as_int
(n.__class__.__name__,)) from None
TypeError: Plural value must be an integer, got NoneType

--
components: Library (Lib)
messages: 334065
nosy: eric.fahlgren
priority: normal
severity: normal
status: open
title: argparse crashes in gettext when processing missing arguments
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



[issue35785] argparse crashes in gettext when processing missing arguments

2019-01-19 Thread Eric Fahlgren


Change by Eric Fahlgren :


--
type:  -> crash

___
Python tracker 

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



[issue35771] IDLE: Fix tooltip Hovertiptest failure

2019-01-19 Thread Tal Einat


Tal Einat  added the comment:

This is due to the test using a 50ms delay on hover, and checking "immediately" 
after generating an "" event that it hasn't triggered yet.  Note that 
this isn't actually "immediately": The Tk root's update() is called in between 
to simulate having a live Tk event loop.

On slow machines this could indeed fail due to the update() call taking a while.

I originally chose 50ms since it seemed like more than enough. Using a longer 
delay would make the test more robust, but would make testing unnecessarily 
slow on fast machines.

Perhaps we should look for a more general solution, such as multiplying all 
test time values by a scale factor depending on a machine's execution speed?  
That would avoid such future errors in many tests, while keeping the tests 
faster on fast machines.

Otherwise let's just increase this to 100ms or 200ms.

--

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-19 Thread David Heiberg


Change by David Heiberg :


--
pull_requests: +11374
stage: needs patch -> patch review

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-19 Thread David Heiberg


Change by David Heiberg :


--
pull_requests: +11374, 11375
stage: needs patch -> patch review

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-19 Thread David Heiberg


Change by David Heiberg :


--
pull_requests: +11374, 11375, 11376
stage: needs patch -> patch review

___
Python tracker 

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



[issue35778] RF: ``pathlib.Path.checksum()`` member

2019-01-19 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Sorry, but it does not make sense to me (not would it make sense to add e.g. a 
JPEG decoder to pathlib).  Each project or application would want their own 
checksumming specification and pathlib does not have to cater to that.

--
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



[issue35766] Merge typed_ast back into CPython

2019-01-19 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-19 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> I previously close this issue is because not sure if someone rely on 
> exception string to do something, should we consider this?

I think this is a valid issue since error messages have been modified in the 
past. I am not sure if this will be backported to 3.7 though.

--
nosy: +xtreak

___
Python tracker 

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



[issue35507] multiprocessing: seg fault when creating RawArray from numpy ctypes

2019-01-19 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I am closing this with third party as resolution. Feel free to reopen this if 
it's an issue with multiprocessing and CPython.

Thanks for triaging.

--
nosy: +xtreak
resolution:  -> third party
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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-19 Thread Louie Lu


Louie Lu  added the comment:

I previously close this issue is because not sure if someone rely on exception 
string to do something, should we consider this?

--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Operations with the linked list are atomic (guarded with the GIL), while 
operations with the cache dict are not. That is why links are removed first 
from the linked list and added back in case of error.

--

___
Python tracker 

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



[issue35507] multiprocessing: seg fault when creating RawArray from numpy ctypes

2019-01-19 Thread Anthony Sottile


Anthony Sottile  added the comment:

yes, please do

--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> If so, then why is the link being moved to the front of the lru_cache -- it 
> should have remained at the oldest position.

It may be unintentionally. In any case, this is a case that should be very rare.

> The solution to this is only extract the link after a successful pop rather 
> than before.

Then there is a possibility to pop the same key (from the last link) twice. The 
GIL can be released in _PyDict_Pop_KnownHash() and other thread can went the 
same way.

--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> After the check for popresult==Py_None, there is the comment that was mostly 
> copied from the Python version but doesn't match the actual code:

Seems the comment was placed at wrong place. And it should be updated since 
locks are not used, but the GIL.

--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> would it be reasonable to emulate the pure python code and return a scalar 
> instead of a tuple when the tuple length is one and there are no keyword 
> arguments or typing requirements?

It was discussed before, and there is a closed issue. I am not sure about the 
optimization in the Python code. It may lead to bugs in corner cases too.

--

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Not PyErr_Print(). Maybe PyErr_WriteUnraisable().

--

___
Python tracker 

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



[issue35784] document that hashlib.new takes kwargs

2019-01-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +christian.heimes, gregory.p.smith
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue35784] document that hashlib.new takes kwargs

2019-01-19 Thread Jörn Heissler

New submission from Jörn Heissler :

This code works:
hashlib.new('blake2b', b'foo', digest_size=7)

https://github.com/python/cpython/blob/master/Lib/hashlib.py#L7
documents the function as: new(name, data=b'', **kwargs)

But the **kwargs argument is missing in 
https://docs.python.org/3/library/hashlib.html#hashlib.new and there aren't any 
examples either.

--
assignee: docs@python
components: Documentation
messages: 334053
nosy: docs@python, joernheissler
priority: normal
severity: normal
status: open
title: document that hashlib.new takes kwargs
type: enhancement

___
Python tracker 

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



[issue35779] Print friendly version message in REPL

2019-01-19 Thread Ma Lin


Ma Lin  added the comment:

It's interesting to see the a Python 1.5.2 from April 1999 :)

Thanks for your opinion, let me explain:

We only print simplified message in official binary release, any Linux/private 
builds still using the current message. We know enough information about 
official binary release.

Junior users are people such as students learning programming in middle school, 
I think git information will confuse them, maybe many of them will never know 
git knowledges.

In recent versions, there is a "tags/" prepend to git tag, make the line 
longer. Just concatenating the string provided by git/compiler is a bit ugly 
IMO.

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit 
(Intel)] on win32
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit 
(AMD64)] on win32

Another problem is indicating 32bit or 64bit build, IMHO this is an useful 
information.
64bit machine did not exist in 1999, but now there are many kinds platforms, 
desktop, IOT, Raspberry Pi. This seems another topic.

--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-  Demonstration of one of the bugs -

# The currsize is initially equal to maxsize of 10
# Then we cause an orphan link in a full cache 
# The currsize drops to 9 and never recovers the full size of 10

from functools import lru_cache

once = True

@lru_cache(maxsize=10)
def f(x):
global once
rv = f'.{x}.'
if x == 20 and once:
once = False
print('Calling again', f(x))
return rv

for x in range(15):
f(x)

print(f.cache_info())
print(f(20))
print(f.cache_info())
print(f(21))
print(f.cache_info())


-- Output 
CacheInfo(hits=0, misses=15, maxsize=10, currsize=10)
Calling again .20.
.20.
CacheInfo(hits=0, misses=17, maxsize=10, currsize=9)
.21.
CacheInfo(hits=0, misses=18, maxsize=10, currsize=9)

--

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-19 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch, patch
pull_requests: +11369, 11370, 11371
stage: needs patch -> patch review

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-19 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch, patch, patch
pull_requests: +11369, 11370, 11371, 11372
stage: needs patch -> patch review

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-19 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch
pull_requests: +11369, 11370
stage: needs patch -> patch review

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-19 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +11369
stage: needs patch -> patch review

___
Python tracker 

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



[issue35748] urlparse library detecting wrong hostname leads to open redirect vulnerability

2019-01-19 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

> The “urllib.parse” module generally follows RFC 3986, which does not 
> allow a literal backslash in the “userinfo” part:

And yet the parse() function seems to allow arbitrary unescaped 
characters. This is from 3.8.0a0:

py> from urllib.parse import urlparse
py> urlparse(r'http://spam\eggs!cheese@evil.com').netloc
'spam\\eggs!cheese@evil.com'
py> urlparse(r'http://spam\eggs!cheese@evil.com').hostname
'evil.com'

If that's a bug, it is a separate bug to this issue.

Backslash doesn't seem relevant to the security issue of userinfo being 
used to mislead:

py> urlparse('http://www.google@evil.com').netloc
'www.google@evil.com'
py> urlparse('http://www.google@evil.com').hostname
'evil.com'

If it is relevant, can somebody explain to me how?

--

___
Python tracker 

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



[issue35783] incorrect example of fetching messages in imaplib documentation

2019-01-19 Thread Макс Вернер

New submission from Макс Вернер :

An example of fetching messages from the mailbox given in "IMAP4 Example" 
section is incorrect:

typ, data = M.fetch(num, '(RFC822)')
print('Message %s\n%s\n' % (num, data[0][1]))

"fetch" may return server data that was not requested (see "7.4.2.  FETCH 
Response" section of RFC 3501). In that case "data[0][1]" won't return what 
user expects.
This is a bad example, that many people repeat and advise to other developers:
https://stackoverflow.com/questions/13210737/get-only-new-emails-imaplib-and-python
https://gist.github.com/robulouski/7441883
https://stackoverflow.com/questions/51098962/check-if-email-inbox-is-empty-imaplib-python3
https://stackoverflow.com/questions/21116498/imaplib-not-getting-all-emails-in-folder
https://stackoverflow.com/questions/2230037/how-to-fetch-an-email-body-using-imaplib-in-python

I guess, this peculiarity should be clarified in the documentation. I offer to 
mark this fetching method is not safe and requests careful fetch result parsing.

--
assignee: docs@python
components: Documentation, email
messages: 334048
nosy: barry, docs@python, r.david.murray, Макс Вернер
priority: normal
severity: normal
status: open
title: incorrect example of fetching messages in imaplib documentation
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Suggested code for the open question listed above:

--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -733,6 +733,15 @@ lru_cache_make_key(PyObject *args, PyObject *kwds, int 
typed)

 /* short path, key will match args anyway, which is a tuple */
 if (!typed && !kwds) {
+if (PyTuple_GET_SIZE(args) == 1) {
+key = PyTuple_GET_ITEM(args, 0);
+if (!PySequence_Check(key)) {
+/* For scalar keys, save space and
+   drop the enclosing args tuple  */
+Py_INCREF(key);
+return key;
+}
+}
 Py_INCREF(args);
 return args;
 }

--
versions:  -Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue35507] multiprocessing: seg fault when creating RawArray from numpy ctypes

2019-01-19 Thread Dong-hee Na


Dong-hee Na  added the comment:

Looks like the numpy PR was merged. We can close this issue?

--
nosy: +corona10

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-19 Thread Tzu-ping Chung


Change by Tzu-ping Chung :


--
nosy: +uranusjr

___
Python tracker 

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