[issue31452] asyncio.gather does not cancel tasks if one fails

2017-09-21 Thread Yury Selivanov

Yury Selivanov added the comment:

> I'm afraid I no longer have all the details of this design in my head, and I 
> have no idea what the fix does (and no time to read up on everything).

Let's say we have three tasks: t1, t2, t3.  Then we use gather on them:

   await gather(t1, t2, t3)

Let's say that t2 finishes first with an exception.

Currently, both t1 and t3 would continue their execution even though gather 
throws the t2 exception.

The PR for this issue makes 'gather' to cancel both t1 and t3 as soon as t2 
throws an exception.

The question is: I see the point of the PR, but I'm afraid that it's too late 
to change the semantics of asyncio.gather.  Instead we should consider adding 
new TaskGroup API (we discussed it briefly on the sprint).

--

___
Python tracker 

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



[issue31550] Inconsistent error message for TypeError with subscripting

2017-09-21 Thread Anthony Sottile

Changes by Anthony Sottile :


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

___
Python tracker 

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



[issue31550] Inconsistent error message for TypeError with subscripting

2017-09-21 Thread Anthony Sottile

New submission from Anthony Sottile:

There's a bit of history I don't understand and couldn't find the appropriate 
trail for.

The original error message from the 2.6 era:

$ python2.6 -c 0[0]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object is unsubscriptable


This was changed in 
https://github.com/python/cpython/commit/f5fd5239819c5dfb1d7a33484be49dc705544d02
 for clarity

As seen in 2.7.1

$ ./python2.7.1 -c 0[0]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object is not subscriptable


It was later changed in the 2.7 era here: 
https://github.com/python/cpython/commit/7d1483cbadbe48620964348a2039690624e7dc8e


To this error message (as demonstrated with 2.7.12):

$ python2.7 -c 0[0]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object has no attribute '__getitem__'


However, this patch never made it into the 3.x branch:

$ python3.6 -c 0[0]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object is not subscriptable


Should this patch be (have been) cherry picked into master?

--
components: Interpreter Core
messages: 302736
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: Inconsistent error message for TypeError with subscripting
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



[issue31452] asyncio.gather does not cancel tasks if one fails

2017-09-21 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm afraid I no longer have all the details of this design in my head, and I 
have no idea what the fix does (and no time to read up on everything).

The OP says "If you do not await gather" -- what happens if you *do* await it? 
Do the tasks then get killed?

It seems strange to both cancel the task *and* set its exception.

The docstring for gather() seems to be pretty clear that cancellation and 
failure of one task should not affect other tasks. So this argues against the 
PR.

--

___
Python tracker 

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



[issue31092] multiprocessing.Manager() race condition

2017-09-21 Thread Prof Plum

Changes by Prof Plum :


--
title: Potential multiprocessing.Manager() race condition -> 
multiprocessing.Manager() race condition

___
Python tracker 

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



[issue31544] gettext.Catalog title is not flagged as a class

2017-09-21 Thread Éric Araujo

Éric Araujo added the comment:

Are you talking about 
https://docs.python.org/3/library/gettext.html#the-catalog-constructor ?  I 
think the lack of markup is on purpose, since the text explains that this is a 
compatibility measure (mostly obsolete nowadays).

For future bug reports, please include links or screenshots!  They make it 
easier to communicate.

--
nosy: +merwok
versions:  -Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

These slots are the only slots that accept keyword arguments and arbitrary 
number of positional parameters. Other slots can use fast calls.

--

___
Python tracker 

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



[issue31549] test_strptime and test_time fail on non-English Windows

2017-09-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

test_strptime and test_time fail on non-English Windows.

For example:

==
FAIL: test_localtime_timezone (test.test_time.TestPytime)
--
Traceback (most recent call last):
  File "C:\Users\Serhiy Storchaka\py\cpython\lib\test\test_time.py", line 643, 
in test_localtime_timezone
self.assertEqual(lt.tm_zone, time.tzname[lt.tm_isdst])
AssertionError: 'O?ieyia?y (e?oi)' != '\xd4\xb3\xed\xeb\xff\xed\xe4\xb3\xff 
(\xeb\xb3\xf2\xee)'
- O?ieyia?y (e?oi)
+ \xd4\xb3\xed\xeb\xff\xed\xe4\xb3\xff (\xeb\xb3\xf2\xee)

Seems there are problems with wrong encodings and lossy encoding on Windows.

>>> '\xd4\xb3\xed\xeb\xff\xed\xe4\xb3\xff (\xeb\xb3\xf2\xee)'
'Ô³íëÿíä³ÿ (ë³òî)'

Looks similar to the string 'O?ieyia?y (e?oi)', isn't?

>>> 'ô³íëÿíä³ÿ (çèìà)'.encode('latin1').decode('cp1251')
'фінляндія (зима)'

Actually it is a string 'фінляндія (зима)' ('Finland (Summer)' in Ukrainian) 
encoded with cp1251 (Cyrillic ANSI encoding) and misinterpreted as encoded with 
Latin1.

--
components: Library (Lib), Windows
messages: 302732
nosy: paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: test_strptime and test_time fail on non-English Windows
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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Yury Selivanov

Yury Selivanov added the comment:

> The performance issue was that the asyncio core loop was running in a loop
but did nothing because of time rounding. When the next event was in a few
nanoseconds, the e event burnt the CPU during  seconds.
It can be 15 ms on Windows or 1 ms when using poll() for example. It's not
just clock resolution, also the resolution of the selector.

Hm.  I glanced through the issues you linked, and it looks like it's a valid 
concern for a micro-benchmark.  But I don't see how a performance of a 
real-world application can be affected here.  IOW, the "self.time() + 
self._clock_resolution" line looks like an optimization for a particular 
micro-benchmark.  I'm sure we can construct another micro-benchmark that would 
benefit from "self.time() - self._clock_resolution".

I think we should value correctness more than micro-benchmarks.

--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Issues:
- bpo-20320
- bpo-20452
- bpo-20505
- bpo-20311

The performance issue was that the asyncio core loop was running in a loop
but did nothing because of time rounding. When the next event was in a few
nanoseconds, the e event burnt the CPU during  seconds.
It can be 15 ms on Windows or 1 ms when using poll() for example. It's not
just clock resolution, also the resolution of the selector.

Hopefully, select and selectors now round towards +inf (rather than
rounding down, towards zero or -inf) and so the selector resolution is no
more an issue if I recall correctly.

--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Yury Selivanov

Yury Selivanov added the comment:

So here's the relevant piece of code:

end_time = self.time() + self._clock_resolution
while self._scheduled:
handle = self._scheduled[0]
if handle._when >= end_time:
break
handle = heapq.heappop(self._scheduled)
handle._scheduled = False
self._ready.append(handle)


As I see it, currently we peek into the future time.  Why don't we do 

end_time = self.time() - self._clock_resolution

to guarantee that timeouts will always be triggered *after* the requested time, 
not before?  I don't see how the performance can become worse if we do this.

--

___
Python tracker 

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



[issue31548] test_os fails on Windows if current directory contains spaces

2017-09-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

I just have built Python on Windows first time and ran tests. test_os fails 
because the current directory path contains spaces.

test_spawnl (test.test_os.SpawnTests) ... C:\Users\Serhiy: can't open file 
'Storchaka\py\cpython\PCBuild\win32\python.exe': [Errno 2] No such file or 
directory
FAIL

--
components: Tests, Windows
files: test_os.log
messages: 302728
nosy: paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: test_os fails on Windows if current directory contains spaces
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file47163/test_os.log

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 21/09/2017 à 23:31, STINNER Victor a écrit :
> 
> Yury: asyncio can trigger events earlier than scheduled for performance
> reasons.

If that's true, then it sounds like a bug.  If there is a rationale for
a "fast and imprecise" API, then it would seem ok to add such an API.
But the default API for event scheduling should not take such shortcuts
IMHO.  Most users don't schedule thousands of events at a time, however
they expect timeouts to be observed as rigorously as is possible given
the usual implementation constraints such as GC pauses.

--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

IMHO we should either just close the issue, ir document the bad clock
resolution on Windows in the asyncio doc.

Yury: asyncio can trigger events earlier than scheduled for performance
reasons. See end_time in asyncio core loop.

--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Yury Selivanov

Yury Selivanov added the comment:

> it's expected that the sleep time may be *more* than asked for, but not less 
> than.

Exactly, and asyncio tries to ensure that.  It looks like 
"time.get_clock_info('monotonic').resolution" lies about monotonic clock 
resolution on Windows so that might be the actual issue we want to address.

--

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

The most complex slots are __new__, __init__ and __call__ because they
accept keywords. It's hard to design a calling convention which optimize
all cases because of the backward compatibility. The risk is to convert a
dict to args + kwnames (tuple) and then back to a dict: two expensive and
useless conversions.

It's my 3rd or 4th attempt to optimize new/init/call :-) My previous
attempt was to add new tp_fastXXX slots to types, but again thr backward
compatibilty was a major pain.
https://bugs.python.org/issue29358

Here the scope is much small and backward compatibilty shouldn't affect us.

I will try to find a way to optimize these slots as well and complete my
patch.

--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't think the bug is about real time here, rather about minimal sleep time 
expectations; i.e. it's expected that the sleep time may be *more* than asked 
for, but not less than.

(and I would share that expectation myself)

--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Technically, asyncii cannot wait exactly 100 ms on Windows. It will be more
likely a sleep between 100-15 ms and 100+15 ms. Real time is really a
complex topic. CPython with its stop-the-world garbage collector are not
designed for real time.

--

___
Python tracker 

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



[issue26103] Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The only question is remained -- should *data descriptors* be *descriptors*? 
I.e. is the __get__ method required for data descriptors?

--

___
Python tracker 

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



[issue31452] asyncio.gather does not cancel tasks if one fails

2017-09-21 Thread Yury Selivanov

Yury Selivanov added the comment:

I looked at the PR, and I'm not so sure about this change.  In short, it can be 
viewed as a backwards incompatible change to asyncio.gather.

Guido, what do you think?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue31153] Update docstrings of itertools functions

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

For groupby() see also issue27385.

--

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping. Can you make your decision Raymond?

This issue is a stopper for issue30347 which fixes a crash. I don't want to 
merge the fix for issue30347 until this issue be solved, because both proposed 
PRs solve issue30347 too, and I don't want to make unneeded changes or move 
code forth and back.

--

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This seems like a straight-forward win.  I don't think we really need to see 
microbenchmarks before going forward with this one.

--
nosy: +rhettinger

___
Python tracker 

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



[issue1612262] Class Browser doesn't show internal classes

2017-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am revising the codecontext patch to use comprehensions and the sort key 
option.  I will rename the new function 'collect_objects' (GPolo) / 
'_traverse_node' (CSabella) as 'list_children' and have it return the 
name-object list, ordered by line number, needed by the tree widget.

[The input is a dictionary of children of a node, rather than a node, because 
pyclbr returns the dictionary of the children of the root module node of the 
tree, rather than a root node itself.  Sorting is not actually needed for 3.6/7 
because the dicts are already ordered, but pyclbr does not guarantee this by 
using OrderedDict.  Proposing these two changes is a separate potential issue.]

--

___
Python tracker 

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



[issue27099] IDLE: turn built-in extensions into regular modules

2017-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Two of the TODOs already listed, and 2 more found in review, have been done.  
With these additions, I felt IDLE was ready for the 3.6.3rc1 and 3.7.0a1 
releases last Monday.

#31502 Fix problem with deleting user themes and keysets.
#31480 Disable ZzDummy by default, change tests to match.
#31477 Improve rstrip entry in IDLE doc.
#31488 Make non-key options take affect immediately.  (Parenmatch required 
revision for this to happen for its option in existing windows.  The options 
were previously 'baked in' in the __init__ method.)

The following remaining to be done:
Grey-out code context toggle on non-editor windows.
#31547 Write augmented user keysets back to file.
Call each event_add(pseudoevent, sequence) just once.
Re-evaluate some of options.

--

___
Python tracker 

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



[issue31288] IDLE tests: don't modify tkinter.messagebox.

2017-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Make sure to return result of messagebox calls, as did in #31287, fixed in 
#31502.

--

___
Python tracker 

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



[issue31443] Possibly out of date C extension documentation

2017-09-21 Thread Stefan Krah

Stefan Krah added the comment:

In fact, building _decimal should also fail on Cygwin if this
were still an issue.

--

___
Python tracker 

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



[issue31547] IDLE: Save definitions added to user keysets

2017-09-21 Thread Terry J. Reedy

New submission from Terry J. Reedy:

User keysets are saved as a complete keyset, but users could edit the file and 
delete event-sequence pairs or add an incomplete set.  When a keyset is used, 
default pairs are added for any that are missing, if the pair does not conflict 
with existing pairs.

When extensions were converted to features #27099, 8 new pairs were added to 
the 'complete' set.  All user keyset are missing these pairs.  I expect that 
other pairs will be added in the future.  I propose that augmented keysets 
should be written back to the file, with notice to the user.

Detail: check when read or when used?  All keysets are written, so fix all?

--
assignee: terry.reedy
components: IDLE
messages: 302712
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: Save definitions added to user keysets
type: enhancement
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue31443] Possibly out of date C extension documentation

2017-09-21 Thread Stefan Krah

Stefan Krah added the comment:

Erik, if you are interested in Cygwin, could you please check that xxmodule.c 
builds on Cygwin with the patch?  You need to uncomment
a couple of lines in setup.py to build 'xx'.

--

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It optimizes the same cases as bpo-31410. bpo-31410 removed a half of the 
overhead for wrapper descriptors, Victor's patch removes the remaining half. 
Actually it makes calling the descriptor faster than calling the corresponding 
builtin! But bpo-31410 changes were simple, just few lines, and PR 3685 looks 
much more complex.

Are non-fast wrappers still needed? If the patch replaces the code instead of 
adding it this would decrease its cost. AFAIK the only descriptors that should 
support non-fast calling convention are __new__, __init__ and __call__.

As for practicality, this change should slightly speed up the code that 
directly calls __eq__, __lt__. For example classes decorated with 
total_ordering. Victor, can you provide microbenchmarks with more practical 
code?

--

___
Python tracker 

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



[issue31443] Possibly out of date C extension documentation

2017-09-21 Thread Stefan Krah

Changes by Stefan Krah :


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

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

> I don't know. What's the point of optimizing `array.array.__len__(obj)`? 
> People usually call `len(obj)` for that...

Right, type.method(self) is less than common than self.method().

I looked at the stdlib. I found that the following method are called using 
wrapper descriptors:

* object.__repr__(self)
* object.__getattribute__(self, name)
* _asyncio.Future.__del__(self)
* int.__str__(obj)
* etc.

But it seems like such calls are rare compared to other kinds of function calls.

--

By the way, _PyMethodDescr_FastCallKeywords() is only called from 
call_function() in Python/ceval.c. It's not used in Objects/call.c. Maybe we 
should use it there as well? It seems like this is a question about tracing. 
But maybe we can copy/paste the code from call_function()?

--

___
Python tracker 

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2017-09-21 Thread Steve Dower

Steve Dower added the comment:

(Belongs inside Parser/myreadline.c in the _PyOS_WindowsConsoleReadline 
function)

--

___
Python tracker 

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



[issue31493] IDLE cond context: fix code update and font update timers

2017-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The underlying issue is trying to coordinate two somewhat independent object 
systems (Python and Tcl).  I don't know why the after loops were (apparently) 
stopped before #27099 and not after.  The only difference I know of is the 
dropping of the reference to CodeContext instances in .unload_extensions, 
called from ._close.  CodeContext did not have a .close method.

I tried the first thing I thought might work and it did, so I stopped.  I don't 
know why unbinding the toggle function was enough.  I expect that we will 
eventually review ._close.  It should help when the menu and editor are 
separated a bit.

--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Mikhail Gerasimov

Mikhail Gerasimov added the comment:

STINNER Victor, thanks for explanation!

I don't know if this issue has practical disadvantages, but such behavior seems 
to be confusing, especially, since it can be reproduced with event_loop.time() 
and asyncio doc says nothing about resolution -
https://docs.python.org/3/library/asyncio-eventloop.html#delayed-calls

Do you think this issue should be closed?
Should I make PR to add info about clock's resolution to asyncio documentation?

--

___
Python tracker 

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2017-09-21 Thread Steve Dower

Steve Dower added the comment:

You're right, we're missing this section of code:

if (PyOS_InputHook != NULL)
(void)(PyOS_InputHook)();

Since we just call it and ignore anything it does, it should be safe enough to 
add it immediately before the ReadConsoleW call (inside the loop).

--

___
Python tracker 

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



[issue31529] IDLE: Add docstrings and tests for editor.py reload functions

2017-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A good start, and big enough as it is, for the next big revision project ;-).

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2017-09-21 Thread Lam Yuen Hei

Lam Yuen Hei added the comment:

Attach python 3.6 call stack of the test script

--
Added file: https://bugs.python.org/file47162/py36_call_stack.png

___
Python tracker 

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2017-09-21 Thread Lam Yuen Hei

Lam Yuen Hei added the comment:

Attach python 3.5 call stack of the test script

--
Added file: https://bugs.python.org/file47161/py35_call_stack.png

___
Python tracker 

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



[issue31545] Fixing documentation for timedelta.

2017-09-21 Thread Utkarsh Upadhyay

Changes by Utkarsh Upadhyay :


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

___
Python tracker 

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2017-09-21 Thread Lam Yuen Hei

New submission from Lam Yuen Hei:

Since python 3.6, PyOS_InputHook is not called when waiting for IO in Windows.

This causes issues with GUI framework like tkinter that relys on PyOS_InputHook 
to handle user interaction.

I attached a test script. When running the script with python 3.5, the tkinter 
window will show up properly. But if you run the script with python 3.6, the 
tkinter window will be frozen. 

I believe the issue is introduced in commit 3929499. In commit 3929499, 
_PyOS_WindowsConsoleReadline is added as the new Windows implementation of 
PyOS_StdioReadline. Originally, PyOS_StdioReadline calls my_fgets to read 
input, and my_fgets will call PyOS_InputHook before the calling the real fgets. 
However, _PyOS_WindowsConsoleReadline calls ReadConsoleW instead of my_fgets to 
read input, and PyOS_InputHook is never called.

The bug is first reported in matplotlib.
https://github.com/matplotlib/matplotlib/issues/9206#issuecomment-331192016

--
components: Windows
files: test_tk.py
messages: 302701
nosy: paul.moore, steve.dower, tim.golden, yhlam, zach.ware
priority: normal
severity: normal
status: open
title: PyOS_InputHook is not called when waiting for input() in Windows
type: behavior
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file47160/test_tk.py

___
Python tracker 

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



[issue30302] Improve .__repr__ implementation for datetime.timedelta

2017-09-21 Thread Utkarsh Upadhyay

Changes by Utkarsh Upadhyay :


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

___
Python tracker 

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



[issue31545] Fixing documentation for timedelta.

2017-09-21 Thread Utkarsh Upadhyay

New submission from Utkarsh Upadhyay:

There are some instances in the documentation of datetime where the repr of 
timedelta is mentioned, which was changed in bpo-30302.


Am making a PR shortly to address them.

--
assignee: docs@python
components: Documentation
messages: 302700
nosy: docs@python, musically_ut
priority: normal
severity: normal
status: open
title: Fixing documentation for timedelta.
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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Clocks is a very complex topic, especially when you care of portability. See my 
PEP 418.

asyncio uses time.monotonic() clock to not be impacted when the system clock 
("wall clock") is updated by the administrator or automatically by NTP.

On Windows, time.monotonic() is implemented with GetTickCount64() which has a 
bad resolution: around 15 ms. The exact resolution depends on the hardware.

See my PEP 418 which added time.monotonic() for Python 3.3 for much more 
information:
https://www.python.org/dev/peps/pep-0418/#monotonic-clocks

To get the clock resolution, use:

>>> import time; print(time.get_clock_info('monotonic'))

Example on Linux:

>>> import time; print(time.get_clock_info('monotonic'))
namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', 
monotonic=True, resolution=1e-09)

Well, the announced resolution is 1 nanosecond, but in practice it's more 
around 500 ns. At least, it's better than 15 ms :-)

--

asyncio rounds timings using the clock resolution, 
time.get_clock_info('monotonic').resolution. Search for self._clock_resolution 
in Lib/asyncio/base_events.py.

asyncio is not designed for real time.

--
nosy: +haypo

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

AFAIR the Windows clock has a 15ms granularity, so I'm not really surprised. In 
other words, I don't think `asyncio.sleep` sleeps less than expected, but that 
it's the imprecision of time.time() which gives you that impression.

What happens if you replace `time.time()` with `time.perf_counter()` in the 
code above?

--
nosy: +pitrou

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> First I would like to know if it's worth it

I don't know. What's the point of optimizing `array.array.__len__(obj)`? People 
usually call `len(obj)` for that...

--
nosy: +pitrou

___
Python tracker 

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



[issue31544] gettext.Catalog title is not flagged as a class

2017-09-21 Thread linkid

New submission from linkid:

In the ``gettext`` documentatino, in the title about the ``Catalog`` 
constructor, ``Catalog`` is not flagged as a class.

--
assignee: docs@python
components: Documentation
messages: 302696
nosy: docs@python, linkid
priority: normal
severity: normal
status: open
title: gettext.Catalog title is not flagged as a class
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31500] IDLE: Tiny font on HiDPI display

2017-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 0c4997f1919d8583353b12537a63dcbe7b9d280f by Terry Jan Reedy in 
branch '3.6':
[3.6] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639) (#3686)
https://github.com/python/cpython/commit/0c4997f1919d8583353b12537a63dcbe7b9d280f


--

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-09-21 Thread Henk-Jaap Wagenaar

Henk-Jaap Wagenaar added the comment:

@serhiy.storchaka: review done.

--
nosy: +Henk-Jaap Wagenaar

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread R. David Murray

R. David Murray added the comment:

I can't reproduce this on a linux VM with 3.7 tip.  I don't currently have a 
windows instance to test against.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue31500] IDLE: Tiny font on HiDPI display

2017-09-21 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +3675

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue31543] Optimize wrapper descriptors using FASTCALL

2017-09-21 Thread STINNER Victor

New submission from STINNER Victor:

Attached pull request adds a fastpath for wrapper descriptors to use the 
FASTCALL calling convention. It's a follow up of bpo-31410 and all my work on 
FASTCALL during Python 3.6 and 3.7 development cycles.

Microbenchmark:

./python -m perf timeit -s 'import array; obj=array.array("b"); 
wrap=array.array.__len__' 'wrap(obj)'

Result:

haypo@selma$ ./python -m perf compare_to ref.json patch.json 
Mean +- std dev: [ref] 59.2 ns +- 0.6 ns -> [patch] 28.2 ns +- 0.9 ns: 2.10x 
faster (-52%)

It removes 31 nanoseconds on such very fast C function, array_length().

Attached PR is still a work-in-progress. First I would like to know if it's 
worth it because working on polishing the actual code.

--
components: Interpreter Core
messages: 302692
nosy: haypo, inada.naoki, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize wrapper descriptors using FASTCALL
type: performance
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



[issue27541] Repr of collection's subclasses

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

> Because reprs of Python implementations of collection use a bare __name__.

Ah, maybe this module should be updated to use qualified name with the name in 
repr()?

> __qualname__ is used only in combination with __module__.

I was thinking at module.qualname, right.

--

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Because reprs of Python implementations of collection use a bare __name__.

__qualname__ is used only in combination with __module__. Using a single 
__qualname__ can be confused: foo.bar looks as a name bar in the module foo. 
Whether in reprs and error messages either full qualified name is used 
("{cls.__module__}.{__qualname__}") or a bare __name__. If a displayed name 
contains a dot it is always a full qualified name.

--

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Why using type.__name__ rather than type.__qualname__?

--
nosy: +haypo

___
Python tracker 

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



[issue31410] int.__repr__() is slower than repr()

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Oh, nice optimization!

I see that you reused the _PyMethodDef_RawFastCallDict() function that I added 
exactly for the same reason: prevent the creation of a temporary C function 
only created for a single call and then destroyed.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Raymond.

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



[issue31410] int.__repr__() is slower than repr()

2017-09-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could anyone please make review of the documentation?

--

___
Python tracker 

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



[issue31410] int.__repr__() is slower than repr()

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 5e02c7826f9797fb3add79b608ef51f7a62b3e5a by Serhiy Storchaka in 
branch 'master':
bpo-31410: Optimized calling wrapper and classmethod descriptors. (#3481)
https://github.com/python/cpython/commit/5e02c7826f9797fb3add79b608ef51f7a62b3e5a


--

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset b3a77964ea89a488fc0e920e3db6d8477279f19b by Serhiy Storchaka in 
branch 'master':
bpo-27541: Reprs of subclasses of some classes now contain actual type name. 
(#3631)
https://github.com/python/cpython/commit/b3a77964ea89a488fc0e920e3db6d8477279f19b


--

___
Python tracker 

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



[issue31180] test_multiprocessing_spawn hangs randomly

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Same issue on PPC64LE Fedora 3.x:

http://buildbot.python.org/all/builders/PPC64LE%20Fedora%203.x/builds/1406/steps/test/logs/stdio

--
title: test_multiprocessing_spawn hangs randomly on x86 Windows7 3.6 and AMD64 
FreeBSD 10.x Shared 3.x -> test_multiprocessing_spawn hangs randomly

___
Python tracker 

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



[issue31376] test_multiprocessing_spawn randomly hangs AMD64 FreeBSD 10.x Shared 3.x

2017-09-21 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue5885] uuid.uuid1() is too slow

2017-09-21 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3673

___
Python tracker 

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



[issue31538] mailbox does not treat external factories the same

2017-09-21 Thread Henk-Jaap Wagenaar

Henk-Jaap Wagenaar added the comment:

To me the documentation doesn't quite look right, in the case of no factory 
being passed, it runs:

def __getitem__(self, key):
"""Return the keyed message; raise KeyError if it doesn't exist."""
if not self._factory:
return self.get_message(key)
else:
return self._factory(self.get_file(key))

from the Mailbox base class. The get_message is thus:

def get_message(self, key):
"""Return a Message representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
from_line = self._file.readline().replace(linesep, b'')
string = self._file.read(stop - self._file.tell())
msg = self._message_factory(string.replace(linesep, b'\n'))
msg.set_from(from_line[5:].decode('ascii'))
return msg

where self._message_factory is set to mailbox.mboxMessage.

I am not familiar with this module, so am unsure whether the documentation is 
ill-worded or it is a bug.

--
nosy: +Henk-Jaap Wagenaar

___
Python tracker 

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



[issue31510] test_many_processes() of test_multiprocessing_spawn failed on x86-64 Sierra 3.x

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

test_many_processes() is made in two steps. The bug occurs at the second step 
which calls proc.terminate() on processes. Code of the test:

@classmethod
def _sleep_some(cls):
time.sleep(100)

@classmethod
def _test_sleep(cls, delay):
time.sleep(delay)

def test_many_processes(self):
if self.TYPE == 'threads':
self.skipTest('test not appropriate for {}'.format(self.TYPE))

sm = multiprocessing.get_start_method()
N = 5 if sm == 'spawn' else 100

# Try to overwhelm the forkserver loop with events
procs = [self.Process(target=self._test_sleep, args=(0.01,))
 for i in range(N)]
for p in procs:
p.start()
for p in procs:
join_process(p)
for p in procs:
self.assertEqual(p.exitcode, 0)

procs = [self.Process(target=self._sleep_some)
 for i in range(N)]
for p in procs:
p.start()
time.sleep(0.001)  # let the children start...
for p in procs:
p.terminate()
for p in procs:
join_process(p)
if os.name != 'nt':
for p in procs:
self.assertEqual(p.exitcode, -signal.SIGTERM) # <--- HERE

I'm not sure about the "time.sleep(0.001)  # let the children start...". It 
looks like a weak synchronization. Maybe if the system is heavily loaded, the 
signal is sent before Python registered signal handlers? 1 ms seems short to 
start Python. On my Linux laptop, it's closer to 15 ms.

--

___
Python tracker 

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



[issue31510] test_many_processes() of test_multiprocessing_spawn failed on x86-64 Sierra 3.x

2017-09-21 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +pitrou

___
Python tracker 

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



[issue31510] test_many_processes() of test_multiprocessing_spawn failed on x86-64 Sierra 3.x

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

test_many_processes() test was added by Antoine Pitrou in bpo-30589. This test 
was mentionned in bpo-30703.

--

___
Python tracker 

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



[issue31351] ensurepip discards pip's return code which leads to broken venvs

2017-09-21 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3672
stage: commit review -> patch review

___
Python tracker 

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



[issue31351] ensurepip discards pip's return code which leads to broken venvs

2017-09-21 Thread Nick Coghlan

Nick Coghlan added the comment:


New changeset 9adda0cdf89432386b7a0a6199b580d287a1 by Nick Coghlan (Igor 
Filatov) in branch 'master':
bpo-31351: Set return code in ensurepip when pip fails (GH-3626)
https://github.com/python/cpython/commit/9adda0cdf89432386b7a0a6199b580d287a1


--

___
Python tracker 

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



[issue31542] pth files in site-packages of venvs are executed twice

2017-09-21 Thread Antony Lee

New submission from Antony Lee:

All's in the title: "pth files in site-packages of venvs are executed twice".  
For example, the following code sample prints "1" twice.

python -mvenv /tmp/tmpenv
echo 'import os; print(1)' >/tmp/tmpenv/lib/python3.6/site-packages/foo.pth
source activate /tmp/tmpenv
python

This behavior is different from the one for a pth file in a non-venv 
site-packages (either the syswide prefix, or the user prefix), which is only 
executed once.

--
components: Library (Lib)
messages: 302678
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: pth files in site-packages of venvs are executed twice
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



[issue31541] Mock called_with does not ensure self/cls argument is used

2017-09-21 Thread JonathanHuot

New submission from JonathanHuot:

Mock "assert_called_with" does not contain a possibility to verify if "self" or 
"cls" is used when mock is called.

So, in unittests, all tests are passing but code is broken. Example :


Steps to reproduce:
==

class Something(object):
def foobar(self):
pass

def foo(self):
self.foobar()

def bar(self):
Something.foobar()  # this is broken


from unittest import mock
x = mock.Mock(spec=Something)
x.foo()
x.foo.assert_called_with()
x.bar()
x.bar.assert_called_with()  # this assertion pass!

# real code 
z = Something()
z.foo()
z.bar()  # raise exception

--
components: Library (Lib)
messages: 302677
nosy: jonathan.huot
priority: normal
severity: normal
status: open
title: Mock called_with does not ensure self/cls argument is used
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31532] Py_GetPath, Py_SetPath memory corruption due to mixed PyMem_New micex with PyMem_Raw_Free

2017-09-21 Thread Vincent Gatine

Vincent Gatine added the comment:

Tried your suggestion. Nothing is printed and program still crash.

--

___
Python tracker 

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



[issue31532] Py_GetPath, Py_SetPath memory corruption due to mixed PyMem_New micex with PyMem_Raw_Free

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

I'm curious. Would you mind to try to run your frozen application using 
PYTHONMALLOC=debug environment variable on a Python without the fix, to see if 
you get an error? I'm not sure that the debug hooks on memory allocators are 
set early enough to detect your specific bug.

https://docs.python.org/dev/using/cmdline.html#envvar-PYTHONMALLOC

--
nosy: +haypo

___
Python tracker 

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



[issue31540] Adding context in concurrent.futures.ProcessPoolExecutor

2017-09-21 Thread Thomas Moreau

New submission from Thomas Moreau:

The `ProcessPoolExecutor` processes start method can only be change by changing 
the global default context with `set_start_method` at the beginning of a 
script. We propose to allow passing a context argument in the constructor to 
allow more flexible control of the executor.

Adding this would allow testing `ProcessPoolExecutor` with all the available 
context

--
components: Library (Lib)
messages: 302674
nosy: tomMoral
priority: normal
pull_requests: 3671
severity: normal
status: open
title: Adding context in concurrent.futures.ProcessPoolExecutor
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



[issue31512] Add non-elevated symlink support for dev mode Windows 10

2017-09-21 Thread Vidar Fauske

Vidar Fauske added the comment:

Thanks for the informative comments. I opened a PR based on this feedback. 
Would you mind checking if it conforms to what you had in mind?

--

___
Python tracker 

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



[issue31500] IDLE: Tiny font on HiDPI display

2017-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset a96c96f5dab68d4e611af4b8caefd7268533fd9a by Serhiy Storchaka in 
branch 'master':
bpo-31500: IDLE: Scale default fonts on HiDPI displays. (#3639)
https://github.com/python/cpython/commit/a96c96f5dab68d4e611af4b8caefd7268533fd9a


--

___
Python tracker 

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



[issue31539] asyncio.sleep may sleep less time then it should

2017-09-21 Thread Mikhail

New submission from Mikhail:

Originally faced here:
https://stackoverflow.com/q/46306660/1113207

Simple code to reproduce:

import asyncio 
import time


async def main():
while True:
asyncio.ensure_future(asyncio.sleep(1))

t0 = time.time()
await asyncio.sleep(0.1)
t1 = time.time()

print(t1 - t0)
if t1 - t0 < 0.1:
print('bug ^')
break


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

I thought that it may be related to event loop's internal clock, but changing 
time.time() with asyncio.get_event_loop().time() doesn't help.

Tested on Windows 10 x64, Python 3.6.2.

--
components: asyncio
messages: 302671
nosy: germn, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.sleep may sleep less time then it should
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue31536] `make regen-all` triggers wholesale rebuild

2017-09-21 Thread STINNER Victor

STINNER Victor added the comment:

I may do the backport, or ask the bot to do it. Right now I prefer to check if 
everything is fine on all CI.

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



[issue31536] `make regen-all` triggers wholesale rebuild

2017-09-21 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +zach.ware

___
Python tracker 

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



[issue31532] Py_GetPath, Py_SetPath memory corruption due to mixed PyMem_New micex with PyMem_Raw_Free

2017-09-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:


New changeset 88d0663005d258526496d1f8ee0acb7103c69e80 by Benjamin Peterson 
(Miss Islington (bot)) in branch '3.6':
[3.6] closes bpo-31532: Fix memory corruption due to allocator mix (GH-3679) 
(#3681)
https://github.com/python/cpython/commit/88d0663005d258526496d1f8ee0acb7103c69e80


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



[issue31532] Py_GetPath, Py_SetPath memory corruption due to mixed PyMem_New micex with PyMem_Raw_Free

2017-09-21 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3670

___
Python tracker 

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



[issue31532] Py_GetPath, Py_SetPath memory corruption due to mixed PyMem_New micex with PyMem_Raw_Free

2017-09-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:


New changeset 3d1e2ab584ed0175592b5be2a0bc98dc1723776a by Benjamin Peterson 
(nurelin) in branch 'master':
bpo-31532: Fix memory corruption due to allocator mix (#3679)
https://github.com/python/cpython/commit/3d1e2ab584ed0175592b5be2a0bc98dc1723776a


--
nosy: +benjamin.peterson

___
Python tracker 

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