[issue38981] better name for re.error Exception class.

2019-12-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not sure about the new name. "re" is an abbreviation, so if include it in 
the exception name it should be "RE". I am not sure what name is better: 
RECompileError, REParseError, RESyntaxError, REError, CompileError, ParseError, 
SyntaxError or Error.

json raises JSONDecodeError, ElementTree raises ParseError, other xml modules 
raise ExpatError, csv raises Error, configparser raises subclasses of Error.

Many modules (at least 18: aifc, binhex, concurrent.futures, configparser, 
copy, cvs, ftplib, locale, mailbox, shutil, sqlite, sunau, test.support, uu, 
wave, webbrowser, xdrlib, xmlrpc.client) have an exception named just Error for 
module-specific errors.

--

___
Python tracker 

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



[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers


Change by Chris Withers :


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



[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers


Chris Withers  added the comment:


New changeset 41973c99fdfdc78315e819661e279bdcc2f058b1 by Chris Withers (Miss 
Islington (bot)) in branch '3.7':
bpo-38669: patch.object now raises a helpful error (GH17511)
https://github.com/python/cpython/commit/41973c99fdfdc78315e819661e279bdcc2f058b1


--

___
Python tracker 

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



[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers


Chris Withers  added the comment:


New changeset 4594565b56e9c99d2d3fb7549041bbca5ecba8e2 by Chris Withers (Miss 
Islington (bot)) in branch '3.8':
bpo-38669: patch.object now raises a helpful error (GH17510)
https://github.com/python/cpython/commit/4594565b56e9c99d2d3fb7549041bbca5ecba8e2


--

___
Python tracker 

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



[issue38993] cProfile behaviour issue with decorator and math.factorial() lib.

2019-12-08 Thread AVicennA


AVicennA  added the comment:

In short, here are different behaviours in increasing steps of values, which 
are (based on my researching) giving incorrect results in relation to each 
other.

Given example:

import functools
import cProfile

def decor(func):
@functools.wraps(func)
def wraps(*args, **kwargs):
return func(*args, **kwargs)
return wraps

@decor
def count(g_val):
if g_val < 1:
print("End")
else:
count(g_val - 1)

cProfile.run('count(VALUE)')


Below I wrote results by given values...

1) VALUE = 50

End 

   
 106 function calls (6 primitive calls) in 0.000 seconds

   


   
   Ordered by: standard name

   


   
   ncalls  tottime  percall  cumtime  percall filename:lineno(function) 

   
10.0000.0000.0000.000 :1()  

   
 51/10.0000.0000.0000.000 main.py:10(count) 

   
 51/10.0000.0000.0000.000 main.py:5(wraps)  

   
10.0000.0000.0000.000 {built-in method exec}

   
10.0000.0000.0000.000 {built-in method print}   

   
10.0000.0000.0000.000 {method 'disable' of 
'_lsprof.Profiler' objects}


2) VALUE = 45   
End 

   
 96 function calls (6 primitive calls) in 0.062 seconds 

   


   
   Ordered by: standard name

   


   
   ncalls  tottime  percall  cumtime  percall filename:lineno(function) 

   
10.0000.0000.0620.062 :1()  

   
 46/10.0000.0000.0610.061 main.py:10(count) 

   
 46/10.0000.0000.0620.062 main.py:5(wraps)  

   
10.0000.0000.0620.062 {built-in method exec}

   
10.0610.0610.0610.061 {built-in method print}   

   
10.0000.0000.0000.000 {method 'disable' of 
'_lsprof.Profiler' objects}


3) VALUE = 26   
End 


[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-12-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I would prefer that.  I think treating '\n' and ' \n' differently is a bit of a 
bug.  And the fix pretty well matches code/codeop behavior.  I have so far not 
imagined how it could break code.But you could let Ned Deily decide, before 
the next rc, if you want.

I am neutral on 2.7.

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



[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-12-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

So 3.8.1 got backported by Miss Islington. Do we want this in earlier releases?

--

___
Python tracker 

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



[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-12-08 Thread miss-islington


miss-islington  added the comment:


New changeset 184a3812b81e2f7d4bc6453bf7ceabe8ac590202 by Miss Islington (bot) 
in branch '3.8':
bpo-38673: dont switch to ps2 if the line starts with comment or whitespace 
(GH-17421)
https://github.com/python/cpython/commit/184a3812b81e2f7d4bc6453bf7ceabe8ac590202


--

___
Python tracker 

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



[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16993
pull_request: https://github.com/python/cpython/pull/17516

___
Python tracker 

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



[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-12-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'd like to backport this to 3.8.1 at least. Are people interested in getting 
it backported to earlier versions?

--

___
Python tracker 

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



[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-12-08 Thread miss-islington

miss-islington  added the comment:


New changeset 109fc2792a490ee5cd8a423e17d415fbdedec5c8 by Miss Islington (bot) 
(Batuhan Taşkaya) in branch 'master':
bpo-38673: dont switch to ps2 if the line starts with comment or whitespace 
(GH-17421)
https://github.com/python/cpython/commit/109fc2792a490ee5cd8a423e17d415fbdedec5c8


--
nosy: +miss-islington

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2019-12-08 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
versions: +Python 3.9 -Python 2.7, Python 3.4, Python 3.5, 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



[issue30458] [security][CVE-2019-9740][CVE-2019-9947] HTTP Header Injection (follow-up of CVE-2016-5699)

2019-12-08 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

i believe new work will be done via the new issue.  marking this closed.  if 
there is something not covered by issue38576 that remains, please open a new 
issue for it.  new discussion on this long issue is easy to get lost in.

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



[issue38576] CVE-2019-18348: CRLF injection via the host part of the url passed to urlopen()

2019-12-08 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
priority: normal -> high

___
Python tracker 

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



[issue38698] While parsing email message id: UnboundLocalError

2019-12-08 Thread Abhilash Raj


Abhilash Raj  added the comment:

Closing this as fixed.

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



[issue38708] parse_message_id in email module is very buggy / crashy

2019-12-08 Thread Abhilash Raj


Abhilash Raj  added the comment:

Closing this as fixed.

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



[issue38708] parse_message_id in email module is very buggy / crashy

2019-12-08 Thread miss-islington


miss-islington  added the comment:


New changeset 2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3 by Miss Islington (bot) 
in branch '3.8':
bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504)
https://github.com/python/cpython/commit/2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3


--
nosy: +miss-islington

___
Python tracker 

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



[issue38698] While parsing email message id: UnboundLocalError

2019-12-08 Thread miss-islington


miss-islington  added the comment:


New changeset f66f4a09d0b6817fe6a86a567fd506aa223f1563 by Miss Islington (bot) 
in branch '3.8':
bpo-38698: Add a new InvalidMessageID token to email header parser. (GH-17503)
https://github.com/python/cpython/commit/f66f4a09d0b6817fe6a86a567fd506aa223f1563


--

___
Python tracker 

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



[issue38708] parse_message_id in email module is very buggy / crashy

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16992
pull_request: https://github.com/python/cpython/pull/17515

___
Python tracker 

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



[issue38708] parse_message_id in email module is very buggy / crashy

2019-12-08 Thread Abhilash Raj


Abhilash Raj  added the comment:


New changeset 3ae4ea1931361dd2743e464790e739d9285501bf by Abhilash Raj in 
branch 'master':
bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504)
https://github.com/python/cpython/commit/3ae4ea1931361dd2743e464790e739d9285501bf


--

___
Python tracker 

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



[issue38698] While parsing email message id: UnboundLocalError

2019-12-08 Thread Abhilash Raj


Abhilash Raj  added the comment:


New changeset 68157da8b42b26408af5d157d2dba4fcf29c6320 by Abhilash Raj in 
branch 'master':
bpo-38698: Add a new InvalidMessageID token to email header parser. (GH-17503)
https://github.com/python/cpython/commit/68157da8b42b26408af5d157d2dba4fcf29c6320


--

___
Python tracker 

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



[issue38698] While parsing email message id: UnboundLocalError

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16991
pull_request: https://github.com/python/cpython/pull/17514

___
Python tracker 

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



[issue16397] UserString doesn't combine nicely with strings

2019-12-08 Thread Phillip Schanely


Change by Phillip Schanely :


--
nosy: +pschanely

___
Python tracker 

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



[issue38998] dict.setdefault (setdefault of dictionary)

2019-12-08 Thread da-dada


da-dada  added the comment:

my use case is different (I do a loop), but what I expected from the docs (just 
for fun!)

class Ddefault:

def __init__(self):
vars(self).setdefault('default', self.set_default() if not 'default' in 
vars(self) else self.default)
vars(self).setdefault('default', self.set_default() if not 'default' in 
vars(self) else self.default)
print(vars(self))

def set_default(self):
print(vars(self))
return 'default'

if __name__ == "__main__":
Ddefault()

may be the coding diverted from the docs after the fixing of issue 13521 and no 
one dares correcting..
anyway, I will probably keep my old coding (performance, if there is any)

--

___
Python tracker 

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



[issue38993] cProfile behaviour issue with decorator and math.factorial() lib.

2019-12-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

@AVicennA Can you clarify exactly which part of the output you find surprising, 
and why, and what result you expected instead? It's a little hard to tell which 
details in your message we're supposed to be looking at.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue38594] importlib.metadata documentation deficiencies

2019-12-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Please have a look at 
https://gitlab.com/python-devs/importlib_metadata/merge_requests/104/diffs, 
which attempts to clarify the documentation to indicate how one would implement 
a custom finder. If you have a prototype implementation, I'd be happy to have a 
look.

The use-case you present is exactly the type of use-case this project wishes to 
enable, so I'm grateful that you're working on it and I'd like to do what I can 
to support the effort.

--

___
Python tracker 

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



[issue38987] 3.8.0 on GNU/Linux fails to find shared library

2019-12-08 Thread Christian Heimes


Christian Heimes  added the comment:

Did you update the ld.so cache with ldconfig?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue38901] Add a CLI flag to venv to use the pwd basename as the prompt

2019-12-08 Thread Brett Cannon


Brett Cannon  added the comment:

If it were `.` would we then always check if the prompt was a folder and then 
use the folder's name in that case? Or would it only apply to `.`?

As for `__curdir__`, it could work, but I don't know how easy would that be to 
remember or explain to new users compared to `.`?

My vote is to support `.` and make the rule that if you specify a folder it 
will use the basename automatically.

--

___
Python tracker 

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



[issue38594] importlib.metadata documentation deficiencies

2019-12-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Good suggestions. Thanks for taking the time to articulate in such a friendly 
way the shortcomings you encountered. I'm happy to help.

In [this ticket](https://gitlab.com/python-devs/importlib_metadata/issues/105), 
I've mirrored this ticket in the backport project, where I can iterate much 
faster.

I'll provide brief answers to some of your questions/concerns here and then 
work out the wording for the documentation (and code changes) necessary to 
communicate that effectively.

> The reference to `load_metadata()` is the only occurrence of the string 
> `load_metadata` in the CPython and importlib_metadata code bases. I therefore 
> believe the documentation in both CPython and the importlib_metadata 
> standalone package are wrong because they are referring to a method that is 
> never implemented nor called.

That's right. The documentation is wrong. It should say to implement a 
`Distribution` subclass (especially its abstract methods). Nothing more should 
be necessary.

> I see that certain APIs return Path-like objects (which I will need to 
> implement)

Are you sure about that? The only code I see in the `Distribution` class that 
references a `Path` object is `.at()`, a static method that we decided to add 
to the `Distribution` class even though it would be more appropriate in the 
`PathDistribution` class in order to make that method readily available to 
projects that wished to construct the Path-based distribution objects from a 
file system (or zipfile) path. I'm pretty sure everything else in the 
Distribution class relies on the two abstract methods. If you disregard `at` 
(and I recommend you do) and focus on implementing the abstract methods, I 
think things will work. Let me know if you find otherwise.

> why the Context is optional and how Context could be used?

The interface is intentionally vague in order not to be too prescriptive, 
because as you point out, name or path may not be relevant in some contexts. 
It's meant to narrow the scope of any search.

So if a path is present, that means the query is looking in a specific 
'sys.path' entry. And if the name is present, that means it's looking for a 
distribution having a specific name. But basically, you can solicit any 
properties you like. You could expect a `size='max(100)'` parameter and only 
return distributions smaller than 100 (for whatever interpretation of `size` 
you wish to implement. Your DistributionFinder should do its best to honor 
whatever context might be relevant to the Distributions you provide.

Does PyOxidizer interact with `sys.path` at all? If not, it can disregard 
`Context.path`.

--

___
Python tracker 

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



[issue38998] dict.setdefault (setdefault of dictionary)

2019-12-08 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

The documentation is correct, in Python argument are computed before the
call to a function, not when they are used. You can try other functions
than dict.setdefault() and see that the behaviour is always the same.

Le dim. 8 déc. 2019 à 22:47, da-dada  a écrit :

>
> da-dada  added the comment:
>
> I have no problem of making my programme run properly (asking first if in
> dict etc), but I just read the docu of dict.setdefault
>
> setdefault(key[, default])
> If key is in the dictionary, return its value. If not, insert key with a
> value of default and return default. default defaults to None.
>
> and it clearly reads if the key is.. return its value, with a full stop;
> so either the docu is wrong (but proposes exactly the needed shortcut) or
> python is as it is: come in & find out
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue38998] dict.setdefault (setdefault of dictionary)

2019-12-08 Thread da-dada


da-dada  added the comment:

I have no problem of making my programme run properly (asking first if in dict 
etc), but I just read the docu of dict.setdefault

setdefault(key[, default]) 
If key is in the dictionary, return its value. If not, insert key with a value 
of default and return default. default defaults to None.

and it clearly reads if the key is.. return its value, with a full stop;
so either the docu is wrong (but proposes exactly the needed shortcut) or 
python is as it is: come in & find out

--

___
Python tracker 

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



[issue38993] cProfile behaviour issue with decorator and math.factorial() lib.

2019-12-08 Thread AVicennA


AVicennA  added the comment:

Hello, I use decorators in my Python project. I tested project with 
cProfile(profiling). Then,
I decide did test with some decorator code fragments. Some results were 
surprising:

import functools
import cProfile

def decor(func):
@functools.wraps(func)
def wraps(*args, **kwargs):
return func(*args, **kwargs)
return wraps

@decor
def count(g_val):
if g_val < 1:
print("End")
else:
count(g_val - 1)
 
cProfile.run('count(102)')

OS names: Windows, Linux  -  x64
Python versions: 3.6.8, 3.4.3  -  x64

# cProfile using into the .py file
python dec_profile.py

End
 210 function calls (6 primitive calls) in 0.000 seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10.0000.0000.0000.000 :1()
103/10.0000.0000.0000.000 timeer.py:10(count)
103/10.0000.0000.0000.000 timeer.py:5(wraps)
10.0000.0000.0000.000 {built-in method builtins.exec}
10.0000.0000.0000.000 {built-in method builtins.print}
10.0000.0000.0000.000 {method 'disable' of 
'_lsprof.Profiler' objects}

# Instead of 102 used ---> 82, 22, 33, 72 and etc. also gave me strange results 
like in 102. 
This behaviour can be changing sometimes, but usually give an incorrect results.

import functools
import cProfile

def decor(func):
@functools.wraps(func)
def wraps(*args, **kwargs):
return func(*args, **kwargs)
return wraps

@decor
def count(g_val):
if g_val < 1:
print("End")
else:
count(g_val - 1)
 
count(102)

# cProfile using via command line
python -m cProfile dec_profile.py

End
 539 function calls (334 primitive calls) in 0.002 seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10.0000.0000.0000.000 :103(release)
10.0000.0000.0000.000 :143(__init__)
10.0000.0000.0000.000 :147(__enter__)
10.0000.0000.0000.000 :151(__exit__)
10.0000.0000.0000.000 :157(_get_module_lock)
10.0000.0000.0000.000 :176(cb)
10.0000.0000.0000.000 :211(_call_with_frames_removed)
   260.0000.0000.0000.000 :222(_verbose_message)
10.0000.0000.0000.000 :307(__init__)
10.0000.0000.0000.000 :311(__enter__)
10.0000.0000.0000.000 :318(__exit__)
40.0000.0000.0000.000 :321()
10.0000.0000.0000.000 :35(_new_module)
10.0000.0000.0000.000 :369(__init__)
20.0000.0000.0000.000 :403(cached)
10.0000.0000.0000.000 :416(parent)
10.0000.0000.0000.000 :424(has_location)
10.0000.0000.0000.000 :504(_init_module_attrs)
10.0000.0000.0000.000 :564(module_from_spec)
10.0000.0000.0000.000 :58(__init__)
10.0000.0000.0000.000 :651(_load_unlocked)
10.0000.0000.0000.000 :707(find_spec)
10.0000.0000.0000.000 :78(acquire)
10.0000.0000.0000.000 :780(find_spec)
30.0000.0000.0000.000 :843(__enter__)
30.0000.0000.0000.000 :847(__exit__)
10.0000.0000.0010.001 :870(_find_spec)
10.0000.0000.0010.001 :936(_find_and_load_unlocked)
10.0000.0000.0010.001 :966(_find_and_load)
60.0000.0000.0000.000 :1080(_path_importer_cache)
10.0000.0000.0010.001 :1117(_get_spec)
10.0000.0000.0010.001 :1149(find_spec)
10.0000.0000.0000.000 :1228(_get_spec)
50.0000.0000.0010.000 :1233(find_spec)
20.0000.0000.0000.000 :263(cache_from_source)
10.0000.0000.0000.000 :361(_get_cached)
50.0000.0000.0000.000 :37(_relax_case)
10.0000.0000.0000.000 :393(_check_name_wrapper)
10.0000.0000.0000.000 :430(_validate_bytecode_header)
10.0000.0000.0000.000 :485(_compile_bytecode)
20.0000.0000.0000.000 :52(_r_long)
10.0000.0000.0000.000 :524(spec_from_file_location)
   250.0000.0000.0000.000 :57(_path_join)
   250.0000.0000.0000.000 :59()
20.0000.0000.0000.000 :63(_path_split)
10.0000.0000.0000.000 :669(create_module)
10.0000.0000.0000.000 :672(exec_module)
10.0000.000

[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks for the fix, Victor!

--

___
Python tracker 

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



[issue39001] possible problem with 64-bit mingw DECREF

2019-12-08 Thread Dave Lawrence


New submission from Dave Lawrence :

I am calling a python method from C using the attached code.

The Site.py file is:

import os

def find_site():
path = os.path.abspath(".")
return path

Cross compiled to Windows from Linux using mxe.cc and python 2.7.17
On 32-bit this runs as expected:

module = 028BC710
result = 0283D6B0
Found Site at \\wsl$\Ubuntu\home\dl
result = 0283D6B0 decref
module = 028BC710 decref

Site = \\wsl$\Ubuntu\home\dl
but crashes on 64-bit, failing to DECREF result:

module = 02750408
result = 00E62EF0
Found Site at \\wsl$\Ubuntu\home\dl
result = 00E62EF0 decref

In both cases the libpython was made using the .dll copied from the target 
Windows machine and pexports and dlltool to create the .a

 if the return value of the python is return "C:/Test/Path" it works. if you 
add test2 = test and return test2 it fails. if you say test2 = "".join(c for c 
in path) and return test2 it fails. if you set path2 = "C:/Test/Path and return 
test2 it works

using Py_REFCNT [in the C code] shows a value of 2 for a return "c:/test" but a 
value of 1 a return test

--
components: Library (Lib), Windows
files: py.cc
messages: 358033
nosy: Dave Lawrence, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: possible problem with 64-bit mingw DECREF
type: crash
versions: Python 2.7
Added file: https://bugs.python.org/file48767/py.cc

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread STINNER Victor


Change by STINNER Victor :


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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

I validated that my commit 080ee5a88406fb68aaab741145cd5d2a7c5f2ad6 fixed the 
leaks, so I closed PR 17509 and I close this issue. Thanks for the bug report 
Pablo! I was also awaiting Refleak buildbot results!

$ ./python -m test -R 3:3 -j0  test__xxsubinterpreters test_atexit test_capi 
test_threading
(...)
All 4 tests OK.

Total duration: 1 min 4 sec
Tests result: SUCCESS

--

___
Python tracker 

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



[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

@xdegaye Please could you test whether the PR GH-17513 fixes the issue for you?

--

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread STINNER Victor


STINNER Victor  added the comment:

This reference leak is not new :-) It exists since at least Python 2.7. Extract 
of Python 2.7, Python/pythonrun.c:

sysmod = _PySys_Init();
if (sysmod == NULL)
Py_FatalError("Py_Initialize: can't initialize sys");
interp->sysdict = PyModule_GetDict(sysmod);

There is a missing Py_DECREF(sysmod). It was the same bug here, except that the 
code was deeply refactored in the meanwhile. I fixed the reference leak in 
commit 080ee5a88406fb68aaab741145cd5d2a7c5f2ad6.

Next question: why did the buildbot turn red? Well, at Python exit, there are 
like 18k references which are never decremented at Python exit:

$ ./python -X showrefcount -c pass
[18562 refs, 6494 blocks]

Previously, the subinterpreter sys module somehow shared references with the 
main interpreter. With my latest changes, the subinterpreter better isolates 
its own sys module from the main interpreter, and so the very old bug suddenyl 
is "releaved".

Getting subinterpreter "right" requires to fix all these very old bugs, one by 
one...

--

___
Python tracker 

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



[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-08 Thread Mark Dickinson


Change by Mark Dickinson :


--
keywords: +patch
pull_requests: +16990
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17513

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 080ee5a88406fb68aaab741145cd5d2a7c5f2ad6 by Victor Stinner in 
branch 'master':
bpo-38858: Fix ref leak in pycore_interp_init() (GH-17512)
https://github.com/python/cpython/commit/080ee5a88406fb68aaab741145cd5d2a7c5f2ad6


--

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 080ee5a88406fb68aaab741145cd5d2a7c5f2ad6 by Victor Stinner in 
branch 'master':
bpo-38858: Fix ref leak in pycore_interp_init() (GH-17512)
https://github.com/python/cpython/commit/080ee5a88406fb68aaab741145cd5d2a7c5f2ad6


--

___
Python tracker 

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



[issue39000] Range causing unstable output(Windows64)

2019-12-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

This has nothing to do with range. The source of indeterminacy is this line in 
your code:

for amp_id in amp_programs.keys():

In Python 3.5, the ordering of `amp_programs.keys()` could differ from run to 
run. (With Python 3.6 and later, that won't happen.)

If you want a deterministic result in Python 3.5, you could for example replace 
that line with:

for amp_id in sorted(amp_programs):

Closing here; this isn't a Python bug.

--
nosy: +mark.dickinson
resolution:  -> not a bug
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



[issue38994] Implement __class_getitem__ for PathLike

2019-12-08 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue38994] Implement __class_getitem__ for PathLike

2019-12-08 Thread miss-islington

miss-islington  added the comment:


New changeset 526606baf76e7a5309bb00f3bfaefa861a2014ba by Miss Islington (bot) 
(Batuhan Taşkaya) in branch 'master':
bpo-38994: Implement __class_getitem__ for PathLike (GH-17498)
https://github.com/python/cpython/commit/526606baf76e7a5309bb00f3bfaefa861a2014ba


--
nosy: +miss-islington

___
Python tracker 

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



[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

Note that the exact values of `1.7**i` don't matter here - some sloppiness in 
the `pow` results should not cause a test failure. The key point is that under 
fairly mild assumptions about IEEE 754 conformance, the subtractions 
`1.7**(i+1) - 1.7**i` are always performed exactly, thanks to Sterbenz's lemma.

--

___
Python tracker 

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



[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-08 Thread Mark Dickinson


Mark Dickinson  added the comment:

So if I'm understanding correctly, the cause of the issue is that the value 
`1.7**(i+1)` computed in the last iteration (i=999) of the list comprehension 
doesn't exactly match the `-1.7**1000` value, because the former is computed at 
runtime using the libm's pow, while the latter is constant-folded and likely 
uses something more accurate than `pow`.

I think it should be easy to rewrite the test so that it precomputes the powers 
of `1.7`, and then makes sure to use those computed values (i.e., so that we're 
only computing `1.7**1000` once rather than twice, eliminating the possibility 
of getting different results).

--

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16988
pull_request: https://github.com/python/cpython/pull/17512

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16989
pull_request: https://github.com/python/cpython/pull/17512

___
Python tracker 

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



[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16987
pull_request: https://github.com/python/cpython/pull/17511

___
Python tracker 

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



[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16986
pull_request: https://github.com/python/cpython/pull/17510

___
Python tracker 

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



[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers


Chris Withers  added the comment:


New changeset cd90a52983db34896a6335a572d55bdda274778f by Chris Withers (Elena 
Oat) in branch 'master':
bpo-38669: patch.object now raises a helpful error (GH17034)
https://github.com/python/cpython/commit/cd90a52983db34896a6335a572d55bdda274778f


--

___
Python tracker 

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



[issue39000] Range causing unstable output(Windows64)

2019-12-08 Thread Sean Moss


New submission from Sean Moss :

I was doing this year's Advent of Code and found that the following program 
produces unstable output when run using the given file as input:
"""
from itertools import permutations
import gc

def runProgram(amp_input, program, counter):
while program[counter] != 99:
# print('*' * 99)
instruction = str(program[counter])
opcode = instruction[-2:]
value1 = program[counter + 1]
# print('2:{}'.format(counter))
try:
if opcode in ['01', '02', '1', '2', '5', '05', '6', '06', '7', 
'07', '8', '08']:
value1 = program[counter + 1]
value2 = program[counter + 2]
param_modes = instruction[::-1][2:]
# print('{} {} {} {}'.format(instruction, value1, value2, 
value3))
param_modes += '0' * (3 - len(param_modes))
# print(param_modes)
if param_modes[0] == '0':
value1 = program[value1]
if param_modes[1] == '0':
value2 = program[value2]
# print('{} {} {} {}'.format(instruction, value1, value2, 
value3))
if opcode in ['01', '02', '1', '2', '7', '07', '8', '08']:
value3 = program[counter + 3]
if opcode.endswith('1'):
program[value3] = value1 + value2
elif opcode.endswith('2'):
program[value3] = value1 * value2
elif opcode in ['7', '07']:
program[value3] = 1 if value1 < value2 else 0
elif opcode in ['8', '08']:
program[value3] = 1 if value1 == value2 else 0
counter += 4
elif opcode in ['5', '05']:
if value1 != 0:
counter = value2
else:
counter += 3
elif opcode in ['6', '06']:
if value1 == 0:
counter = value2
else:
counter += 3
elif opcode in ['03', '3']:
program[value1] = amp_input.pop(0)
counter += 2
elif opcode in ['4', '04']:
# print('{} {}'.format(instruction, value1))
if instruction != '104':
value1 = program[value1]
# print('Output value: {}'.format(value1))
counter += 2
return value1, counter
else:
print("Something broke at {}".format(counter))
print("program state {}".format(program))
print(instruction)
return False
except Exception as e:
print("Out of bounds at {}".format(counter))
print("program state {}".format(program))
print(instruction)
print(e)
print(len(program))
return
return program, True

outputs = []
max_output = 0
# initial_program = list(map(int, open('input7.txt').read().split(',')))
amp_ids = ['A', 'B', 'C', 'D', 'E']
permutation = [5, 6, 7, 8, 9]
# for permutation in permutations([5, 6, 7, 8, 9]):
amp_programs = {amp_id: [list(map(int, 
open('input7.txt').read().split(',')))[:], 0] for amp_id in ['A', 'B', 'C', 
'D', 'E']}
loops = 0
prev_output = 0
for x in range(0, 5):
gc.collect()
new_output, outer_counter = runProgram([permutation[x], prev_output], 
amp_programs[amp_ids[x]][0], amp_programs[amp_ids[x]][1])
if outer_counter is not True:
prev_output = new_output
amp_programs[amp_ids[x]][1] = outer_counter
# print(new_output)
while amp_programs['E'][1] is not True:
gc.collect()
for amp_id in amp_programs.keys():
amp = amp_programs[amp_id]
# print(prev_output)
# print('1:{}'.format(amp[1]))
new_output, outer_counter = runProgram([prev_output], amp[0], amp[1])
if outer_counter is not True:
prev_output = new_output
amp[1] = outer_counter
# print('{}, {}'.format(amp[1], outer_counter))
# outputs.append(prev_output)
# print(prev_output)
outputs.append(prev_output)
# if prev_output > max_output:
# max_output = prev_output

print(max(outputs))
# print(outputs)
"""
However when this program is run on the same input it produces stable input:
"""
from itertools import permutations

def runProgram(amp_input, program, counter):
while program[counter] != 99:
# print('*' * 99)
instruction = str(program[counter])
opcode = instruction[-2:]
value1 = program[counter + 1]
# print('2:{}'.format(counter))
try:
if opcode in ['01', '02', '1', '2', '5', '05', '6', '06', '7', 
'07', '8', '08']:
value1 = program[counter + 1]
value2 = program[counter + 2]
param_modes = 

[issue38998] dict.setdefault (setdefault of dictionary)

2019-12-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Right. If you want the value only calculated once, then just call it once.

You might be interested in collections.defaultdict, which takes a factory 
function, and only calls it as needed.

--
nosy: +eric.smith
resolution:  -> not a bug
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



[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue38999] Python launcher on Windows does not detect active venv

2019-12-08 Thread Alexandros Karypidis


Alexandros Karypidis  added the comment:

As confirmed by debug information when setting PYLAUNCH_DEBUG=1, the shebang 
seems to be ignored when using '#!//usr/bin/env python3' but works fine when 
using '#!//usr/bin/env python'.

This is with '#!//usr/bin/env python' (proper):

(.venv) PS C:\pytest> .\script.py
launcher build: 32bit
launcher executable: Console
File 'C:\Users\karypid\AppData\Local\py.ini' non-existent
File 'C:\WINDOWS\py.ini' non-existent
Called with command line: "C:\pytest\script.py"
maybe_handle_shebang: read 167 bytes
maybe_handle_shebang: BOM not found, using UTF-8
parse_shebang: found command: python
searching PATH for python executable
Python on path: C:\pytest\.venv\Scripts\python.exe
...


This is with '#!//usr/bin/env python3' (wrong):

(.venv) PS C:\pytest> .\script.py
launcher build: 32bit
launcher executable: Console
File 'C:\Users\karypid\AppData\Local\py.ini' non-existent
File 'C:\WINDOWS\py.ini' non-existent
Called with command line: "C:\pytest\script.py"
maybe_handle_shebang: read 168 bytes
maybe_handle_shebang: BOM not found, using UTF-8
parse_shebang: found command: python3
locating Pythons in 64bit registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
...


As you can see in the second case even though it regognises the python3 
command, it makes no attempt to find it in the path.

Note that it appears that Windows installations only carry 'python.exe' and do 
not have a 'python3.exe' (neither in the native installation folder, nor in the 
virtual environment folder) so searching on the path would only 'work' if the 
user has copied python.exe to python3.exe in their \Scripts folder. (I 
actually tried that and it did not work).

A proper solution would probably need to search for 'python.exe' even for the 
'#!//usr/bin/env python3' shebang to detect if a virtual environment is 
present, possibly even confirming that the virtual environment is of the 
appropriate version.

--

___
Python tracker 

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



[issue38998] dict.setdefault (setdefault of dictionary)

2019-12-08 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

>
>
> def __init__(self):
> vars(self).setdefault('default', self.set_default())
> vars(self).setdefault('default', self.set_default())
>

This code is equivalent to

def __init__(self):
x = self.set_default()
vars(self).setdefault('default', x)

x = self.set_default()
vars(self).setdefault('default', x)

>
because the argument is evaluated before the call to setdefault() so you
can't optimise anything here.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue38998] dict.setdefault (setdefault of dictionary)

2019-12-08 Thread da-dada


New submission from da-dada :

from the docu I expected at the second call just a return of value and not a 
second calculation: there is room for improvement, as Elon Musk would say..

class Ddefault:

def __init__(self):
vars(self).setdefault('default', self.set_default())
vars(self).setdefault('default', self.set_default())

def set_default(self):
print(vars(self))
return 'default'

if __name__ == "__main__":
Ddefault()

--
messages: 358016
nosy: da-dada
priority: normal
severity: normal
status: open
title: dict.setdefault (setdefault of dictionary)
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue38999] Python launcher on Windows does not detect active venv

2019-12-08 Thread Alexandros Karypidis


Alexandros Karypidis  added the comment:

Forgot the simple script:

#!/usr/bin/env python3

import os, sys, platform

print('EXECUTABLE: ' + sys.executable)
print('PREFIX: ' + sys.prefix)
print('BASE PREFIX: ' + sys.base_prefix)

--

___
Python tracker 

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



[issue38999] Python launcher on Windows does not detect active venv

2019-12-08 Thread Alexandros Karypidis


New submission from Alexandros Karypidis :

When you activate a venv on Windows and use a shebang with a major verion 
qualifier, the python launcer does not properly detect that a venv is active 
and uses the system installation instead.

The incorrect behavior is documented in this SO question where another user has 
confirmed and suggested it is a bug: 
https://stackoverflow.com/questions/59238326

Steps to reproduce (needs script.py attached below):

1. Install Python 3.7 on Windows 10 (64 bit)
2. Run script.py you should see:
PS C:\pytest> .\script.py
EXECUTABLE: C:\Program Files\Python37\python.exe
PREFIX: C:\Program Files\Python37
BASE PREFIX: C:\Program Files\Python37

3. Create and activate a virtual environment with:
PS C:\pytest> python -m venv .venv
PS C:\pytest> . .\.venv\Scripts\Activate.ps1

4. Run script.py you should see it ignore the active virtual environment:
(.venv) PS C:\pytest> .\script.py
EXECUTABLE: C:\Program Files\Python37\python.exe
PREFIX: C:\Program Files\Python37
BASE PREFIX: C:\Program Files\Python37

I am using Windows 10 64-bit, update 1903 and Python 3.7.5-64

--
components: Windows
messages: 358017
nosy: Alexandros Karypidis, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python launcher on Windows does not detect active venv
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



[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Agreed on closing this issue.

--

___
Python tracker 

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



[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Here's the status of the various ways to do it:

1) In 3.7, collections.namedtuple() added the *defaults* parameter and the 
*_field_defaults* attribute.

2) In 3.6.1, typing.NamedTuple added support for default values.

3) In older versions of Python, it was always possible to directly attach 
default values:

>>> from collections import namedtuple
>>> Point = namedtuple('Point', ('x', 'y'))
>>> Point.__new__.__defaults__ = (10, )
>>> Point(5)
Point(x=5, y=10)

Given that we can't introduce new features to old versions of Python, it looks 
like this can be closed as "out-of-date".

--

___
Python tracker 

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



[issue33880] namedtuple should use NFKD to find duplicate members

2019-12-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Marking as closed for the reasons listed above.

Other thoughts:
* In the class form with types.NamedTuple, no error is raised.
* In the function form with collections.namedtuple, the various
  TypeErrors and ValueErrors are just courtesy checks
  intended to provide slightly nicer error messages when possible.
  It wasn't the goal to upstage all possible syntax errors.

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



[issue35805] email package folds msg-id identifiers using RFC2047 encoded words where it must not

2019-12-08 Thread Abhilash Raj


Abhilash Raj  added the comment:

Closing this since it has been fixed in Python 3.8.

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
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



[issue38242] Revert the new asyncio Streams API

2019-12-08 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2019-12-08 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Not sure if failed uvloop tests are correct.
The scenario is like the following:
1. Suppose we have an unblocking socket connected to peer.
2. Create a task for reading data: 
  task = asyncio.create_task(loop.sock_read(sock, 1))
 Note, the task is not started yet.
3. Just after it, cancel the task without waiting for the actual cancellation
  task.cancel()
4. Finally, read from the socket again:
  data = await loop.sock_read(sock, 1)

If I put context switch (await asyncio.sleep(0)) between 3) and 4) *or* replace 
direct sock_read() call in 4) with creation a task (data = await 
asyncio.create_task(loop.sock_read(sock, 1))) the cancellation of former read 
is performed and test passes.

I very doubt if any sane code is organizing like this test: start delayed 
reading, cancel it and read again.

The worse, neither previous not current sock_read() implementation doesn't 
prevent the concurrent reading which basically delivers data in an 
unpredictable order. Honestly, I'm not sure if we need to provide the 
concurrency guarantee for such low-level functions.  The code built on top of 
these low-level primitives should handle the cuncurrent access problem IMHO.

--

___
Python tracker 

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



[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



[issue38993] cProfile behaviour issue with decorator and math.factorial() lib.

2019-12-08 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Please, could you write a description to this issue here instead of the 
attached file?

--
nosy: +pablogsal

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I will try to work on an alternative fix meanwhile, but I need to search for 
what exactly is leaking first.

--

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Similar to https://bugs.python.org/issue38962, test__xxsubinterpreters 
test_atexit test_capi test_threading are leaking references. Example:

https://buildbot.python.org/all/#/builders/158/builds/10
https://buildbot.python.org/all/#/builders/16/builds/11
https://buildbot.python.org/all/#/builders/157/builds/11

test__xxsubinterpreters test_atexit test_capi test_threading
== Tests result: FAILURE then FAILURE ==
386 tests OK.
10 slowest tests:
- test_multiprocessing_spawn: 26 min 23 sec
- test_mailbox: 23 min 17 sec
- test_asyncio: 20 min 25 sec
- test_venv: 14 min 54 sec
- test_concurrent_futures: 13 min 35 sec
- test_zipfile: 11 min 10 sec
- test_regrtest: 9 min 34 sec
- test_distutils: 9 min 19 sec
- test_compileall: 9 min 9 sec
- test_lib2to3: 5 min 52 sec
4 tests failed:
test__xxsubinterpreters test_atexit test_capi test_threading

--
assignee: pablogsal
components: Tests
messages: 358006
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test__xxsubinterpreters test_atexit test_capi test_threading are leaking 
references
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +16985
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17509

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Per or policy, I will initiate the revert of the commit (and any dependent 
commit) and will merge if an alternative fix is not done in 1-2 days.

--

___
Python tracker 

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



[issue38997] test__xxsubinterpreters test_atexit test_capi test_threading are leaking references

2019-12-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Bisecting points to:

commit 81fe5bd3d78f9bb955f8255404d99df27a31c36a
Author: Victor Stinner 
Date:   Fri Dec 6 02:43:30 2019 +0100

bpo-38858: new_interpreter() reuses _PySys_Create() (GH-17481)

new_interpreter() now calls _PySys_Create() to create a new sys
module isolated from the main interpreter. It now calls
_PySys_InitCore() and _PyImport_FixupBuiltin().

init_interp_main() now calls _PySys_InitMain().

--

___
Python tracker 

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



[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Is it different from the defaults parameter added in 3.7 with 
https://github.com/python/cpython/commit/3948207c610e931831828d33aaef258185df31db
 . The linked pypi package seems to do the same thing.

--
nosy: +xtreak

___
Python tracker 

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



[issue38021] Modify AIX platform_tag so it provides PEP425 needs

2019-12-08 Thread Michael Felt


Michael Felt  added the comment:

Well, I certainly had not considered people would be using
distutils.get_platform().startswith('aix') as I have, in my limited
reading, only seen sys.platform.startswith("aix"). Likewise, do not want
to break things.

I thought this was easier to grasp than my first idea: e.g., tag[-2:] in
["32", "64"].

I'll start counting hypens, but am also curious about what is good/bad
about looking how the string ends, e.g., would there be a clear
performance difference?

Many thanks for the review!

On 12/8/2019 1:45 PM, Nick Coghlan wrote:
> Nick Coghlan  added the comment:
>
> There's a compatibility problem with changing the AIX distutils platform 
> prefix from aix to AIX: any existing code that does 
> "distutils.get_platform().startswith('aix')" will break. (There isn't any 
> code in the standard library that does that, it all checks sys.platform() 
> instead, but it's a reasonable assumption that there's going to be code in 
> the wild that does a prefix check on the distutils API output).
>
> So I think we'll want to make the distinction between the two formats based 
> on the number of hyphens they contain, rather than changing the prefix.
>
> I *haven't* made that change directly to the PR myself, as I want to give you 
> a chance to consider the question first, but I do think it's a required 
> compatibility improvement before we move ahead with this.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Is there something that your module can do that typing.NamedTuple can't do?

This won't be added to 2.7: 3.9 would be the first possible version to add a 
feature to.

--
assignee:  -> rhettinger
nosy: +eric.smith, rhettinger
versions:  -Python 2.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



[issue38996] introduction of default values for collection.namedtuple

2019-12-08 Thread Arno-Can Uestuensoez


New submission from Arno-Can Uestuensoez :

Hello,
I had the requirement to make excessive use of named tuples in an extended way. 
The applications are variable data sets with optional items. Typical in 
protocol dat a units, or e.g. mixed abstract filesystem types for heterogeneous 
file system types including URL and UNC.

As I saw the required changes are a couple of lines which I see as harmless. 
The implementation is available for Python2.7 and Python3.5+ in the project 
namedtupledefs, which is the patched code extracted from the *collections*.

The detailed descriptions for both versions are available at:
Python3: https://namedtupledefs3.sourceforge.io/
Python3: https://namedtupledefs.sourceforge.io/
Python2: https://namedtupledefs2.sourceforge.io/

Checked in PyPi + Sourceforge + github - the links are in the documents.

https://github.com/ArnoCan/namedtupledefs3/
https://github.com/ArnoCan/namedtupledefs2/
https://github.com/ArnoCan/namedtupledefs/

https://pypi.org/project/namedtupledefs[23]/

My proposal is to introduce the changes. It would be great for Python2.7 too, 
before the EOL.

WKR

WKR

--
components: Library (Lib)
files: namedtupled-uml-patches.jpg
messages: 358002
nosy: acue
priority: normal
severity: normal
status: open
title: introduction of default values for collection.namedtuple
type: enhancement
versions: Python 2.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48765/namedtupled-uml-patches.jpg

___
Python tracker 

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-08 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-08 Thread miss-islington


miss-islington  added the comment:


New changeset 960fca1a5887a277fd6031cf4c4b6fb31b08ebf5 by Miss Islington (bot) 
in branch '3.8':
bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
https://github.com/python/cpython/commit/960fca1a5887a277fd6031cf4c4b6fb31b08ebf5


--

___
Python tracker 

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



[issue38021] Modify AIX platform_tag so it provides PEP425 needs

2019-12-08 Thread Nick Coghlan


Nick Coghlan  added the comment:

There's a compatibility problem with changing the AIX distutils platform prefix 
from aix to AIX: any existing code that does 
"distutils.get_platform().startswith('aix')" will break. (There isn't any code 
in the standard library that does that, it all checks sys.platform() instead, 
but it's a reasonable assumption that there's going to be code in the wild that 
does a prefix check on the distutils API output).

So I think we'll want to make the distinction between the two formats based on 
the number of hyphens they contain, rather than changing the prefix.

I *haven't* made that change directly to the PR myself, as I want to give you a 
chance to consider the question first, but I do think it's a required 
compatibility improvement before we move ahead with this.

--

___
Python tracker 

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16984
pull_request: https://github.com/python/cpython/pull/17507

___
Python tracker 

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



[issue38021] Modify AIX platform_tag so it provides PEP425 needs

2019-12-08 Thread Nick Coghlan


Nick Coghlan  added the comment:

Removing 3.9 from the target versions, as similar to other platform tag 
improvements, emulation on older release versions will be the domain of 
cross-version libraries, rather than changing the standard library in a 
maintenance.

--
versions:  -Python 3.8

___
Python tracker 

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-08 Thread miss-islington


miss-islington  added the comment:


New changeset 9baa870c27b54c26f9dd292c26936b70bdb64a06 by Miss Islington (bot) 
in branch '3.7':
bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
https://github.com/python/cpython/commit/9baa870c27b54c26f9dd292c26936b70bdb64a06


--

___
Python tracker 

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16982
pull_request: https://github.com/python/cpython/pull/17505

___
Python tracker 

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-08 Thread miss-islington


miss-islington  added the comment:


New changeset 28c91631c24e53713ad0e8a2bbae716373f5e53d by Miss Islington (bot) 
(AMIR) in branch 'master':
bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
https://github.com/python/cpython/commit/28c91631c24e53713ad0e8a2bbae716373f5e53d


--
nosy: +miss-islington

___
Python tracker 

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16983
pull_request: https://github.com/python/cpython/pull/17506

___
Python tracker 

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



[issue33880] namedtuple should use NFKD to find duplicate members

2019-12-08 Thread Batuhan


Batuhan  added the comment:

Hey @rhettinger, what is the status of this issue? Is there a consensus about 
fixing it or can this issue be closed?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue38995] reverse search (ctrl-r) doest not work

2019-12-08 Thread sush


sush  added the comment:

That worked, thanks for the prompt help.

--

___
Python tracker 

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