[issue39177] In tkinter, simple dialogs, askstrings, etc. with flexible coordinates and no viewable parent.

2019-12-31 Thread Dominic Mayers


New submission from Dominic Mayers :

Currently, it's not possible to center or change the coordinates in anyway of 
an askstring, askfloat or askinteger dialog in simpledialog.py. One can see 
this by looking at the code:

if parent.winfo_viewable():
self.transient(parent)

if title:
self.title(title)

self.parent = parent

self.result = None

body = Frame(self)
self.initial_focus = self.body(body)
body.pack(padx=5, pady=5)

self.buttonbox()

if not self.initial_focus:
self.initial_focus = self

self.protocol("WM_DELETE_WINDOW", self.cancel)

if self.parent is not None:
self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
  parent.winfo_rooty()+50))

Here self.parent is never None, because the first statement would create a run 
time error if parent was None. So, the geometry always depends on the parent. 
Moreover, if the parent is not viewable, `parent.winfo_rootx()` and 
`parent.winfo_rooty()` are both 0. So, we can only set the coordinates of a 
simple dialog using a viewable parent. This contradicts a bit "simple" in 
"simpledialog". For example, what about an application that does not have a 
root window, like git for example, but, which unlike git, needs to create 
simple dialogs in some occasions. 

I am aware that a messagebox does not use the code that is presented above, but 
a messagebox is not a simple dialog - it's only a message. 

I am also aware of the class SimpleDialog, which also does not use this code, 
but it only works with buttons. It's not like askstring, askinteger and 
askfloat.

--
messages: 359147
nosy: dominic108
priority: normal
severity: normal
status: open
title: In tkinter, simple dialogs, askstrings, etc. with flexible coordinates 
and no viewable parent.
type: enhancement
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



[issue39171] Missing default root in tkinter simpledialog.py

2019-12-31 Thread Dominic Mayers


Dominic Mayers  added the comment:

Just to add that I realize now that tkinter is designed for applications with a 
root window, the "application window". That's why little attention is given to 
a possible missing root. In fact, it's interesting that we have this code in 
simpledialog.py: 

 
# Here, if parent is None, we have a run time error.
if parent.winfo_viewable():
self.transient(parent)
 
if title:
self.title(title)

self.parent = parent

self.result = None

body = Frame(self)
self.initial_focus = self.body(body)
body.pack(padx=5, pady=5)

self.buttonbox()

if not self.initial_focus:
self.initial_focus = self

self.protocol("WM_DELETE_WINDOW", self.cancel)

if self.parent is not None:
self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
  parent.winfo_rooty()+50))


But, self.parent will never be None. So the geometry always depends on the 
parent, which is compatible with the view that we are within an application 
with a root window - there is always a parent.

But it contradicts a bit, in my view, the "simple" in "simpledialog". What 
about an application with no root window, like git for example, but which, 
unlike git,  needs to create a simple dialog in some occasions?

--

___
Python tracker 

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



[issue37032] Add CodeType.replace() method

2019-12-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17212
pull_request: https://github.com/python/cpython/pull/17779

___
Python tracker 

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



[issue39176] Syntax error message uses strange term: "named assignment"

2019-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 6c004955aceb8a0cd8e14afbc608ebfdf7c8aa4a by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-39176: Improve error message for 'named assignment' (GH-1) (GH-17778)
https://github.com/python/cpython/commit/6c004955aceb8a0cd8e14afbc608ebfdf7c8aa4a


--

___
Python tracker 

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



[issue39176] Syntax error message uses strange term: "named assignment"

2019-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the patch.

--
components: +Interpreter Core
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue39176] Syntax error message uses strange term: "named assignment"

2019-12-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17211
pull_request: https://github.com/python/cpython/pull/17778

___
Python tracker 

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



[issue39176] Syntax error message uses strange term: "named assignment"

2019-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 37143a8e3b2e9245d52f4ddebbdd1c6121c96884 by Raymond Hettinger 
(Ned Batchelder) in branch 'master':
bpo-39176: Improve error message for 'named assignment' (GH-1)
https://github.com/python/cpython/commit/37143a8e3b2e9245d52f4ddebbdd1c6121c96884


--
nosy: +rhettinger

___
Python tracker 

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



[issue39175] Funkness with issubset

2019-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The error is in line 51 which should be:  x3=tuple(sorted(x))
That will make sure you always get {('A', 'B')} instead of {('B', 'A')}.

--
nosy: +rhettinger
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



[issue39175] Funkness with issubset

2019-12-31 Thread Justin Hodder


Justin Hodder  added the comment:

oh I'm using Python 3.8.1 (32-bit)
3.8.1150.0
on win10

--

___
Python tracker 

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



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2019-12-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
Removed message: https://bugs.python.org/msg359133

___
Python tracker 

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



[issue39176] Syntax error message uses strange term: "named assignment"

2019-12-31 Thread Ned Batchelder


Change by Ned Batchelder :


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

___
Python tracker 

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



[issue37032] Add CodeType.replace() method

2019-12-31 Thread Anthony Sottile


Change by Anthony Sottile :


--
pull_requests: +17209
pull_request: https://github.com/python/cpython/pull/17776

___
Python tracker 

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



[issue39175] Funkness with issubset

2019-12-31 Thread Justin Hodder


Justin Hodder  added the comment:

This works:
$ diff PythonDoesntWorks.py HowCanYouPayMana.v3.py
60c60
< if x2.issubset(set(avalMana.keys())):
---
> if x2.issubset(set(list(avalMana.keys(:
62a63
>

this doesn't work:
$ diff PythonDoesntWorks.py HowCanYouPayMana.v3.py
60c60
< if x2.issubset(set(avalMana.keys())):
---
> if x2.issubset(set(list(avalMana.keys(:
62a63
> print("cost",cost)

--

___
Python tracker 

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



[issue39173] _AttributeHolder of argparse should support the sort function or not?

2019-12-31 Thread hai shi


hai shi  added the comment:

Users or developers interact with program by cli(argparse), so attributes' 
output order affect users' interaction.

--

___
Python tracker 

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



[issue39176] Syntax error message uses strange term: "named assignment"

2019-12-31 Thread Ned Batchelder


New submission from Ned Batchelder :

I know this is not allowed:

>>> ((a, b, c) := (1, 2, 3))
  File "", line 1
SyntaxError: cannot use named assignment with tuple


But what is "named assignment", and why is this SyntaxError talking about it?  
Shouldn't it say "cannot use assignment expressions with tuple" ?

--
messages: 359138
nosy: nedbat
priority: normal
severity: normal
status: open
title: Syntax error message uses strange term: "named assignment"

___
Python tracker 

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



[issue39175] Funkness with issubset

2019-12-31 Thread Justin Hodder


New submission from Justin Hodder :

line 59,"print(x2,"avalMana",set(avalMana.keys()))" prints:"{('A', 'B')} 
avalMana {'A', ('A', 'B'), ('A', 'C')}"

line 60,"if x2.issubset(set(avalMana.keys())):" is False 
change line 60 to "if x2.issubset(set(list(avalMana.keys(:" and it 
works as expected.

--
components: Interpreter Core
files: PythonDoesntWorks.py
messages: 359137
nosy: Justin Hodder
priority: normal
severity: normal
status: open
title: Funkness with issubset
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48814/PythonDoesntWorks.py

___
Python tracker 

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



[issue39171] Missing default root in tkinter simpledialog.py

2019-12-31 Thread Dominic Mayers


Change by Dominic Mayers :


--
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue29778] _Py_CheckPython3 uses uninitialized dllpath when embedder sets module path with Py_SetPath

2019-12-31 Thread Anthony Wee


Anthony Wee  added the comment:

It looks like there has been a regression in the fix for this issue. 

The commit below introduced a NULL check which causes a call to 
_PyPathConfig_Init() to be skipped if _Py_dll_path == NULL. It seems like the 
check should be "if (_Py_dll_path != NULL)"?

https://github.com/python/cpython/commit/c422167749f92d4170203e996a2c619c818335ea#diff-87aed37b4704d4e1513be6378c9c7fe6R169

--
nosy: +anthonywee

___
Python tracker 

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



[issue39171] Missing default root in tkinter simpledialog.py

2019-12-31 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2019-12-31 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Hi Pablo, Is there a way for us to test 
https://github.com/python/cpython/pull/17774 on a Windows Builder which 
displayed the post-commit failure?

The CI custom-builders seem to be broken for a different reason: 
https://buildbot.python.org/all/#/builders/106

--

___
Python tracker 

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



[issue39171] Missing default root in tkinter simpledialog.py

2019-12-31 Thread Dominic Mayers


Dominic Mayers  added the comment:

Again, I just spent a few minutes looking at this, but in the ttk module, in a 
similar situation, they do:

if master is None:
if tkinter._support_default_root:
master = tkinter._default_root or tkinter.Tk()
else:
raise RuntimeError(
"No master specified and tkinter is "
"configured to not support default root")

Why not do the same for _QueryDialog in simpledialog.py? Actually, I would also 
withdraw the root that was just created, because the user doesn't expect this 
extra window. So, I would replace

if not parent:
 parent = tkinter._default_root
 
with

if parent is None:
if tkinter._default_root: 
parent = tkinter._default_root
elif tkinter._support_default_root
parent = tkinter.Tk()
parent.withdraw()
else:
raise RuntimeError(
"No parent specified and tkinter is "
"configured to not support default root")

This tries to get a parent, if possible, and provides a more useful message 
when no parent can be found, just as in the ttk module in a similar situation.

--

___
Python tracker 

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



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2019-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-1 

I think the module is better-off without this function.  There are already more 
functions than most people know or remember.  For most cases, re.search() or 
re.finditer() will suffice.  

Also, I don't recall having seen findall(...)[0].  If it does exist, it is 
likely an education problem (i.e. something that can be addressed with 
documentation or a faq).

--
nosy: +rhettinger

___
Python tracker 

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Ruslan Dautkhanov


Ruslan Dautkhanov  added the comment:

Didn't see your last response before submitting an update.

That's great you have a plan how to resolve this! 

Thanks again

--

___
Python tracker 

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Ruslan Dautkhanov


Ruslan Dautkhanov  added the comment:

Perhaps the check should only be done in some sort of Python development mode 
and off by default?

--

___
Python tracker 

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Guido van Rossum

Guido van Rossum  added the comment:

OK let’s do it. Clearly for *some* applications the overhead is significant.
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Ruslan Dautkhanov


Ruslan Dautkhanov  added the comment:

Thank you Guido and Ivan

--

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2019-12-31 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Thanks for the note, Pablo.
I am going to check if this patch https://github.com/python/cpython/pull/17774 
will solve the Windows buildbot issues.

--
stage: patch review -> resolved

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2019-12-31 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +17207
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/17774

___
Python tracker 

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



[issue39173] _AttributeHolder of argparse should support the sort function or not?

2019-12-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

OK, here is the original issue https://github.com/python/typing/issues/681. I 
asked the author to open an issue here instead, but likely they didn't open one.

--

___
Python tracker 

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Guido van Rossum


Guido van Rossum  added the comment:

If that solves the perf issue I am fine with it.

--

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2019-12-31 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This PR1040 is failing in several 2.7 buildbots:

Tests result: FAILURE then FAILURE
test test_urllibnet failed -- Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\2.7.bolen-windows7\build\lib\test\test_urllibnet.py",
 line 232, in test_multiple_ftp_retrieves
"multiple times.\n Error message was : %s" % e)
AssertionError: Failed FTP retrieve while accessing ftp url multiple times.
 Error message was : [Errno 13] Permission denied: 'd:\\temp\\tmpiuquqa'
Example failure:

https://buildbot.python.org/all/#/builders/209/builds/4

--
nosy: +pablogsal
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

This issue came up few times before (although I can't find an issue here on 
b.p.o., maybe it was on typing-sig list). Although in micro-benchmarks the 
impact may seem big, in vast majority of applications it is rarely more that a 
percent or so.

On the other hand, IIRC the only reason `Generic.__new__()` exists is so that 
one can't write `Generic()` (i.e. instantiate a plain `Generic`). I would be 
totally fine if we just remove it in 3.9. Hopefully, people already learned 
what typing is for and don't need so much "protection" against not very 
meaningful things. Also, the error can be given by static type checkers, there 
is probably no need for a runtime error.

--

___
Python tracker 

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



[issue39174] unicodedata.normalize failing with NFD and NFKD for some characters in Python3

2019-12-31 Thread Lee Collins


Lee Collins  added the comment:

On further investigation, it appears that the problem is the interaction 
between Python3 and the MacOS terminal. unicodedata.normalize() produces the 
correct sequence u'a\u0300' but when printed it comes out as U+00E0

--

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2019-12-31 Thread Vinay Sajip


Change by Vinay Sajip :


--
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2019-12-31 Thread Vinay Sajip


Change by Vinay Sajip :


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

___
Python tracker 

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



[issue11105] Compiling evil ast crashes interpreter

2019-12-31 Thread ppperry


ppperry  added the comment:

What about indirect cycles like below:

>>> e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
>>> f = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
>>> e.operand = f
>>> f.operand = e
>>> compile(ast.Expression(e), "", "eval")

(I tested, this also crashes)

--
nosy: +ppperry

___
Python tracker 

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



[issue39173] _AttributeHolder of argparse should support the sort function or not?

2019-12-31 Thread SilentGhost


SilentGhost  added the comment:

What is the use-case for this? Why would anyone care in which order arguments 
are represented in the object repr?

--
nosy: +SilentGhost

___
Python tracker 

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



[issue39174] unicodedata.normalize failing with NFD and NFKD for some characters in Python3

2019-12-31 Thread Lee Collins

New submission from Lee Collins :

A script that works in 2.7.17 is now failing for some Unicode characters in 
3.7.5 on MacOS 10.14.6. For example unicodedata.normalize('NFD', 'à') used to 
return the correct decomposition u'a\u0300', but in 3.7 it returns the single 
composed character U+00E0. This doesn't happen for all composed forms, just 
some. Other examples: á, ã

--
components: Unicode
messages: 359120
nosy: Lee Collins, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: unicodedata.normalize failing with NFD and NFKD for some characters in 
Python3
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



[issue39172] Transformation of "string.find('asd', 'sd')" to Python 3 using 2to3

2019-12-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Fixers find, rfind, etc in 'string' module

___
Python tracker 

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



[issue39075] types.SimpleNamespace should preserve attribute ordering (?)

2019-12-31 Thread hai shi


hai shi  added the comment:

>Consider opening a separate issue (or start a thread on python-ideas)
>about adding a more sophisticated implementation to the stdlib's
>"reprlib" module.  If you do so then please draw from the
>argparse._AttributeHolder implementation.

FWIW, i created a new bpo: https://bugs.python.org/issue39173

--

___
Python tracker 

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



[issue39173] _AttributeHolder of argparse should support the sort function or not?

2019-12-31 Thread hai shi

New submission from hai shi :

Currently, many developers discuss the output of attributes of argparse should 
be sorted or not?

>>> from argparse import ArgumentParser
>>> parser = ArgumentParser()
>>> _ = parser.add_argument('outstream')
>>> _ = parser.add_argument('instream')
>>> args = parser.parse_args(['out.txt', 'in.txt'])

# Keep the original order
>>> vars(args)

{'outstream': 'out.txt', 'instream': 'in.txt'}
# Order is sorted
>>> args
Namespace(instream='in.txt', outstream='out.txt')

IMHO, the attributes order should be keep the original order by default. If 
user would like use order the attributes order, we should add a param in 
`_AttributeHolder` to open sorting or not.

such as:
```
class _AttributeHolder(object):
def __init__(self, sort=false):
self.sort = sort

def _get_kwargs(self):
if sort:
return sorted(self.__dict__.items())
else:
return self.__dict__.items()
```

some other bpos have discussed this topic too: issue39075、issue39058

--
components: Library (Lib)
messages: 359118
nosy: shihai1991
priority: normal
severity: normal
status: open
title: _AttributeHolder of argparse should support the sort function or not?
type: enhancement

___
Python tracker 

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



[issue39171] Missing default root in tkinter simpledialog.py

2019-12-31 Thread Dominic Mayers


Dominic Mayers  added the comment:

If it's normal, then the error message should perhaps be more informative and 
user friendly than just a traceback: 

Traceback (most recent call last):
  File "./dialog.py", line 6, in 
integer_value = simpledialog.askinteger('Dialog Title', 'What is your 
age?', minvalue=0, maxvalue=100)
  File "/usr/lib/python3.7/tkinter/simpledialog.py", line 341, in askinteger
d = _QueryInteger(title, prompt, **kw)
  File "/usr/lib/python3.7/tkinter/simpledialog.py", line 271, in __init__
Dialog.__init__(self, parent, title)
  File "/usr/lib/python3.7/tkinter/simpledialog.py", line 137, in __init__
if parent.winfo_viewable():
AttributeError: 'NoneType' object has no attribute 'winfo_viewable'

If it is not too intrusive, it would be even more user friendly if the code 
found some parent window.

--

___
Python tracker 

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



[issue39172] Transformation of "string.find('asd', 'sd')" to Python 3 using 2to3

2019-12-31 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems to be a duplicate of issue2899

--
nosy: +xtreak

___
Python tracker 

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



[issue39172] Transformation of "string.find('asd', 'sd')" to Python 3 using 2to3

2019-12-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
title: Translation of "string.find('asd', 'sd')" doesn't work -> Transformation 
of "string.find('asd', 'sd')" to Python 3 using 2to3

___
Python tracker 

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



[issue39172] Translation of "string.find('asd', 'sd')" doesn't work

2019-12-31 Thread ניסן בכר

New submission from ניסן בכר :

When using the following code to run using python 2.x, it works:

import string
string.find("asd", "sd")

But this method is deprecated in python 3.x

When using "2to3" tool to convert, it doesn't convert it successfully.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 359115
nosy: ניסן בכר
priority: normal
severity: normal
status: open
title: Translation of "string.find('asd', 'sd')" doesn't work
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



[issue24925] Allow doctest to find line number of __test__ strings if formatted as a triple quoted string.

2019-12-31 Thread Jurjen N.E. Bos


Jurjen N.E. Bos  added the comment:

All is fixed. The PR apparently is correct.
My first dent in the Python universe, however small :-)

--

___
Python tracker 

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



[issue39167] argparse boolean type bug

2019-12-31 Thread Trenton Bricken


Trenton Bricken  added the comment:

Thanks for all of these replies. 

The functionality is that the user adds --flag True False and then all of the 
other parameters are run with True. And then again with False. 

I thought this was a bug because of the confusing type=bool behavior. But it 
certainly isn't a big deal and it seems like you are already aware of it. 

Thanks for all of your open source contributions and help.

--

___
Python tracker 

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



[issue18858] dummy_threading lacks threading.get_ident() equivalent

2019-12-31 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> wont fix
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



[issue18858] dummy_threading lacks threading.get_ident() equivalent

2019-12-31 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

dummy_threading was removed in Python 3.9 with issue37312 . I hope this issue 
can be closed as outdated.

--
nosy: +inada.naoki, xtreak

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-31 Thread Bruce Merry


Bruce Merry  added the comment:

> Do you think it would be sufficient to change the stress test from joining 
> 1000 items to joining 10 items?

Actually that won't work, because the existing stress test is using a non-empty 
separator. I'll add another version of that stress test that uses an empty 
separator.

--

___
Python tracker 

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



[issue39146] too much memory consumption in re.compile unicode

2019-12-31 Thread Zhipeng Xie


Zhipeng Xie <775350...@qq.com> added the comment:

> but range() was here before ebd48b4f650d.

before ebd48b4f650d, _optimize_unicode use xrange. So python2.7.8 is ok and 
python2.7.9 consume much memory in my test case.

> Obviously there are other causes of the difference between 2.7 and 3.x.

Maybe it is because my python was compiled with --enable-unicode=ucs4.

--

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-31 Thread Bruce Merry


Bruce Merry  added the comment:

> I'll take a look at extra unit tests soon. Do you know off the top of your 
> head where to look for existing `join` tests to add to?

Never mind, I found it: 
https://github.com/python/cpython/blob/92709a263e9cec0bc646ccc1ea051fc528800d8d/Lib/test/test_bytes.py#L535-L559

Do you think it would be sufficient to change the stress test from joining 1000 
items to joining 10 items?

--

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-31 Thread Bruce Merry


Bruce Merry  added the comment:

I've attached a benchmark script and CSV results for master (whichever version 
that was at the point I forked) and with unconditional dropping of the GIL. It 
shows up to 3x performance improvement when using 4 threads. That's on my home 
desktop, which is quite old (Sandy Bridge). I'm expecting more significant 
gains on server CPUs, whose memory systems are optimised for multi-threaded 
workloads. The columns are chunk size, number of chunks, number of threads, and 
per-thread throughput.

There are also cases where using multiple threads is a slowdown, but I think 
that's an artifact of the benchmark. It repeatedly joins the same strings, so 
performance is higher when they all fit in the cache; when using 4 threads that 
execute in parallel, the working set is 4x larger and may cease to fit in 
cache. In real-world usage one is unlikely to be joining the same strings again 
and again.

In the single-threaded case, the benchmark seems to show that for 64K+, 
performance is improved by dropping the GIL (which I'm guessing must be 
statistical noise, since there shouldn't be anything contending for it), which 
is my reasoning behind the 65536 threshold.

I'll take a look at extra unit tests soon. Do you know off the top of your head 
where to look for existing `join` tests to add to?

--

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-31 Thread Bruce Merry


Change by Bruce Merry :


Added file: https://bugs.python.org/file48813/benchjoin.py

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-31 Thread Bruce Merry


Change by Bruce Merry :


Added file: https://bugs.python.org/file48812/new.csv

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2019-12-31 Thread Bruce Merry


Change by Bruce Merry :


Added file: https://bugs.python.org/file48811/old.csv

___
Python tracker 

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



[issue39169] TypeError: 'int' object is not callable if the signal handler is SIG_IGN

2019-12-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +ethan.furman, serhiy.storchaka

___
Python tracker 

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



[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-31 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +17205
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/17769

___
Python tracker 

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



[issue39146] too much memory consumption in re.compile unicode

2019-12-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

We usually do not backport optimizations to 2.7. It could be backported if a 
regression was introduced in one of 2.7 bugfixes, but range() was here before 
ebd48b4f650d.

Also, range(0x1,0x10+1) takes only 32*2**16 = 2 MiB of memory. It is 
small in comparison with total memory consumption. Obviously there are other 
causes of the difference between 2.7 and 3.x.

--

___
Python tracker 

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



[issue39171] Missing default root in tkinter simpledialog.py

2019-12-31 Thread Dominic Mayers


New submission from Dominic Mayers :

My first "bug" report here. Not sure I am doing it right. It is just that if I 
execute the code

import tkinter
from tkinter import simpledialog
tkinter.Tk().withdraw() 
integer_value = simpledialog.askinteger('Dialog Title', 'What is your 
age?', minvalue=0, maxvalue=100)

It works. In particular, when the line `parent = tkinter._default_root` is 
executed in simpledialog.py, `_default_root` is defined.  However, if I execute 
the code

import tkinter
from tkinter import simpledialog
integer_value = simpledialog.askinteger('Dialog Title', 'What is your 
age?', minvalue=0, maxvalue=100)

which does not have the line `tkinter.Tk().withdraw()` it does not work. When 
the line `parent = tkinter._default_root` is executed, `_default_root` is not 
defined. 

I don't know if it is a bug. I don't understand the remainder of the code 
enough to say. However, the purpose of this line is to define a parent when 
none is provided. It seem to me that it should be possible to find a parent 
window...

--
components: Tkinter
messages: 359106
nosy: dominic108
priority: normal
severity: normal
status: open
title: Missing default root in tkinter simpledialog.py
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