[issue37556] Launcher help does not mention configuration options

2019-07-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

The >= is unnecessary in this exact example, as is correctly noted by Nathan.

I understand using >= for future purposes, after you explained, what is also 
correct but confusing because you specifically describe why you change the >= 
2, but it doesn't make sense for >= 1 then.

For the last example, I might be completely wrong (please don't shoot me), IMHO 
it can be == 1 also? It is not 'explicitly showing how to emit additional 
messages at higher verbosity levels', but to 'uses verbosity level to display 
more text'. So, removing the 'else' statement to always print(answer), no 
matter which verbosity is shown.

To avoid confusion, I recommend the change and please have another look at the 
last statement that makes no difference in using == or >=.

--

___
Python tracker 

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



[issue37555] _CallList.__contains__ doesn't always respect ANY.

2019-07-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. Can you please add an example without Django or other 
dependencies so that I can try reproducing it? I am trying out the below 
program from the report where Foo has overridden __eq__ to return False if the 
other object being compared is not a Foo object. In the next statements ANY == 
Foo() returns True since the left side's object.__eq__ is used which in this 
case is ANY.__eq__ as you have noted in the original report. 

When list of call objects are compared there is also a code comment about this 
in the tuple comparison  of args and kwargs such that ANY is placed on the left 
side [0] so that ANY.__eq__ is used. A pure python example and traceback if any 
would help here.


from unittest.mock import call, ANY, Mock

class Foo:

def __eq__(self, other):
if not isinstance(other, Foo):
return False
return True

m = Mock()
obj = Foo()
m(obj, 1)
m.assert_has_calls([call(ANY, 1)])

print(ANY == Foo()) # ANY.__eq__ is called
print(Foo() == ANY) # Foo().__eq__ is called

Is the report more about the below case where position of call objects returns 
different values?

print(call(ANY, 1) == call(obj, 1)) # False
print(call(obj, 1) == call(ANY, 1)) # True


[0] 
https://github.com/python/cpython/blob/2a3d4d9c53dd4831c3ecf56bc7c4a289c33030d6/Lib/unittest/mock.py#L2407

--
components: +Library (Lib) -Tests
nosy: +xtreak
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



[issue37555] _CallList.__contains__ doesn't always respect ANY.

2019-07-10 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue37556] Launcher help does not mention configuration options

2019-07-10 Thread Steve Barnes


New submission from Steve Barnes :

py[w] --help on Windows launchers do not currently mention the options to 
configure versions used - just state latest.

This leads some people to struggle with things like testing beta versions, etc. 
as they end up defaulting to the beta which is undesirable.

--
components: Demos and Tools
messages: 347653
nosy: Steve Barnes
priority: normal
severity: normal
status: open
title: Launcher help does not mention configuration options
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, 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



[issue37555] _CallList.__contains__ doesn't always respect ANY.

2019-07-10 Thread Elizabeth Uselton


New submission from Elizabeth Uselton :

I have a test that goes something like:

```
@patch('a.place.to.patch')
def test_a_thing_calls_what_it_should(self, my_mock):
# Set up logic here
my_mock.assert_has_calls([
call(
ANY,
Decimal('20')
),
call(
ANY,
Decimal('10')
)
])```

Which fails, where my_mock.call_args_list looks like 

```
[(, Decimal('20')), (, Decimal('10'))]
```

This seems like wrong behavior. ANY should be happy to be compared to anything, 
even a Django object. Doing some digging, I found that on line 340 of 
cpython/Lib/unittest/mock.py _CallList is overriding __contains__ and comparing 
each item in the tuples with what I'd passed in to assert_has_calls on the 
right, which means that instead of using ANY.__eq__, it's calling the Django 
model's __eq__ with ANY as an argument. Django first checks if the thing it's 
comparing to is another Django model, and returns False if not. So, 
 == ANY is False, but ANY ==  is True. I know that 
this could also be considered a bug with Django, and I plan to file one with 
them too, but I don't see any downside to improving the mock library to be more 
defensive in honoring ANY over any other custom class's overridden __eq__ 
method.

--
components: Tests
messages: 347652
nosy: Elizabeth Uselton
priority: normal
severity: normal
status: open
title: _CallList.__contains__ doesn't always respect ANY.
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, 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



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Zachary Ware


Zachary Ware  added the comment:

I don't agree with the proposed change; I think the examples are fine as is.

Using `>= 1` means if you later decide that the `-vv` message should actually 
only happen at `-vvv` and `-vv` should get the same message as `-v`, you only 
have to change the 2 to a 3 and you're done.  With `== 1` you have to remember 
to either change `== 1` to `>= 1` or switch to `in {1, 2}`, or (more likely) 
forget to make the change initially and have to go back and fix it later.

The last example especially must not be changed; it is explicitly showing how 
to emit additional messages at higher verbosity levels.

I recommend closing this issue.

--
nosy: +zach.ware

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2019-07-10 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
pull_requests: +14498
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/14699

___
Python tracker 

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



[issue36044] PROFILE_TASK for PGO build is not a good workload

2019-07-10 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

yeah I pulled a similar looking list of tests for the PROFILE_TASK to suggest 
to the Docker Python image maintainers - see 
https://github.com/docker-library/python/pull/404 and 
https://github.com/docker-library/python/issues/160.

I haven't run comparisons of that vs the default overly long profile task, but 
a comparison against a non PGO enabled cpython 3.7 build shows the types of 
speedups i'd expect from a decent PGO build.

doing proper comparisons against a full build would take a lot more time than I 
have right now.

It'd be reasonable to change the default task to something that is faster to 
build so long as we don't appear to be making major sacrifices in speed 
somewhere.

(your benchmark table's pickle result changes are inconsistent and odd, but 
that benchmark may not be very meaningful as written, i haven't looked at it)

--

___
Python tracker 

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



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Aldwin Pollefeyt


Change by Aldwin Pollefeyt :


--
nosy: +aldwinaldwin

___
Python tracker 

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



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Aldwin Pollefeyt


Change by Aldwin Pollefeyt :


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

___
Python tracker 

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



[issue36044] PROFILE_TASK for PGO build is not a good workload

2019-07-10 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

> Decreasing the total wall time for a default --enable-optimizations build 
> would 
> be a good thing for everyone, provided the resulting interpreter remains 
> "effectively similar" in speed.  If you somehow manage to find something that
> actually speeds up the resulting interpreter, amazing!

I spent quite a lot of time making different PGO builds and comparing with 
pyperformance.  The current PGO task is *really* slow.  Just running the 
PROFILE_TASK takes 24 minutes on my decently fast PC.

Using this set of tests seems to work pretty well:

PROFILE_TASK=-m test.regrtest --pgo \
test_collections \
test_dataclasses \
test_difflib \
test_embed \
test_float \
test_functools \
test_generators \
test_int \
test_itertools \
test_json \
test_logging \
test_long \
test_ordered_dict \
test_pickle \
test_pprint \
test_re \
test_set \
test_statistics \
test_struct \
test_tabnanny \
test_xml_etree

Instead of 24 minutes, the above task takes one and a half minutes.  
pyperformance results seem largely unchanged.  Comparison below.  Tuning the 
tests to get the best pyperformance result is a bit dangerous and perhaps 
running the whole test suite is safer (i.e. we are not optimizing for specific 
benchmarks).  I didn't tweak the list too much.  I added test_int, test_long, 
test_struct and test_itertools as a result of my pyperformance runs.  Not too 
surprising those are important modules.

I think the set of tests above should do a pretty good job of covering the hot 
code paths in most Python programs.  So, maybe it is good enough given the 
massive speedup in build time.



+-+--+--+
| Benchmark   | task-all | task-short   |
+=+==+==+
| 2to3| 311 ms   | 315 ms: 1.01x slower (+1%)   |
+-+--+--+
| chaos   | 111 ms   | 108 ms: 1.02x faster (-2%)   |
+-+--+--+
| crypto_pyaes| 114 ms   | 112 ms: 1.01x faster (-1%)   |
+-+--+--+
| dulwich_log | 78.0 ms  | 78.7 ms: 1.01x slower (+1%)  |
+-+--+--+
| fannkuch| 470 ms   | 452 ms: 1.04x faster (-4%)   |
+-+--+--+
| float   | 118 ms   | 117 ms: 1.01x faster (-1%)   |
+-+--+--+
| go  | 253 ms   | 255 ms: 1.01x slower (+1%)   |
+-+--+--+
| json_dumps  | 12.5 ms  | 11.8 ms: 1.06x faster (-6%)  |
+-+--+--+
| json_loads  | 26.3 us  | 25.4 us: 1.04x faster (-3%)  |
+-+--+--+
| logging_format  | 9.53 us  | 9.66 us: 1.01x slower (+1%)  |
+-+--+--+
| logging_silent  | 198 ns   | 196 ns: 1.01x faster (-1%)   |
+-+--+--+
| mako| 15.2 ms  | 15.8 ms: 1.04x slower (+4%)  |
+-+--+--+
| meteor_contest  | 98.2 ms  | 96.8 ms: 1.01x faster (-1%)  |
+-+--+--+
| nbody   | 135 ms   | 133 ms: 1.01x faster (-1%)   |
+-+--+--+
| nqueens | 97.2 ms  | 96.6 ms: 1.01x faster (-1%)  |
+-+--+--+
| pathlib | 19.4 ms  | 19.7 ms: 1.02x slower (+2%)  |
+-+--+--+
| pickle  | 8.10 us  | 9.07 us: 1.12x slower (+12%) |
+-+--+--+
| pickle_dict | 23.1 us  | 18.6 us: 1.25x faster (-20%) |
+-+--+--+
| pickle_list | 3.64 us  | 2.81 us: 1.30x faster (-23%) |
+-+--+--+
| pickle_pure_python  | 470 us   | 460 us: 1.02x faster (-2%)   |
+-+--+--+
| pidigits| 169 ms   | 173 ms: 1.02x slower (+2%)   |
+-+--+--+
| python_startup  | 7.94 ms  | 

[issue30757] pyinstaller can be added to docs, py2exe ref can be updated

2019-07-10 Thread Zachary Ware


Zachary Ware  added the comment:

I've just come across the fact that the Windows FAQ is out of date again.  
Denis, your PR still has some pending change requests; are you interested in 
updating your PR, or would you rather someone else take this over?

--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> patch review
versions: +Python 3.8, Python 3.9 -Python 2.7, Python 3.3, Python 3.4, 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



[issue37532] email.header.make_header() doesn't work if any `ascii` code is out of range(128)

2019-07-10 Thread Aldwin Pollefeyt


Change by Aldwin Pollefeyt :


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

___
Python tracker 

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



[issue37554] Typo in os.rename docs

2019-07-10 Thread Mariatta


Change by Mariatta :


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

___
Python tracker 

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



[issue37554] Typo in os.rename docs

2019-07-10 Thread Roy Wellington


New submission from Roy Wellington :

The documentation for os.rename (e.g., here, 
https://docs.python.org/3/library/os.html#os.rename but also for 3.8 and 3.9) 
currently reads,

> On Unix, if src is a file and dst is a directory or vice-versa, anq:q 
> IsADirectoryError or a NotADirectoryError will be raised respectively.

That "anq:q" should probably be just "an"; it appears someone tried to quit vim 
;-)

--
assignee: docs@python
components: Documentation
messages: 347647
nosy: docs@python, roy.wellington
priority: normal
severity: normal
status: open
title: Typo in os.rename docs
versions: Python 3.7, 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



[issue33408] Enable AF_UNIX support in Windows

2019-07-10 Thread Ma Lin


Ma Lin  added the comment:

It would be nice to investigate the habit of using AF_UNIX in Python code on 
GitHub:
https://github.com/search?l=Python=AF_UNIX=Code

If adding this flag will break a lot of code, due to lacking supports to 
datagram, maybe we should not add AF_UNIX at once, and waiting for full support 
to AF_UNIX.

--

___
Python tracker 

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



[issue33408] Enable AF_UNIX support in Windows

2019-07-10 Thread Ma Lin


Ma Lin  added the comment:

Have you upgraded the building SDK that supports AF_UNIX?

And should remove AF_UNIX flag at runtime on systems older than Windows 10 
1804, see issue32394.

--
nosy: +Ma Lin

___
Python tracker 

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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread DaveB


DaveB  added the comment:

Results with Python 3.7.4 on Windows 7

>>> import os, msvcrt
>>> msvcrt.get_osfhandle(0)
15
>>> os.set_handle_inheritable(msvcrt.get_osfhandle(0), False)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [WinError 87] The parameter is incorrect
>>>

--

___
Python tracker 

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



[issue37553] SendfileUsingSendTest tests timeout too short for Windows ARM32

2019-07-10 Thread Paul Monson


New submission from Paul Monson :

2 seconds doesn't seem to be a long enough timeout for os.sendfile tests on 
Windows ARM32

--
components: Tests, Windows
messages: 347643
nosy: Paul Monson, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: SendfileUsingSendTest tests timeout too short for Windows ARM32
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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread Eryk Sun


Eryk Sun  added the comment:

> OSError: [WinError 87] The parameter is incorrect

This error didn't originate from the C dup() call, since that would be based on 
errno, like `OSError: [Errno 9] Bad file descriptor`. It must come from 
_Py_set_inheritable. The only WINAPI call there is SetHandleInformation [1], 
which is documented to support "console input buffer" and "console screen 
buffer" handles, though it may be that the documentation is wrong.

Try the following code:

>>> import os, msvcrt
>>> msvcrt.get_osfhandle(0)
84
>>> os.set_handle_inheritable(msvcrt.get_osfhandle(0), False)

Prior to Windows 8, a console handle is tagged by setting the lower 2 bits 
(e.g. 3, 7, 11). The system uses this tag to direct calls to special console 
functions that route requests over the console LPC port. Thus, in the domain of 
File handles, setting the lower 2 bits is reserved to tag console handles. This 
should also be true in Windows 8+, even though console handle tagging is no 
longer used (now they're kernel handles for the ConDrv device). 

The above test will confirm my suspicion, but it looks some time around Windows 
XP/2003, Microsoft removed the internal [Get|Set]ConsoleHandleInformation 
functions that used to implement [Get|Set]HandleInformation for console 
handles, and the people responsible for the change failed to update the docs. 
Since the internal DuplicateConsoleHandle function wasn't removed, dup() itself 
still succeeds.

I suggest that _Py_set_inheritable should handle this case. If the call fails 
with ERROR_INVALID_PARAMETER, and the two tag bits of the handle are set, the 
handle is possibly (not necessarily) a console handle. In this case, if 
GetFileType is FILE_TYPE_CHARACTER, then it's a console handle, and the error 
should be ignored.

[1] 
https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-sethandleinformation

--

___
Python tracker 

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



[issue7946] Convoy effect with I/O bound threads and New GIL

2019-07-10 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I suggest:
 (1) turning one of the patches (probably the last BFS one?) into a PR against 
the github master branch (3.9) and,
 (2) if none of the existing pyperformance workloads already demonstrates the 
problems with the existing GIL implementation, adopt one of the benchmarks here 
into an additional pyperformance workload.
 (3) demonstrate pyperformance results (overall and targeted tests) before and 
after the change.

Simultaneously, it'd also be interesting to see someone create an alternate PR 
using a PyPy inspired GIL implementation as that could prove to be a lot easier 
to maintain.

Lets make a data driven decision here.

People lost interest in actually landing a fix to this issue in the past 
because it wasn't impacting their daily lives or applications (or if it was, 
they already adopted a workaround).  Someone being interested enough to do the 
work to justify it going in is all it should take to move forward.

--

___
Python tracker 

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



[issue7946] Convoy effect with I/O bound threads and New GIL

2019-07-10 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

(unassigning as it doesn't make sense to assign to anyone unless they're 
actually working on it)

--
assignee: pitrou -> 

___
Python tracker 

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



[issue7946] Convoy effect with I/O bound threads and New GIL

2019-07-10 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
priority: low -> normal
versions: +Python 3.9 -Python 3.3

___
Python tracker 

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



[issue37521] importlib.util.module_from_spec return value is not the same as in sys.modules

2019-07-10 Thread Brett Cannon


Brett Cannon  added the comment:

Thanks! I'll try to have a look when I can.

--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue37552] [Windows] strptime/strftime return invalid results with UCRT version 17763.615

2019-07-10 Thread Paul Monson


Change by Paul Monson :


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

___
Python tracker 

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



[issue37552] [Windows] strptime/strftime return invalid results with UCRT version 17763.615

2019-07-10 Thread Paul Monson


New submission from Paul Monson :

strptime/strftime return invalid results when using UCRT version 17763.615

--
components: Tests, Windows
messages: 347638
nosy: Paul Monson, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [Windows] strptime/strftime return invalid results with UCRT version 
17763.615
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



[issue37552] [Windows] strptime/strftime return invalid results with UCRT version 17763.615

2019-07-10 Thread Paul Monson


Change by Paul Monson :


--
type:  -> behavior

___
Python tracker 

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



[issue37482] Email address display name fails with both encoded words and special chars

2019-07-10 Thread R. David Murray


R. David Murray  added the comment:

The display name is a phrase, and a phrase is a sequence of words, and a word 
is either a quoted string or an atom.  So it is legal to mix quoted strings and 
encoded words in a display name.  I'd vote to do whichever one is easier to 
implement :)  (I haven't looked at your PR yet and unfortunately my time is 
limited :(

--

___
Python tracker 

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



[issue37551] IDLE: Quitting with a new, unsaved editor window causes an exception

2019-07-10 Thread Tal Einat


New submission from Tal Einat :

Observed on macOS 10.14.5 with Python 3.8 from python.org, and with latest 
master branch.

Reproduction:
1. Open IDLE
2. "New File" (Cmd-Shift-n on macOS)
3. Quit using Cmd-q ("Quit Python" from the menu doesn't cause this!)

The exception traceback:
Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py",
 line 1883, in __call__
return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/multicall.py",
 line 176, in handler
r = l[i](event)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/filelist.py",
 line 54, in close_all_callback
reply = edit.close()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/editor.py",
 line 1021, in close
self._close()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/pyshell.py",
 line 312, in _close
EditorWindow._close(self)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/editor.py",
 line 1025, in _close
if self.io.filename:
AttributeError: 'NoneType' object has no attribute 'filename'

--
assignee: terry.reedy
components: IDLE
messages: 347636
nosy: taleinat, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Quitting with a new, unsaved editor window causes an exception
type: behavior
versions: Python 3.7, 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



[issue37537] Compute allocated blocks in _Py_GetAllocatedBlocks()

2019-07-10 Thread Neil Schemenauer


Neil Schemenauer  added the comment:


New changeset 5d25f2b70351fc6a56ce5513ccf5f58556c18837 by Neil Schemenauer in 
branch 'master':
bpo-37537: Compute allocated blocks in _Py_GetAllocatedBlocks() (#14680)
https://github.com/python/cpython/commit/5d25f2b70351fc6a56ce5513ccf5f58556c18837


--

___
Python tracker 

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



[issue37482] Email address display name fails with both encoded words and special chars

2019-07-10 Thread B Siemerink


B Siemerink  added the comment:

Hello David, thank you for the suggestion.

Regarding your comment:
> Either the comma should be encoded, or the "Foo Bar," should be in quotes.

According to RFC5322 the display name cannot contain both a quoted part and an 
encoded word, so the only option is to encode the comma.

Please let me know if I can do anything else.

--

___
Python tracker 

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



[issue37267] os.dup() creates an inheritable fd when handling a character file on Windows

2019-07-10 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

This may have caused a regression, see #37549.

--
nosy: +josh.r

___
Python tracker 

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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

This seems likely to have been caused by the fixes for #37267, which fixes an 
issue with os.dup leaving character streams inheritable (when the documentation 
specifies that the result must be non-inheritable).

The code originally didn't try to make the descriptor non-inheritable because 
someone believed it wasn't allowed for character files, and the subsequent 
patch comments say "That was a mistake". Is it possible it wasn't allowed on 
Windows 7, and is allowed on Windows 10?

I'm nosying the folks from #37267 for input.

--
nosy: +ZackerySpytz, josh.r, vstinner

___
Python tracker 

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



[issue21478] mock calls don't propagate to parent (autospec)

2019-07-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> I think a possible fix is to move the inner mock extraction out to the 
> attach_mock function as that function contains code to clear the mock's 
> parent and name attributes. Downside is that that would make it fail on 
> Dmitry's toy example.

Moving the inner mock check would cause the original report to fail. But the 
same logic can be copied to attach_mock so that name and parent for inner mock 
set in "mock" attribute is cleared. So _check_and_set_parent code path is hit 
the mock attribute without name and parent would behave as expected. Jack, 
would appreciate your review of the PR. I have added your report as a unittest 
along with directly using create_autospec with attach_mock that behaves like 
patch and autospec=True. I have also asserted that name is reset to child as 
per the docs at 
https://docs.python.org/3/library/unittest.mock.html#attaching-mocks-as-attributes

Thanks

--

___
Python tracker 

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



[issue21478] mock calls don't propagate to parent (autospec)

2019-07-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +14493
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14688

___
Python tracker 

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



[issue37550] SSL Pip Error

2019-07-10 Thread Bane Banane


New submission from Bane Banane :

Python PIP SSL module is not avaible when i start:
pip install 

--
assignee: christian.heimes
components: SSL
messages: 347630
nosy: Bane Banane, christian.heimes
priority: normal
severity: normal
status: open
title: SSL Pip Error
type: compile error
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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eryksun

___
Python tracker 

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



[issue33408] Enable AF_UNIX support in Windows

2019-07-10 Thread Paul Monson


Paul Monson  added the comment:

I've been asked by my team to investigate what is required to enable AF_UNIX in 
Python.

Is anyone else actively investigating this?  I did a prelinary investigation 
and the impact on test in test_sockets was pretty simple.  

However there were 26 test failures in test_asyncio tests, with only the naive 
changes to all AF_UNIX to work with the socket class on Windows.  

The first failure I looked at was caused by ProactorEventLoop in 
windows_events.py not providing a windows-specific version of 
create_unix_server. This results in the code falling back to 
AbstractServer.create_unix_server which raises NotImplementedError.

--

___
Python tracker 

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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue37482] Email address display name fails with both encoded words and special chars

2019-07-10 Thread R. David Murray

R. David Murray  added the comment:

FYI, it would have been most helpful if you had posted your example in the 
issue text instead of as an attached file, as it explains the problem better 
than your text does :)

Here is a minimal reproducer:

>>> m = EmailMessage(policy=strict)
>>> m['From'] = '"Foo Bar, España" '
>>> bytes(m)
b'From: Foo Bar, =?utf-8?q?Espa=C3=B1a?= \n\n'

This serialization of the header is, as you say, invalid.  Either the comma 
should be encoded, or the "Foo Bar," should be in quotes.

--

___
Python tracker 

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



[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread DaveB


New submission from DaveB :

os.dup(fd) generates an OSError for standard streams (0: stdin, 1: stdout, 2: 
stderr) on Windows 7.  Works as expected on Windows 10.

Working backwards we found the issue first appears in Python 3.7.4rc1 and 
3.8.0b2 on Windows 7.  Earlier releases work as expected.

>>> import os
>>> os.dup(1)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [WinError 87] The parameter is incorrect
>>>

--
components: Extension Modules
messages: 347627
nosy: daveb
priority: normal
severity: normal
status: open
title: os.dup() fails for standard streams on Windows 7
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue37548] Document range of atan, acos and asin

2019-07-10 Thread Mark Dickinson


Change by Mark Dickinson :


--
keywords: +easy

___
Python tracker 

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



[issue37539] CheckCommitCursorReset regression sqlite3 test fails with old sqlite3

2019-07-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +paul.j3

___
Python tracker 

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



[issue37168] Decimal divisions sometimes 10x or 100x too large

2019-07-10 Thread Phil Frost


Phil Frost  added the comment:

Not yet. I had a hell of a time getting gdb to follow gunicorn forks so it 
would watch the workers but not also every other thing using popen or 
os.system(). And the lldb package on Alpine doesn't seem to work.

So we're currently in the process of testing a Debian container for production, 
hoping the issue just goes away. If not, I'll continue digging in with a 
debugger.

--
nosy: +Phil Frost2

___
Python tracker 

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



[issue35021] Assertion failures in datetimemodule.c.

2019-07-10 Thread Ned Deily


Ned Deily  added the comment:

Assuming answer to previous question is "no" -> closing

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



[issue37500] 3.8.0b2 no longer optimizes away "if 0:" ?

2019-07-10 Thread Ned Deily


Change by Ned Deily :


--
keywords:  -3.7regression
nosy:  -ned.deily

___
Python tracker 

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



[issue37544] Multiple test failures during build

2019-07-10 Thread Ned Deily


Ned Deily  added the comment:

And, if the unoptimized build succeeds, also try running the tests with it:

make test

--

___
Python tracker 

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



[issue37544] Multiple test failures during build

2019-07-10 Thread Ned Deily


Ned Deily  added the comment:

Sorry you are having problems.  Suggest first trying a clean build without 
--enable-optimizations.  If that works, please supply the output from:

./python -m test.pythoninfo

--
nosy: +ned.deily

___
Python tracker 

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



[issue37546] colors in ttk treeview tags are ignored

2019-07-10 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the report. The problem you are seeing here appears to be a 
duplicate of that described in Issue36468 which describes this behavior change 
as a regression in Tk and also suggests a workaround.

--
nosy: +ned.deily
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Treeview: wrong color change

___
Python tracker 

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



[issue37537] Compute allocated blocks in _Py_GetAllocatedBlocks()

2019-07-10 Thread Tim Peters


Change by Tim Peters :


--
nosy: +tim.peters

___
Python tracker 

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



[issue37543] Optimize pymalloc for non PGO build

2019-07-10 Thread Tim Peters


Change by Tim Peters :


--
nosy: +tim.peters

___
Python tracker 

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



[issue33408] Enable AF_UNIX support in Windows

2019-07-10 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue7946] Convoy effect with I/O bound threads and New GIL

2019-07-10 Thread Omer Katz


Omer Katz  added the comment:

FYI I can verify that the original benchmark is still valid on Python 3.7.3.
I'm running the client on an 8 core CPU.
The result is 30.702 seconds (341534.322 bytes/sec).

I'll need somebody to decide how we're going to fix this problem.
I can do the legwork.

--

___
Python tracker 

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



[issue37547] Add _PyObject_CallMethodOneArg()

2019-07-10 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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

___
Python tracker 

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



[issue37548] Document range of atan, acos and asin

2019-07-10 Thread Mark Dickinson


New submission from Mark Dickinson :

A small nice-to-have: it would be good to document the range of the inverse 
trigonometric functions `math.atan`, `math.asin` and `math.acos`, in both the 
docstrings and the built documentation.

There are standard "principal values" for each of these inverses, and Python is 
using these standard values, but that may not be obvious to a user.

--
assignee: docs@python
components: Documentation
messages: 347620
nosy: docs@python, mark.dickinson
priority: normal
severity: normal
status: open
title: Document range of atan, acos and asin
versions: Python 2.7, Python 3.7, Python 3.8

___
Python tracker 

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



[issue37531] Fix regrtest timeout for subprocesses: regrtest -jN --timeout=SECONDS

2019-07-10 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


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

___
Python tracker 

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



[issue34697] ctypes: Crash if manually-created CField instance is used

2019-07-10 Thread hai shi


Change by hai shi :


--
nosy:  -shihai1991

___
Python tracker 

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



[issue37547] Add _PyObject_CallMethodOneArg()

2019-07-10 Thread Jeroen Demeyer


New submission from Jeroen Demeyer :

We already have

_PyObject_CallNoArg()
_PyObject_CallOneArg()
_PyObject_CallMethodNoArgs()

so it makes sense to also add

_PyObject_CallMethodOneArg()

--
components: Interpreter Core
messages: 347619
nosy: inada.naoki, jdemeyer, vstinner
priority: normal
severity: normal
status: open
title: Add _PyObject_CallMethodOneArg()
type: performance
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



[issue37546] colors in ttk treeview tags are ignored

2019-07-10 Thread dave


New submission from dave :

The following example code fails in Python 3.7.3 64 bit (both lines are 
displayed in black).
It works correctly in 3.7.2 and earlier.

import tkinter as tk
import tkinter.ttk as ttk

root = tk.Tk()

ttk.Label(root, text='This is a RED label', foreground='red').pack()

tree = ttk.Treeview(root)
tree.tag_configure('RED_TAG', foreground='red', font=('arial', 12))
tree.insert('', tk.END, text='Black line')
tree.insert('', tk.END, text='Red line', tag='RED_TAG')
tree.pack()

root.mainloop()

--
components: Tkinter
messages: 347618
nosy: dave9000
priority: normal
severity: normal
status: open
title: colors in ttk treeview tags are ignored
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



[issue37151] Calling code cleanup after PEP 590

2019-07-10 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
pull_requests: +14490
pull_request: https://github.com/python/cpython/pull/14684

___
Python tracker 

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



[issue37542] UDP sendto() sends duplicate packets

2019-07-10 Thread Andy Papageorgiou


Change by Andy Papageorgiou :


--
type:  -> behavior

___
Python tracker 

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



[issue37545] Argparse Tutorial - unreasonable operators

2019-07-10 Thread Nathan Oyama


New submission from Nathan Oyama :

In "Python 3.7 Documentation > Python HOWTOs > Argparse Tutorial" 
(https://docs.python.org/3.7/howto/argparse.html), search this page for

elif args.verbosity >= 1:

The operator ">=" should read "==" because args.verbosity cannot be 2 or 
greater after the if statement.

You would find the original codes unreasonable until you go through "if 
args.verbosity >= 1:".

--
assignee: docs@python
components: Documentation
messages: 347617
nosy: Culip, docs@python
priority: normal
severity: normal
status: open
title: Argparse Tutorial - unreasonable operators
type: enhancement
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



[issue37543] Optimize pymalloc for non PGO build

2019-07-10 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue37544] Multiple test failures during build

2019-07-10 Thread Jarek Zgoda


New submission from Jarek Zgoda :

I'm trying to build Python-3.7.4 from release tarball.

Configure line: ./configure --prefix=/opt/python-3.7.4 --disable-shared  
--enable-optimizations

System: Ubuntu 18.04.2 amd64, 4.15.0-54-generic #58-Ubuntu SMP

Build fails.

--
components: Build
files: pgo_task_log.txt
messages: 347616
nosy: Jarek Zgoda
priority: normal
severity: normal
status: open
title: Multiple test failures during build
versions: Python 3.7
Added file: https://bugs.python.org/file48466/pgo_task_log.txt

___
Python tracker 

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



[issue29548] Recommend PyObject_Call* APIs over PyEval_Call*() APIs

2019-07-10 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
pull_requests: +14488
pull_request: https://github.com/python/cpython/pull/14683

___
Python tracker 

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



[issue37543] Optimize pymalloc for non PGO build

2019-07-10 Thread Inada Naoki


New submission from Inada Naoki :

When PGO is not used, compilers don't know which part is hot.

So gcc failed to inline hot code in pymalloc_alloc and pymalloc_free
into _PyObject_Malloc and _PyObject_Free.  For example, only this code is 
inlined into _PyObject_Malloc.

if (nbytes == 0) {
return 0;
}
if (nbytes > SMALL_REQUEST_THRESHOLD) {
return 0;
}

But the hottest part is taking memory block from freelist in the pool.
To optimize it,

* make pymalloc_alloc and pymalloc_free inline functions
* Split code for rare / slow paths out to new functions

In PR 14674, pymalloc is now as fast as mimalloc in spectral_norm benchmark.

  $ ./python bm_spectral_norm.py --compare-to=./python-master
  python-master: . 199 ms +- 1 ms
  python: . 176 ms +- 1 ms

  Mean +- std dev: [python-master] 199 ms +- 1 ms -> [python] 176 ms +- 1 ms: 
1.13x faster (-11%)

--
components: Interpreter Core
messages: 347615
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Optimize pymalloc for non PGO build
type: performance
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



[issue37484] Use PY_VECTORCALL_ARGUMENTS_OFFSET for __exit__

2019-07-10 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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



[issue37483] Add PyObject_CallOneArg()

2019-07-10 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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



[issue37542] UDP sendto() sends duplicate packets

2019-07-10 Thread Andy Papageorgiou

New submission from Andy Papageorgiou :

Wireshark reports two identical back to back packets sent for each sendto(), 
timing between packets is between 2 and 10us.

Note this is on a point to point ethernet (just 1 cable, no switches, routers 
or anything else in between) to an embedded platform (Zynq ARM) from an intel 
i7 Window 10 laptop from 2018. The python code is running on the laptop.

python code:
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
s.bind(('', 5704))
while(more_to_send == TRUE)

s.sendto(bytes_to_send, (HOST, UDP_PORT))
data = s.recv(1024)

Wireshark log.
43204   80.146000   192.168.1.20192.168.1.10UDP 566 5704 → 
5604 Len=524 (payload)
43205   80.146003   192.168.1.20192.168.1.10UDP 566 5704 → 
5604 Len=524 (duplicate at payload time + 3us)
43206   80.149112   192.168.1.10192.168.1.20UDP 48  5604 → 
5704 Len=6 (ack)
43207   80.149306   192.168.1.20192.168.1.10UDP 566 5704 → 
5604 Len=524 (payload)
43208   80.149311   192.168.1.20192.168.1.10UDP 566 5704 → 
5604 Len=524 (duplicate at payload time +5us)

I am suspicious this is an artefact of the point to point link.

--
components: Library (Lib)
messages: 347614
nosy: Andy Papageorgiou
priority: normal
severity: normal
status: open
title: UDP sendto() sends duplicate packets
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



[issue37538] Refactor zipfile to ease subclassing and enhancement

2019-07-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I did not read your code yet, but I think it is the right way.

If your btanch contains changes which you do not want to commit to CPython, but 
which makes the purpose of other changes clearer, you can create a PR against 
the master in your fork

--

___
Python tracker 

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



[issue37540] vectorcall: keyword names must be strings

2019-07-10 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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

___
Python tracker 

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



[issue37541] get_python_lib() returns incorrect path for site-packages

2019-07-10 Thread Saba Kauser


New submission from Saba Kauser :

HI,
I am using get_python_lib() to copy certain data files to site-pacakges 
location while installation of package ibm_db. I am using this function to 
execute a command as well on one of the shared library @package install 
location.
So far, I have faced issue with this function in:
virtual env, anaconda python and with pip cache enabled. 

The source can be found at: 
https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py#L242

When I run through debugger for python setup.py build command, I can see 
following:
(Pdb) p data_files
[('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./README.md']), 
('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./CHANGES']), 
('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./LICENSE']), 
('C:\\Users\\skauser\\Anaconda\\Lib\\site-packages', ['./config.py.sample'])]

However, in "python setup.py install", this folder structure is created:
C:\Users\skauser\Anaconda\Lib\site-packages\users\skauser\appdata\local\programs\python\python37\Lib
 and no data files are copied.

If I do : "pip install ." from source directory,
The data_files are copied under 
"c:\users\skauser\anaconda\lib\site-packages\users\skauser\anaconda\lib\site-packages"
 when the expectation is to have the files copied under 
"c:\users\skauser\anaconda\lib\site-packages".

Can you please look into this. 
Although this is not a serious problem for platforms other than mac, But on 
MAC, I am using this same function get_python_lib()to execute a system command 
and without this working properly, MAC users are unable to use the python 
ibm_db driver.

This is blocking! Please help.

--
components: Distutils
messages: 347612
nosy: dstufft, eric.araujo, sabakauser
priority: normal
severity: normal
status: open
title: get_python_lib() returns incorrect path for site-packages
type: behavior
versions: Python 2.7, 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



[issue37524] IDLE error on closing 3.8+ debug build

2019-07-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

One time after doing something unusual with IDLE (editing theme?, not sure) I 
did not get message on exit.  But next time, back again.

--

___
Python tracker 

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



[issue37517] Improve error messages for Windows reserved file names

2019-07-10 Thread Eryk Sun


Eryk Sun  added the comment:

> if the operation succeeds, no error/message is displayed

Some errors pass silently and may be confusing later on. For example, 
CreateDirectoryW calls NtCreateFile with the disposition FILE_CREATE and the 
option FILE_DIRECTORY_FILE (i.e. the call *must* create a new directory), but 
some non-filesystem devices ignore this and let the request succeed. For 
example:

>>> os.mkdir('C:/Temp/nul')
>>> os.mkdir('C:/Temp/conin$')

Both calls 'succeed' but don't actually create a directory:

>>> os.path.exists(r'\\?\C:\Temp\nul')
False
>>> os.path.exists(r'\\?\C:\Temp\conin$')
False

> either we need to search the string for the special names or find 
> an API that will clarify it

GetFullPathNameW is a library function that shares the implementation that's 
used to normalize paths in a create or open context. 

If the path does not start with \\?\, then we resolve it via GetFullPathNameW. 
If it becomes a device path, or if the final component changes (e.g. a trailing 
dot or space is removed), then we can parenthetically include the resolved 
path. For example:

os.stat('spam.'):

FileNotFoundError: [WinError 2] The system cannot find the file specified: 
'spam.' [resolved path: 'C:\\Temp\\spam']

os.startfile('con'):

OSError: [WinError 1200] The specified device name is invalid: 'con' 
[resolved path: '.\\con']

os.open('C:/Temp/lpt9', 0):

FileNotFoundError: [Errno 2] No such file or directory: 'C:/Temp/lpt9' 
[resolved path: '.\\lpt9']

For os.open() and open(), we should switch to using 
PyErr_SetExcFromWindowsErrWithFilenameObject instead of 
PyErr_SetFromErrnoWithFilenameObject. _doserrno is valid in this context, so we 
should be using it anyway to retain the more specific winerror value. Then we 
only have to special case reserved names in the Windows-only function 
PyErr_SetExcFromWindowsErrWithFilenameObjects.

--
keywords: +3.6regression

___
Python tracker 

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



[issue37538] Refactor zipfile to ease subclassing and enhancement

2019-07-10 Thread Daniel Hillier


Daniel Hillier  added the comment:

I've started a branch on my github fork if anyone wants to follow along.

https://github.com/danifus/cpython/tree/zipfile_refactor

Is there a better way to manage this in terms of review and suggestions as I 
add more commits?

--

___
Python tracker 

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



[issue37540] vectorcall: keyword names must be strings

2019-07-10 Thread Jeroen Demeyer


New submission from Jeroen Demeyer :

Keyword names in calls are expected to be strings, however it's currently not 
clear who should enforce/check this.

I suggest to fix this for vectorcall/METH_FASTCALL and specify that it's the 
caller's job to make sure that keyword names are strings (str subclasses are 
allowed).

--
components: Interpreter Core
messages: 347608
nosy: Mark.Shannon, jdemeyer, petr.viktorin, vstinner
priority: normal
severity: normal
status: open
title: vectorcall: keyword names must be strings
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



[issue37532] email.header.make_header() doesn't work if any `ascii` code is out of range(128)

2019-07-10 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

Changing everything to utf-8 breaks a lot of tests, so here a less invasive 
solution?

diff --git a/Lib/email/header.py b/Lib/email/header.py
index 4ab0032bc6..1e71eeae7f 100644
--- a/Lib/email/header.py
+++ b/Lib/email/header.py
@@ -136,7 +136,14 @@ def decode_header(header):
 last_word = last_charset = None
 for word, charset in decoded_words:
 if isinstance(word, str):
-word = bytes(word, 'raw-unicode-escape')
+word_tmp = bytes(word, 'raw-unicode-escape')
+input_charset = charset or 'us-ascii'
+try:
+_ = word_tmp.decode(input_charset, errors='strict')
+word = word_tmp
+except UnicodeDecodeError:
+word = str(word).encode('utf-8')
+charset = 'utf-8'
 if last_word is None:
 last_word = word
 last_charset = charset

--

___
Python tracker 

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



[issue37539] CheckCommitCursorReset regression sqlite3 test fails with old sqlite3

2019-07-10 Thread Matej Cepl


New submission from Matej Cepl :

When building Python 2.7.16 on very old SUSE Enterprise Linux (SLE-11), with 
gcc 4.3, sqlite3 3.6.4, CheckCommitCursorReset fails with:

test test_sqlite failed -- Traceback (most recent call last):
  File "/usr/src/packages/BUILD/Python-2.7.16/Lib/sqlite3/test/regression.py", 
line 338, in CheckCommitCursorReset
con.commit()
OperationalError: cannot commit transaction - SQL statements in progress

It seems to me the problem is that the select from 
https://github.com/python/cpython/blob/master/Lib/sqlite3/test/regression.py#L353
 is still open, while we run con.commit(). It should be probably better to 
store output of that enumerate somewhere and work on that variable instead.

--
components: Library (Lib)
files: log.txt
messages: 347606
nosy: mcepl
priority: normal
severity: normal
status: open
title: CheckCommitCursorReset regression sqlite3 test fails with old sqlite3
versions: Python 2.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48465/log.txt

___
Python tracker 

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



[issue36044] PROFILE_TASK for PGO build is not a good workload

2019-07-10 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

In my experience, people overthink what needs to go into a CPython profiling 
run.  Sure, our default PROFILE_TASK is rather unfortunate because it takes a 
very long time by including runs of super slow tests that won't meaningfully 
contribute profile data (multiprocessing, subprocess, concurrent_futures, heavy 
I/O, etc).

But despite somewhat popular belief, it is not actually a problem that the 
suite exercises other sides of branches, because by and large just by executing 
Python code at all and exercising C extension module code, it still acts like 
most any Python program and spends most of the time on the common critical 
paths - regardless tests that trigger specific number of executions of other 
paths.  Those executions pale in comparison to the ordinary ones in anywhere 
critical.

I don't recommend making any claim about something "harming" the profile 
without reliable data to prove it.

Feel free to tune what test.regrtest --pgo enables or disables by default.  But 
try to do it in a scientific data based manner rather than guessing.  
Decreasing the total wall time for a default --enable-optimizations build would 
be a good thing for everyone, provided the resulting interpreter remains 
"effectively similar" in speed.  If you somehow manage to find something that 
actually speeds up the resulting interpreter, amazing!

https://github.com/python/pyperformance is your friend for real world 
performance measurement.  Patience is key.  The builds and benchmark runs are 
slow.

One thing --enable-optimizations does _not_ do today is enable link time 
optimization by default.  Various toolchain+platform versions were having 
problems successfully generating a working interpreter with LTO enabled.  If 
you want a potential large speed up in the interpreter, figuring out how to get 
link time optimization on top of the existing PGO working reliably, detecting 
when toolchains+platform combos where it will be reliable, and enabling it by 
default on such systems is _likely_ the largest possible gain still to be had.

--
components: +Build
nosy: +gregory.p.smith
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



[issue37538] Refactor zipfile to ease subclassing and enhancement

2019-07-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue37538] Refactor zipfile to ease subclassing and enhancement

2019-07-10 Thread Daniel Hillier


New submission from Daniel Hillier :

I've written https://github.com/danifus/pyzipper which incorporates a
refactor of zipfile.py in order to support winzip AES encryption. I don't
intend to include the crypto code but I would like to incorporate the
refactor to help others subclass and extend the objects found in zipfile.py


For a longer description of the general approach I've taken to the refactor,
see the python-ideas thread:
https://mail.python.org/archives/list/python-id...@python.org/thread/QCKHI5JYMKOPMIF6Q2NI7JIFHV6KO746/#QCKHI5JYMKOPMIF6Q2NI7JIFHV6KO746

--
components: Library (Lib)
messages: 347604
nosy: dhillier
priority: normal
severity: normal
status: open
title: Refactor zipfile to ease subclassing and enhancement
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



[issue37537] Compute allocated blocks in _Py_GetAllocatedBlocks()

2019-07-10 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

PyPerformance result, using --enable-optimizations

+-+-+--+
| Benchmark   | base| no-allocated |
+=+=+==+
| 2to3| 388 ms  | 385 ms: 1.01x faster (-1%)   |
+-+-+--+
| dulwich_log | 91.8 ms | 92.8 ms: 1.01x slower (+1%)  |
+-+-+--+
| go  | 302 ms  | 296 ms: 1.02x faster (-2%)   |
+-+-+--+
| hexiom  | 11.4 ms | 11.5 ms: 1.01x slower (+1%)  |
+-+-+--+
| json_dumps  | 14.0 ms | 13.7 ms: 1.02x faster (-2%)  |
+-+-+--+
| logging_format  | 12.1 us | 11.9 us: 1.02x faster (-2%)  |
+-+-+--+
| logging_simple  | 10.9 us | 10.6 us: 1.02x faster (-2%)  |
+-+-+--+
| pickle_dict | 23.6 us | 21.3 us: 1.11x faster (-10%) |
+-+-+--+
| pidigits| 208 ms  | 210 ms: 1.01x slower (+1%)   |
+-+-+--+
| python_startup  | 9.73 ms | 9.66 ms: 1.01x faster (-1%)  |
+-+-+--+
| python_startup_no_site  | 6.70 ms | 6.66 ms: 1.01x faster (-1%)  |
+-+-+--+
| regex_dna   | 199 ms  | 195 ms: 1.02x faster (-2%)   |
+-+-+--+
| regex_effbot| 3.18 ms | 3.14 ms: 1.01x faster (-1%)  |
+-+-+--+
| regex_v8| 25.0 ms | 24.4 ms: 1.02x faster (-2%)  |
+-+-+--+
| scimark_fft | 421 ms  | 426 ms: 1.01x slower (+1%)   |
+-+-+--+
| scimark_sor | 220 ms  | 223 ms: 1.01x slower (+1%)   |
+-+-+--+
| scimark_sparse_mat_mult | 5.18 ms | 5.33 ms: 1.03x slower (+3%)  |
+-+-+--+
| spectral_norm   | 159 ms  | 156 ms: 1.02x faster (-2%)   |
+-+-+--+
| unpickle| 14.6 us | 14.2 us: 1.02x faster (-2%)  |
+-+-+--+
| unpickle_list   | 4.46 us | 4.33 us: 1.03x faster (-3%)  |
+-+-+--+
| xml_etree_iterparse | 141 ms  | 139 ms: 1.01x faster (-1%)   |
+-+-+--+

Not significant (36): chaos; crypto_pyaes; deltablue; django_template; 
fannkuch; float; html5lib; json_loads; logging_silent; mako; meteor_contest; 
nbody; nqueens; pathlib; pickle; pickle_list; pickle_pure_python; raytrace; 
regex_compile; richards; scimark_lu; scimark_monte_carlo; 
sqlalchemy_declarative; sqlalchemy_imperative; sqlite_synth; sympy_expand; 
sympy_integrate; sympy_sum; sympy_str; telco; tornado_http; unpack_sequence; 
unpickle_pure_python; xml_etree_parse; xml_etree_generate; xml_etree_process

--
stage: patch review -> 

___
Python tracker 

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



[issue37537] Compute allocated blocks in _Py_GetAllocatedBlocks()

2019-07-10 Thread Neil Schemenauer


Change by Neil Schemenauer :


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

___
Python tracker 

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



[issue37537] Compute allocated blocks in _Py_GetAllocatedBlocks()

2019-07-10 Thread Neil Schemenauer


New submission from Neil Schemenauer :

This is a small but measurable optimization for _PyObject_Malloc and 
_PyObject_Free.  It slows down _Py_GetAllocatedBlocks a bit but I think that's 
a price worth paying.

--
components: Interpreter Core
messages: 347602
nosy: nascheme
priority: normal
severity: normal
status: open
title: Compute allocated blocks in _Py_GetAllocatedBlocks()

___
Python tracker 

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