[issue36599] doctest document says dict order is unstable

2019-04-11 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Go ahead and change it to:   "For example, when printing a set, Python doesn’t 
guarantee that the else will be printed in any particular order,"

--
nosy: +rhettinger

___
Python tracker 

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



[issue36591] Should be a typing.UserNamedTuple

2019-04-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> levkivskyi
nosy: +levkivskyi

___
Python tracker 

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



[issue36604] Add recipe to itertools

2019-04-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thank you for the suggestion and the nice work.

I'm going to decline adding this to our docs because it isn't in the spirit of 
the other recipes (reasonably common task, reasonably simple, and/or showing 
off effective combinations of the other itertools).

Though the docs aren't the right place for this, it would be nice if you 
published a blog post or some such to show off your work, detail the though 
processes, and illustrate how you measured performance).  Another option is to 
submit this to the more-itertools project.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue36457] functools.singledispatchmethod interacts poorly with subclasses

2019-04-11 Thread Tim Mitchell


Tim Mitchell  added the comment:

Attached is an improved implementation that does not use a module level 
register() function.  
It makes the code in the original post work as expected: The 
`@BaseVisitor.visit.register()` decorator on the `AVisitor` class does not 
modify the base class dispatch table.  This works by constructing the dispatch 
registry in the `__init_subclass__` method instead.

--
Added file: https://bugs.python.org/file48261/singledispatchmethod.py

___
Python tracker 

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



[issue34652] never enable lchmod on Linux

2019-04-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

We can take a PR to fix that.

On Thu, Apr 11, 2019, at 04:42, Joshua Root wrote:
> 
> Joshua Root  added the comment:
> 
> The follow-up fix (AC_CHECK_FUNC -> AC_CHECK_FUNCS) still needs to be 
> backported to 2.7. Currently the lack of it causes lchmod to be 
> disabled on all platforms, not just Linux.
> 
> --
> nosy: +jmr
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue36596] tarfile module considers anything starting with 512 bytes of zero bytes to be a valid tar file

2019-04-11 Thread Eitan Adler


Change by Eitan Adler :


--
nosy: +eitan.adler

___
Python tracker 

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



[issue36602] Recursive directory list with pathlib.Path.iterdir

2019-04-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> I believe `rglob("*")` is eager, while `iterdir` is lazy.

rglob and glob also return a generator.

Slightly related, pathlib.walk was proposed in the past in python-ideas : 
https://mail.python.org/pipermail/python-ideas/2017-April/045398.html

--
nosy: +xtreak

___
Python tracker 

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



[issue16177] Typing left parenthesis in IDLE causes intermittent Cocoa Tk crash on OS X

2019-04-11 Thread Tom Goddard


Tom Goddard  added the comment:

This Mac Tk bug was supposedly fixed in 2016 or 2017.  Details are in the 
following Tk ticket.

http://core.tcl.tk/tk/tktview/c84f660833546b1b84e7

The previous URL to the Tk ticket no longer works.  In case the above URL also 
goes bad, the id number for the Tk ticket is 

c84f660833546b1b84e7fd3aef930c2f17207461

--

___
Python tracker 

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



[issue29288] Lookup Error while importing idna from a worker thread

2019-04-11 Thread James Saryerwinnie


James Saryerwinnie  added the comment:

I ran into this as well also using the embedded distribution for windows 
(https://docs.python.org/3/using/windows.html#the-embeddable-package).

socket.getaddrinfo() will encode unicode hostnames using idna and trigger this 
error if you call this function in threads:

PS C:\Users\Administrator\Downloads\python-3.7.3-embed-amd64> cat .\repro.py
import threading
import socket


def task():
try:
socket.getaddrinfo('www.google.com', 443)
except Exception as e:
print("FAIL: %s" % e)
raise


threads = []
for i in range(50):
t = threading.Thread(target=task)
threads.append(t)

for t in threads:
t.start()

for t in threads:
t.join()

print("DONE")


PS C:\Users\Administrator\Downloads\python-3.7.3-embed-amd64> .\python.exe 
.\repro.py
FAIL: unknown encoding: idna
FAIL: unknown encoding: idna
Exception in thread Thread-5:
Traceback (most recent call last):
  File 
"D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\threading.py", 
line 917, in _bootstrap_inner
  File 
"D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\threading.py", 
line 865, in run
  File ".\repro.py", line 7, in task
socket.getaddrinfo('www.google.com', 443)
  File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\socket.py", 
line 748, in getaddrinfo
LookupError: unknown encoding: idna

FAIL: unknown encoding: idna
Exception in thread Thread-4:
Traceback (most recent call last):
  File 
"D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\threading.py", 
line 917, in _bootstrap_inner
  File 
"D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\threading.py", 
line 865, in run
  File ".\repro.py", line 7, in task
socket.getaddrinfo('www.google.com', 443)
  File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\socket.py", 
line 748, in getaddrinfo
LookupError: unknown encoding: idna

Exception in thread Thread-6:
Traceback (most recent call last):
  File 
"D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\threading.py", 
line 917, in _bootstrap_inner
  File 
"D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\threading.py", 
line 865, in run
  File ".\repro.py", line 7, in task
socket.getaddrinfo('www.google.com', 443)
  File "D:\obj\Windows-Release\37amd64_Release\msi_python\zip_amd64\socket.py", 
line 748, in getaddrinfo
LookupError: unknown encoding: idna

DONE


Confirmed that adding u''.encode('idna') fixes this issue.

--
nosy: +James.Saryerwinnie

___
Python tracker 

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



[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-04-11 Thread Cheryl Sabella


Change by Cheryl Sabella :


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



[issue26205] Inconsistency concerning nested scopes

2019-04-11 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Assigning to @Mariatta for the sprints.

--
assignee: docs@python -> Mariatta
nosy: +Mariatta, cheryl.sabella
versions: +Python 3.7, Python 3.8 -Python 2.7, 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



[issue17267] datetime.time support for '+' and '-'

2019-04-11 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

It seems that there was interest in this enhancement a few years ago.  @joar, 
would you be able to convert your patch to a GitHub pull request on the master 
branch?  Thanks!

--
nosy: +cheryl.sabella
versions: +Python 3.8 -Python 3.4

___
Python tracker 

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



[issue36608] Replace bundled pip and setuptools with a downloader in the ensurepip module

2019-04-11 Thread Sviatoslav Sydorenko


Change by Sviatoslav Sydorenko :


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

___
Python tracker 

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



[issue36608] Replace bundled pip and setuptools with a downloader in the ensurepip module

2019-04-11 Thread Sviatoslav Sydorenko


New submission from Sviatoslav Sydorenko :

Hi,

I've noticed that there's an idea to not pollute Git tree with vendored blobs. 
In particular, `ensurepip` is one of the components doing this.

Such a wish was expressed here: https://bugs.python.org/issue35277#msg330098

So I thought I'd take a stab at it...

--
components: Library (Lib)
messages: 339998
nosy: dstufft, pradyunsg, serhiy.storchaka, webknjaz
priority: normal
severity: normal
status: open
title: Replace bundled pip and setuptools with a downloader in the ensurepip 
module
type: enhancement
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



[issue36602] Recursive directory list with pathlib.Path.iterdir

2019-04-11 Thread Paul Ganssle


Paul Ganssle  added the comment:

> Is the behaviour you're proposing any different from using Path.rglob('*')?

I believe `rglob("*")` is eager, while `iterdir` is lazy.

@Epic_Wink:
> This would be trivial to implement as 'iterdir' can simply yield from 
> subdirectories' 'iterdir'.

One thing you may need to worry about here is the fact that symlinks can have 
cycles, so you may need to do some cycle detection to avoid creating the 
dangerous possibility of infinite loops.

There's also the question of whether you want this to be a depth-first or 
breadth-first traversal, and whether you would want both of these to be options.

--
nosy: +p-ganssle

___
Python tracker 

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



[issue20582] socket.getnameinfo() does not document flags

2019-04-11 Thread miss-islington


miss-islington  added the comment:


New changeset 3993ccb6820d4239ce3d9e1c5d31f13b86eb by Miss Islington (bot) 
(Emmanuel Arias) in branch 'master':
bpo-20582: add link for manpage for flags on getnameinfo() (GH-11977)
https://github.com/python/cpython/commit/3993ccb6820d4239ce3d9e1c5d31f13b86eb


--
nosy: +miss-islington

___
Python tracker 

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



[issue36389] Add gc.enable_object_debugger(): detect corrupted Python objects in the GC

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9e23f0a27cb8bf6e4ea1d2aef36a91502282bbc9 by Victor Stinner in 
branch '3.7':
[3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory 
(GH-12770) (GH-12788)
https://github.com/python/cpython/commit/9e23f0a27cb8bf6e4ea1d2aef36a91502282bbc9


--

___
Python tracker 

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



[issue36605] make tags should also parse Modules/_io/*.c and Modules/_io/*.h

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 21a74a9d77c5ac628808b9faace18b824ca056f7 by Victor Stinner in 
branch 'master':
bpo-36605: make tags: parse Modules/_io directory (GH-12789)
https://github.com/python/cpython/commit/21a74a9d77c5ac628808b9faace18b824ca056f7


--

___
Python tracker 

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



[issue36432] Running python test suite fails on macOS 10.14.4 with resource.RLIMIT_STACK error

2019-04-11 Thread Dmitrii Pasechnik


Change by Dmitrii Pasechnik :


--
nosy: +dimpase

___
Python tracker 

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



[issue22454] Adding the opposite function of shlex.split()

2019-04-11 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue34249] Full set of format codes applies to strftime only

2019-04-11 Thread Paul Ganssle


Paul Ganssle  added the comment:

To clarify, as far as I know, this note *does* apply to both strftime and 
strptime, as CPython doesn't have its own implementation of either. I'm not 
sure if any guarantees are made that the supported formatting codes will be the 
same between the two.

--
nosy: +p-ganssle

___
Python tracker 

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



[issue36598] mock side_effect should be checked for iterable not callable

2019-04-11 Thread Gregory Ronin


Gregory Ronin  added the comment:

You are right. I was not calling generator the right way in mock. After I tried 
your suggestion it works.

--

___
Python tracker 

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



[issue36607] asyncio.all_tasks() crashes if asyncio is used in multiple threads

2019-04-11 Thread Nick Davies


New submission from Nick Davies :

This problem was identified in https://bugs.python.org/issue34970 but I think 
the fix might have been incorrect. The theory in issue34970 was that GC was 
causing the weakrefset for `all_tasks` to change during iteration. However 
Weakset provides an `_IterationGuard` class to prevent GC from changing the set 
during iteration and hence preventing this problem in a single thread.

My thoughts on this problem are:
 - `asyncio.tasks._all_tasks` is shared for all users of asyncio 
(https://github.com/python/cpython/blob/3.7/Lib/asyncio/tasks.py#L818)
 - Any new Task constructed mutates `_all_tasks` 
(https://github.com/python/cpython/blob/3.7/Lib/asyncio/tasks.py#L117)
 - _IterationGuard won't protect iterations in this case because calls to 
Weakset.add will always commit changes even if there is something iterating 
(https://github.com/python/cpython/blob/3.6/Lib/_weakrefset.py#L83)
 - calls to `asyncio.all_tasks` or `asyncio.tasks.Task.all_tasks` crash if any 
task is started on any thread during iteration.

Repro code:

```
import asyncio
from threading import Thread


async def do_nothing():
await asyncio.sleep(0)


async def loop_tasks():
loop = asyncio.get_event_loop()
while True:
loop.create_task(do_nothing())
await asyncio.sleep(0.01)


def old_thread():
loop = asyncio.new_event_loop()
while True:
asyncio.tasks.Task.all_tasks(loop=loop)


def new_thread():
loop = asyncio.new_event_loop()
while True:
asyncio.all_tasks(loop=loop)


old_t = Thread(target=old_thread)
new_t = Thread(target=new_thread)
old_t.start()
new_t.start()
asyncio.run(loop_tasks())
```

Output:

```
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
  File "tmp/test_asyncio.py", line 25, in new_thread
asyncio.all_tasks(loop=loop)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 40, in all_tasks
return {t for t in list(_all_tasks)
  File "/usr/lib/python3.7/_weakrefset.py", line 60, in __iter__
for itemref in self.data:
RuntimeError: Set changed size during iteration

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
  File "tmp/test_asyncio.py", line 19, in old_thread
asyncio.tasks.Task.all_tasks(loop=loop)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 52, in _all_tasks_compat
return {t for t in list(_all_tasks) if futures._get_loop(t) is loop}
  File "/usr/lib/python3.7/_weakrefset.py", line 60, in __iter__
for itemref in self.data:
RuntimeError: Set changed size during iteration
```

--
components: asyncio
messages: 339991
nosy: Nick Davies, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.all_tasks() crashes if asyncio is used in multiple threads
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



[issue24011] Add error checks to PyInit_signal()

2019-04-11 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@berkerpeksag I made the requested changes on the PR. PTAL.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue32308] Replace empty matches adjacent to a previous non-empty match in re.sub()

2019-04-11 Thread Matthew Barnett


Matthew Barnett  added the comment:

It's now consistent with Perl, PCRE and .Net (C#), as well as re.split(), 
re.sub(), re.findall() and re.finditer().

--

___
Python tracker 

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



[issue36606] calling super() causes __class__ to be not defined when sys.settrace(trace) is set

2019-04-11 Thread Karthikeyan Singaravelan

New submission from Karthikeyan Singaravelan :

I came across this issue in issue36593 where MagicMock had a custom __class__ 
attribute set and one of the methods used super() which caused __class__ not to 
be set. This seems to have been fixed in the past with issue12370 and a 
workaround to alias super at module level and use it was suggested in 
msg161704. Usage of the alias seems to solve the issue for Mock but the fix for 
__class__ breaks when sys.settrace is set. Example code as below with custom 
__class__ defined and with running the code under sys.settrace() super() 
doesn't set __class__ but using _safe_super alias works. Another aspect in the 
mock related issue is that the call to super() is under a codepath that is not 
executed during normal run but executed when sys.settrace during import itself.


import sys

_safe_super = super

def trace(frame, event, arg):
return trace

if len(sys.argv) > 1:
sys.settrace(trace)

class SuperClass(object):

def __init__(self):
super().__init__()

@property
def __class__(self):
return int

class SafeSuperClass(object):

def __init__(self):
_safe_super(SafeSuperClass, self).__init__()

@property
def __class__(self):
return int

print(isinstance(SuperClass(), int))
print(isinstance(SafeSuperClass(), int))


Running above code with trace and without trace

➜  cpython git:(master) ✗ ./python.exe /tmp/buz.py
True
True
➜  cpython git:(master) ✗ ./python.exe /tmp/buz.py 1
False
True

There is a test for the above in Lib/test/test_super.py at 
https://github.com/python/cpython/blob/4c409beb4c360a73d054f37807d3daad58d1b567/Lib/test/test_super.py#L87

Add a trace as below in test_super.py at the top and the test case fails

import sys

def trace(frame, event, arg):
return trace

sys.settrace(trace)


➜  cpython git:(master) ✗ ./python.exe Lib/test/test_super.py
F
==
FAIL: test_various___class___pathologies (__main__.TestSuper)
--
Traceback (most recent call last):
  File "Lib/test/test_super.py", line 100, in test_various___class___pathologies
self.assertEqual(x.__class__, 413)
AssertionError: .X'> != 413

--
Ran 21 tests in 0.058s

FAILED (failures=1)

--
components: Interpreter Core
messages: 339988
nosy: benjamin.peterson, eric.snow, michael.foord, ncoghlan, nedbat, xtreak
priority: normal
severity: normal
status: open
title: calling super() causes __class__ to be not defined when 
sys.settrace(trace) is set
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
stage:  -> patch review
type:  -> behavior

___
Python tracker 

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



[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Copying my comment from GitHub : 

This issue occurs only when the mock module import and code are executed under 
tracing. In order to test this I have tried patching sys.modules to remove 
unittest.mock in order to trigger an import under tracing. Though unittest.mock 
is deleted reference to unittest.mock.patch is held by two tests 
(test_patch_dict_test_prefix and test_patch_test_prefix) that change the 
TEST_PREFIX. Hence somehow there is a difference in the unittest.mock.patch 
object referred under these tests and inside mock module causing reference to 
unchanged TEST_PREFIX and hence test case failures. So I have kept a reference 
to old patch object and restored it in the end of this test to make sure 
everything is in sync.

There is some difficulty in testing this since the import needs to be executed 
under tracing and manipulating sys.modules to delete unittest.mock and reimport 
causes some old references in other tests to go out of sync. A clean way to do 
this would be to have this test as a separate file and hence not impacting 
other tests but I am not sure if it's worth enough to justify a separate file 
to test this. Maybe I am missing something here on a better way to test this. 
Any guidance would be helpful.

Thanks

--
keywords:  -patch
nosy: +cjw296, mariocj89
stage: patch review -> 
versions: +Python 3.8

___
Python tracker 

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



[issue36598] mock side_effect should be checked for iterable not callable

2019-04-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests:  -12717

___
Python tracker 

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



[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue36598] mock side_effect should be checked for iterable not callable

2019-04-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue36605] make tags should also parse Modules/_io/*.c and Modules/_io/*.h

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue36605] make tags should also parse Modules/_io/*.c and Modules/_io/*.h

2019-04-11 Thread STINNER Victor


New submission from STINNER Victor :

Attached PR fix the issue.

--
components: Build
messages: 339986
nosy: vstinner
priority: normal
severity: normal
status: open
title: make tags should also parse Modules/_io/*.c and Modules/_io/*.h
versions: Python 3.8

___
Python tracker 

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



[issue32451] python -m venv activation issue when using cygwin on windows

2019-04-11 Thread Andrew Stanton


Andrew Stanton  added the comment:

I dont think this is a Cygwin only problem, as this is happening to me when 
running WSL (Windows subsystem for Linux). I can run Scripts\Activate.ps1 from 
powershell, Scripts\activate.bat from cmd, but running scripts/activate from 
wsl reports this same error.

--
nosy: +astanton1978

___
Python tracker 

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



[issue36603] should pty.openpty() set pty/tty inheritable?

2019-04-11 Thread Hugh Redelmeier


Change by Hugh Redelmeier :


--
nosy: +hugh

___
Python tracker 

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



[issue36604] Add recipe to itertools

2019-04-11 Thread SilentGhost


Change by SilentGhost :


--
assignee:  -> docs@python
components: +Documentation -Extension Modules
nosy: +docs@python, rhettinger
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



[issue36604] Add recipe to itertools

2019-04-11 Thread Bjorn Madsen


New submission from Bjorn Madsen :

I would like to add a recipe to the itertools documentation (if it belongs 
there?)

The recipe presents a method to generate set(powerset([iterable])) in a 
fraction of the runtime. I thought others might find this method helpful and 
pushed it to github under MIT license.

The recipe is available with test here: 
https://github.com/root-11/python_recipes

--
components: Extension Modules
messages: 339984
nosy: Bjorn.Madsen
priority: normal
severity: normal
status: open
title: Add recipe to itertools
type: enhancement

___
Python tracker 

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



[issue36389] Add gc.enable_object_debugger(): detect corrupted Python objects in the GC

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12715

___
Python tracker 

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



[issue36588] change sys.platform() to just "aix" for AIX

2019-04-11 Thread Michael Felt


Change by Michael Felt :


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

___
Python tracker 

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



[issue36603] should pty.openpty() set pty/tty inheritable?

2019-04-11 Thread SilentGhost


Change by SilentGhost :


--
nosy: +twouters

___
Python tracker 

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



[issue36588] change sys.platform() to just "aix" for AIX

2019-04-11 Thread Michael Felt


Michael Felt  added the comment:

Was:
root@x064:[/data/prj/python/python3-3.8]./python
Python 3.8.0a3+ (heads/bpo-28009-2-dirty:2fb2bc81c3, Apr 11 2019, 07:09:55) [C] 
on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.platform
'aix6'
>>> import os
>>> os.uname()[3]
'7'

./python ../git/python3-3.8/Tools/scripts/patchcheck.py
Getting base branch for PR ... origin/master
Getting the list of files that have been added/changed ... 6 files
Fixing Python file whitespace ... 0 files
Fixing C file whitespace ... 0 files
Fixing docs whitespace ... 0 files
Docs modified ... yes
Misc/ACKS updated ... NO
Misc/NEWS.d updated with `blurb` ... yes
configure regenerated ... yes
pyconfig.h.in regenerated ... no

On system I built on:
root@x066:[/data/prj/python/python3-3.8]./python
Python 3.8.0a3+ (heads/bpo-36588-aix-platform-dirty:2021d40faa, Apr 11 2019, 
15:16:05) [C] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import os,sys
>>> sys.platform
'aix'
>>> os.uname()[3]
'6'

And on AIX7 system:
root@x064:[/data/prj/python/python3-3.8]./python
Python 3.8.0a3+ (heads/bpo-36588-aix-platform-dirty:2021d40faa, Apr 11 2019, 
15:16:05) [C] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import os,sys
>>> sys.platform
'aix'
>>> os.uname()[3]
'7'

--

___
Python tracker 

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



[issue36603] should pty.openpty() set pty/tty inheritable?

2019-04-11 Thread cagney


New submission from cagney :

pty.openpty(), on systems with a working os.openpty() / openpty(3) executes:

if (openpty(_fd, _fd, NULL, NULL, NULL) != 0)
goto posix_error;
if (_Py_set_inheritable(master_fd, 0, NULL) < 0)
goto error;
if (_Py_set_inheritable(slave_fd, 0, NULL) < 0)
goto error;

where as on systems where this is fails it instead executes:

master_fd, slave_name = _open_terminal()
slave_fd = slave_open(slave_name)
i.e., result = os.open(tty_name, os.O_RDWR)
return master_fd, slave_fd

where os.open() was "Changed in version 3.4: The new file descriptor is now 
non-inheritable."

(personally I'd deprecate pty.openpty(), but that is just me)

--
components: IO
messages: 339982
nosy: cagney
priority: normal
severity: normal
status: open
title: should pty.openpty() set pty/tty inheritable?
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



[issue19770] NNTP: add post_message wrapper to post Email Message objects

2019-04-11 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thanks David!  If someone is looking for an issue to work on, I'll keep this 
one in mind with the caveat that it won't be reviewed during the sprints.  And 
if no one works on it at that time, then it might be a good first issue 
afterwards.

I'm updating the title to reflect the request.

--
stage:  -> needs patch
title: NNTP.post broken -> NNTP: add post_message wrapper to post Email Message 
objects
type: behavior -> enhancement
versions: +Python 3.8 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue13927] Document time.ctime format

2019-04-11 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

I guess what I'm thinking of `Www Mmm dd hh:mm:ss ` as representing isn't 
so much a format, but rather a literal replacement of where each value has a 
placeholder in the string (that is, a pattern).  So, even if `Www` doesn't mean 
anything, to me it means that the first three characters in the string are a 
Weekday, then there's a space, then Mmm is the month, then a space, then dd is 
the day number (with zero sometimes suppressed), etc.  

If that is more confusing than not using it, then that's fine.  I just wanted 
to mention it.

Using %d to me is also confusing since the docs define %d as `Day of the month 
as a decimal number [01,31]`.  This clearly isn't using 01, but rather 
suppressing the 0.

--

___
Python tracker 

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



[issue18748] io.IOBase destructor silence I/O error on close() by default

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


--
title: libgcc_s.so.1 must be installed for pthread_cancel to work -> io.IOBase 
destructor silence I/O error on close() by default

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:

I looked at this old issue. First of all, "bug.py" filename is accurate: this 
program contains a bug, but it's non-obvious.

* the main thread opens a file which gets the file descriptor 3
* a new thread is spawns which indirectly closes this file descriptor on: 
sys.stdout.close()
* the main thread is not aware that the file has been closed, and so will try 
to close the same file descriptor 3 sometime during Python shutdown
* then, sometimes, the glibc fails with an internal error because the main 
thread closed a file descriptor which was just opened by the other thread to 
implement thread cancellation: that logs "libgcc_s.so.1 must be installed for 
pthread_cancel to work" and calls abort()

Note: the Python file object remains alive until the "t" local variable is 
cleared, since "t.fh" contains a strong reference to the file object.

Again: it's a bug in the program. "libgcc_s.so.1 must be installed for 
pthread_cancel to work" is just *one* example of bad thing that can happen.

What can be do on the Python side? Well, stop to ignore silently I/O errors 
when a file is closed by its destructor.

I wrote a shy PR 12786 to only log these exceptions in development mode (-X 
dev). I'm not sure if we could stop to silence these exceptions *by default*.

Python has been modified last years to first raise an exception on I/O errors 
when file.close() is called explicitly, and then a similar change has been done 
for call to socket.socket.close().

--

___
Python tracker 

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



[issue34788] ipaddress module fails on rfc4007 scoped IPv6 addresses

2019-04-11 Thread Jeremy McMillan


Jeremy McMillan  added the comment:

I think the code in SaltStack to handle scoped IPv6 addresses is mature, so 
please look at these examples.

https://github.com/saltstack/salt/blob/2085cb1078f187adf82a0cf19b39d350ff1bbd50/salt/_compat.py#L125

--

___
Python tracker 

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +12713
stage: resolved -> patch review

___
Python tracker 

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



[issue22377] %Z in strptime doesn't match EST and others

2019-04-11 Thread SilentGhost


SilentGhost  added the comment:

PR on github, Alex

--
nosy: +SilentGhost

___
Python tracker 

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



[issue36600] re-enable test in nntplib

2019-04-11 Thread SilentGhost


Change by SilentGhost :


--
components: +Tests
nosy: +vstinner
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



[issue2281] Enhanced cPython profiler with high-resolution timer

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:

I think https://bugs.python.org/issue36575 fixed this.

--
nosy: +inada.naoki
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



[issue13927] Document time.ctime format

2019-04-11 Thread Harmandeep Singh


Harmandeep Singh  added the comment:

This is not python compatible format, I want something like "%a %b %d %H:%M:%S 
%Y" to explain it.

--

___
Python tracker 

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



[issue36378] Add support to load from paths to json.load

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:

I close this because PR is closed already, and same idea
was discussed on -ideas ML.

--
nosy: +inada.naoki
resolution:  -> rejected
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



[issue18697] Unify arguments names in Unicode object C API documentation

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue13927] Document time.ctime format

2019-04-11 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

I would like to help get this issue merged as it's already been approved by a 
core developer.

Does anyone object to the change?  Victor made a suggestion on the PR for 
alternative wording and I wanted to give others a chance to comment on that.

Also, looking at the man page for asctime, they use `Www Mmm dd hh:mm:ss ` 
as the description of the output.  Maybe it would be helpful to add this since 
it shows the spacing and explicitly shows the day number taking up 2 characters?

Thanks!

--
nosy: +belopolsky, cheryl.sabella

___
Python tracker 

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



[issue16712] collections.abc.Sequence should not provide __reversed__

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:

I close this issue because Reversible ABC was added.

It's sad that Sequnce.__reversed__ is just makes reversed() slow without any 
benefit.

But removing it without breaking backward compatibility is not easy for now.

--
resolution:  -> wont fix
stage: needs patch -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.4

___
Python tracker 

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



[issue35232] Add `module`/`qualname` arguments to make_dataclass for picklability

2019-04-11 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue32616] Significant performance problems with Python 2.7 built with clang 3.x or 4.x

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:

https://github.com/Homebrew/homebrew-core/blob/b2aff6271caa04508fb1529fdd5edbb22f4e7f21/Formula/python%402.rb#L75-L82

Homebrew checks compiler version too.

I don't think it's worth enough to add more code to avoid this trouble.

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



[issue32616] Significant performance problems with Python 2.7 built with clang 3.x or 4.x

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:

I'm using Mojave.  I don't have regression.

$ /usr/local/bin/python2 x.py  # Homebrew python@2
1.681729

$ /usr/bin/python x.py  # System python2
1.891549

Could someone using High Sierra or Sierra test it?

x.py is test script in https://bugs.python.org/issue32616#msg310395

--

___
Python tracker 

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



[issue35232] Add `module`/`qualname` arguments to make_dataclass for picklability

2019-04-11 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
type:  -> enhancement
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue36602] Recursive directory list with pathlib.Path.iterdir

2019-04-11 Thread SilentGhost


SilentGhost  added the comment:

Is the behaviour you're proposing any different from using Path.rglob('*')?

--
nosy: +SilentGhost

___
Python tracker 

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



[issue34652] never enable lchmod on Linux

2019-04-11 Thread Joshua Root


Joshua Root  added the comment:

The follow-up fix (AC_CHECK_FUNC -> AC_CHECK_FUNCS) still needs to be 
backported to 2.7. Currently the lack of it causes lchmod to be disabled on all 
platforms, not just Linux.

--
nosy: +jmr

___
Python tracker 

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



[issue35070] test_posix fails on macOS 10.14 Mojave

2019-04-11 Thread Dave Page


Dave Page  added the comment:

I'm seeing what appears to my uneducated eyes to be the same failure on Mojave, 
on a brand new machine which is entirely standalone:

12:16:00 0:00:07 load avg: 4.24 [133/416/1] test_posix failed
12:16:00 test test_posix failed -- Traceback (most recent call last):
12:16:00   File 
"/Users/jenkins/workspace/python-macos-build/Python-3.7.2/Lib/test/test_posix.py",
 line 1026, in test_getgrouplist
12:16:00 self.assertIn(group, posix.getgrouplist(user, group))
12:16:00 OSError: [Errno 25] Inappropriate ioctl for device
12:16:00 0:00:07 load avg: 4.24 [134/416/1] test_ast passed

System info:

pgabf-macos2:Python-3.7.2 jenkins$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.3)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

pgabf-macos2:Python-3.7.2 jenkins$ system_profiler SPSoftwareDataType
Software:

System Software Overview:

  System Version: macOS 10.14.3 (18D42)
  Kernel Version: Darwin 18.2.0
  Boot Volume: Macintosh HD
  Boot Mode: Normal
  Computer Name: pgabf-macos2
  User Name: Jenkins (jenkins)
  Secure Virtual Memory: Enabled
  System Integrity Protection: Enabled
  Time since boot: 10 days 1:30

Happy to provide any additional info or try out patches if anyone wants.

--
nosy: +Dave Page

___
Python tracker 

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



[issue36389] Add gc.enable_object_debugger(): detect corrupted Python objects in the GC

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:

Currently, I'm using the following patch to try to detect bpo-33803 bug using 
my GC object debugger. It's still a work-in-progress.

diff --git a/Lib/site.py b/Lib/site.py
index ad1146332b..e184080b19 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -638,3 +638,8 @@ def _script():

 if __name__ == '__main__':
 _script()
+
+if 'dev' in sys._xoptions:
+import gc
+gc.enable_object_debugger(100)
+#gc.set_threshold(5)
diff --git a/Python/hamt.c b/Python/hamt.c
index 67af04c437..67da8ec22c 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -2478,8 +2478,10 @@ hamt_alloc(void)
 if (o == NULL) {
 return NULL;
 }
+#if 0
 o->h_count = 0;
 o->h_root = NULL;
+#endif
 o->h_weakreflist = NULL;
 PyObject_GC_Track(o);
 return o;

--

___
Python tracker 

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



[issue36560] test_functools leaks randomly 1 memory block

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:

Patch making check on memory block leaks stricter:

diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
index 235d6bfd3a..dfadabdef6 100644
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -130,7 +130,7 @@ def dash_R(ns, the_module, test_name, test_func):
 failed = False
 for deltas, item_name, checker in [
 (rc_deltas, 'references', check_rc_deltas),
-(alloc_deltas, 'memory blocks', check_rc_deltas),
+(alloc_deltas, 'memory blocks', check_fd_deltas),
 (fd_deltas, 'file descriptors', check_fd_deltas)
 ]:
 # ignore warmup runs


Using this patch, at least the following tests fail:

* test_asyncio
* test_code
* test_collections
* test_contextlib
* test_contextlib_async
* test_ctypes
* test_functools
* test_multiprocessing_forkserver
* test_multiprocessing_spawn
* test_regrtest
* test_statistics
* test_typing
* test_xml_etree_c

I didn't analyze why yet. I guess that they are not real memory leaks, but more 
minor issue in the code checking for memory leaks. Sadly, it seems like such 
small glitch can cause a whole Refleak buildbot worker to fail :-(

--

___
Python tracker 

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



[issue36602] Recursive directory list with pathlib.Path.iterdir

2019-04-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pitrou

___
Python tracker 

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



[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I think I got to this. See issue12370 (Use of super overwrites use of __class__ 
in class namespace) . msg138712 suggests a workaround to alias super at the 
module level. unittest.mock has the below line and NonCallableMock has 
__class__ defined as a property which is not set when set trace is used since 
the linked commit in 3.7.2 uses super() is somehow executed by settrace since 
it's in __delattr__ and not in a code path executed by user code?

Looking at the unittest.mock code super is not used anywhere but _safe_super is 
used which I hope is for this reason. So this is not a case with MagicMock only 
but rather a case with anything that inherits from NonCallableMock i.e. Mock, 
MagicMock etc. This is not a problem with import being made before the trace is 
set as you mentioned so set trace does something that exposes this issue

https://github.com/python/cpython/blob/536a35b3f14888999f1ffa5be7239d0c26b73d7a/Lib/unittest/mock.py#L48

# Workaround for issue #12370
# Without this, the __class__ properties wouldn't be set correctly
_safe_super = super

Sample program in issue12370. Add set trace SuperClass with using super() fails 
and passes without set trace for super(). Whereas SafeSuperClass that uses 
_safe_super (module level alias to super) passes both cases irrespective of 
usage of set trace. Nick coughlan added a message so that unittest.mock should 
use _safe_super in https://bugs.python.org/issue12370#msg161704

import sys

_safe_super = super

def trace(frame, event, arg):
return trace

if len(sys.argv) > 1:
sys.settrace(trace)

class SuperClass(object):

def __init__(self):
super().__init__()

@property
def __class__(self):
return int

class SafeSuperClass(object):

def __init__(self):
_safe_super(SafeSuperClass, self).__init__()

@property
def __class__(self):
return int

print(isinstance(SuperClass(), int))
print(isinstance(SafeSuperClass(), int))


Running above code with trace and without trace

➜  cpython git:(master) ✗ ./python.exe /tmp/buz.py
True
True
➜  cpython git:(master) ✗ ./python.exe /tmp/buz.py 1
False
True


There is a test for the above in Lib/test/test_super.py at 
https://github.com/python/cpython/blob/4c409beb4c360a73d054f37807d3daad58d1b567/Lib/test/test_super.py#L87

Add a trace as below in test_super.py at the top and the test case fails

import sys

def trace(frame, event, arg):
return trace

sys.settrace(trace)


➜  cpython git:(master) ✗ ./python.exe Lib/test/test_super.py
F
==
FAIL: test_various___class___pathologies (__main__.TestSuper)
--
Traceback (most recent call last):
  File "Lib/test/test_super.py", line 100, in test_various___class___pathologies
self.assertEqual(x.__class__, 413)
AssertionError: .X'> != 413

--
Ran 21 tests in 0.058s

FAILED (failures=1)


The patch for this issue would be to use _safe_super instead of super() or to 
fallback to object() in the previous case that doesn't seemed to have suffered 
from this case. I can try to make a PR with tests. Added Michael for 
confirmation.


diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 8684f1dfa5..0e77f0e489 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -739,7 +739,7 @@ class NonCallableMock(Base):

 obj = self._mock_children.get(name, _missing)
 if name in self.__dict__:
-super().__delattr__(name)
+_safe_super(NonCallableMock, self).__delattr__(name)
 elif obj is _deleted:
 raise AttributeError(name)
 if obj is not _missing:

--
nosy: +michael.foord

___
Python tracker 

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



[issue36602] Recursive directory list with pathlib.Path.iterdir

2019-04-11 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue1583] Patch for signal.set_wakeup_fd

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:

Please don't discuss on closed issues. Either reopen the issue or open a new 
issue.

--
nosy: +vstinner

___
Python tracker 

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



[issue1583] Patch for signal.set_wakeup_fd

2019-04-11 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> signalmodule.c has a hack to limit it to the main thread.

The Python signal handler always runs in the main thread, but the signal can be 
caught by any thread. In other words, trip_signal() can be run by any thread.

--

___
Python tracker 

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



[issue36601] signals can be caught by any thread

2019-04-11 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Also note that the documentation of the signal module already has the correct 
wording:

Python signal handlers are always executed in the main Python thread, even if 
the signal was received in another thread.

--

___
Python tracker 

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



[issue36389] Add gc.enable_object_debugger(): detect corrupted Python objects in the GC

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4c409beb4c360a73d054f37807d3daad58d1b567 by Victor Stinner in 
branch 'master':
bpo-36389: Change PyMem_SetupDebugHooks() constants (GH-12782)
https://github.com/python/cpython/commit/4c409beb4c360a73d054f37807d3daad58d1b567


--

___
Python tracker 

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



[issue34060] regrtest: log "CPU usage" on Windows

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue36601] signals can be caught by any thread

2019-04-11 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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

___
Python tracker 

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



[issue36602] Recursive directory list with pathlib.Path.iterdir

2019-04-11 Thread Laurie Opperman


New submission from Laurie Opperman :

Currently, 'pathlib.Path.iterdir' can only list the contents of the instance 
directory. It is common to also want the contents of subdirectories recursively.

The proposal is for 'pathlib.Path.iterdir' to have an argument 'recursive' 
which when 'True' will cause 'iterdir' to yield contents of subdirectories 
recursively.

This would be trivial to implement as 'iterdir' can simply yield from 
subdirectories' 'iterdir'.

A decision would have to be made whether to continue to yield the 
subdirectories, or skip them. Another decision would be for whether each path 
should be resolved before checking if it is a directory to be recursed into.

--
components: Library (Lib)
messages: 339959
nosy: Epic_Wink
priority: normal
severity: normal
status: open
title: Recursive directory list with pathlib.Path.iterdir
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue32949] Simplify "with"-related opcodes

2019-04-11 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue36601] signals can be caught by any thread

2019-04-11 Thread Jeroen Demeyer


New submission from Jeroen Demeyer :

Because of some discussion that is happening on #1583 I noticed this bit of 
code in the OS-level signal handler (set by the C function sigaction() or 
signal()):

static void
signal_handler(int sig_num)
{
/* See NOTES section above */
if (getpid() == main_pid)
{
trip_signal(sig_num);
}

The check getpid() == main_pid is claimed to check for the main *thread* but in 
fact it's checking the process ID, which is the same for all threads. So as far 
as I can tell, this condition is always true.

This code essentially goes back to 1994 (commit bb4ba12242), so it may have 
been true at that time that threads were implemented as processes and that 
getpid() returned a different value for different threads.

Note that this code refers to receiving a signal from the OS. In Python, it's 
always handled (by the function registered by signal.signal) by the main 
thread. But the current behaviour actually makes sense, so we should just 
remove the superfluous check and fix the comments in the code.

--
messages: 339958
nosy: Rhamphoryncus, jdemeyer
priority: normal
severity: normal
status: open
title: signals can be caught by any thread

___
Python tracker 

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



[issue36597] Travis CI: doctest failure

2019-04-11 Thread Inada Naoki


Change by Inada Naoki :


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



[issue36389] Add gc.enable_object_debugger(): detect corrupted Python objects in the GC

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12709

___
Python tracker 

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



[issue36600] re-enable test in nntplib

2019-04-11 Thread Marcin Niemira


Change by Marcin Niemira :


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

___
Python tracker 

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



[issue36597] Travis CI: doctest failure

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset ac31da8f3710f9f9b8dbb4c36b2108fb1e5b4a48 by Inada Naoki in branch 
'3.7':
bpo-36597: fix random doctest failure (GH-12778)
https://github.com/python/cpython/commit/ac31da8f3710f9f9b8dbb4c36b2108fb1e5b4a48


--

___
Python tracker 

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



[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Ned Batchelder


Ned Batchelder  added the comment:

BTW, this started as a bug against coverage.py: 
https://github.com/nedbat/coveragepy/issues/795

There are some more details there, including the fact that it must be a Python 
trace function; a C trace function seems not to cause the problem.

--

___
Python tracker 

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



[issue36600] re-enable test in nntplib

2019-04-11 Thread Marcin Niemira


New submission from Marcin Niemira :

Disabled test in not failing anymore.

```./python -m test -u all -v test_nntplib -m test_article_head_body
== CPython 3.8.0a3+ 
(heads/feature/pep-572-improvement-in-smtplib-dirty:f4efa312d1, Apr 8 2019, 
21:0) [GCC 7.3.0]
== Linux-4.15.0-46-generic-x86_64-with-glibc2.26 little-endian
== cwd: /home/n0npax/workspace/cpython/build/test_python_15162
== CPU count: 4
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 1.13 [1/1] test_nntplib
test_article_head_body (test.test_nntplib.NetworkedNNTPTests) ... ok
test_article_head_body (test.test_nntplib.NetworkedNNTP_SSLTests) ... ok

--

Ran 2 tests in 7.172s

OK

== Tests result: SUCCESS ==

1 test OK.

Total duration: 7 sec 282 ms
Tests result: SUCCESS
```

--
messages: 339955
nosy: Marcin Niemira
priority: normal
severity: normal
status: open
title: re-enable test in nntplib

___
Python tracker 

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



[issue36416] bytes.rpartition bug in online documentation

2019-04-11 Thread Inada Naoki


Change by Inada Naoki :


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



[issue36416] bytes.rpartition bug in online documentation

2019-04-11 Thread miss-islington


miss-islington  added the comment:


New changeset 04b114eede82c7ffd7b3d9b40e8bf707780b022b by Miss Islington (bot) 
in branch '3.7':
bpo-36416: Correct bytes.rpartition documentation (GH-12543)
https://github.com/python/cpython/commit/04b114eede82c7ffd7b3d9b40e8bf707780b022b


--
nosy: +miss-islington

___
Python tracker 

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



[issue36599] doctest document says dict order is unstable

2019-04-11 Thread Inada Naoki


Change by Inada Naoki :


--
title: weakref document says dict order is unstable -> doctest document says 
dict order is unstable

___
Python tracker 

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



[issue36416] bytes.rpartition bug in online documentation

2019-04-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12708

___
Python tracker 

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



[issue36575] Use _PyTime_GetPerfCounter() in lsprof

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 536a35b3f14888999f1ffa5be7239d0c26b73d7a by Inada Naoki in branch 
'master':
bpo-36575: lsprof: Use _PyTime_GetPerfCounter() (GH-8378)
https://github.com/python/cpython/commit/536a35b3f14888999f1ffa5be7239d0c26b73d7a


--

___
Python tracker 

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



[issue36575] Use _PyTime_GetPerfCounter() in lsprof

2019-04-11 Thread Inada Naoki


Change by Inada Naoki :


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



[issue36599] weakref document says dict order is unstable

2019-04-11 Thread Inada Naoki

New submission from Inada Naoki :

https://docs.python.org/3/library/doctest.html#warnings

"For example, when printing a dict, Python doesn’t guarantee that the key-value 
pairs will be printed in any particular order,"

This example should be rewritten with set.

--
assignee: docs@python
components: Documentation
messages: 339952
nosy: docs@python, inada.naoki
priority: normal
severity: normal
status: open
title: weakref document says dict order is unstable
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



[issue36597] Travis CI: doctest failure

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset b3c92c6ae923ffb2b9ac5f80b28ecd689de48662 by Inada Naoki in branch 
'master':
bpo-36597: fix weakref example code (GH-12779)
https://github.com/python/cpython/commit/b3c92c6ae923ffb2b9ac5f80b28ecd689de48662


--

___
Python tracker 

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



[issue32308] Replace empty matches adjacent to a previous non-empty match in re.sub()

2019-04-11 Thread Anders Hovmöller

Anders Hovmöller  added the comment:

Just as a comparison, sed does the 3.6 thing:

> echo foo | sed 's/\(.*\)/x\1y/g'
xfooy

--

___
Python tracker 

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



[issue32308] Replace empty matches adjacent to a previous non-empty match in re.sub()

2019-04-11 Thread Anders Hovmöller

Anders Hovmöller  added the comment:

This was a really bad idea in my opinion. We just found this and we have no way 
to know how this will impact production. It's really absurd that 

re.sub('(.*)', r'foo', 'asd')

is "foo" in python 1 to 3.6 but 'foofoo' in python 3.7.

--
nosy: +Anders.Hovmöller

___
Python tracker 

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



[issue36389] Add gc.enable_object_debugger(): detect corrupted Python objects in the GC

2019-04-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +12707

___
Python tracker 

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



[issue36389] Add gc.enable_object_debugger(): detect corrupted Python objects in the GC

2019-04-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 2b00db68554422ec37faba2a80179a0172df6349 by Victor Stinner in 
branch 'master':
bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)
https://github.com/python/cpython/commit/2b00db68554422ec37faba2a80179a0172df6349


--

___
Python tracker 

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



[issue36597] Travis CI: doctest failure

2019-04-11 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +12706

___
Python tracker 

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



[issue36469] Stuck during interpreter exit, attempting to take the GIL

2019-04-11 Thread Remy Noel


Remy Noel  added the comment:

@eric.snow Unless you confirm there is no way to figure out which thread is/was 
holding the GIL from a debugging session on the running process, I'll get rid 
of it at the end of the week.

Should i close the ticket then or will you do it ?

Thanks.

--

___
Python tracker 

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



[issue36597] Travis CI: doctest failure

2019-04-11 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +12705

___
Python tracker 

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



[issue36597] Travis CI: doctest failure

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 57b1a2862a99677f09614e9e456d36aae9ddd87c by Inada Naoki in branch 
'master':
bpo-36597: fix random doctest failure (GH-12776)
https://github.com/python/cpython/commit/57b1a2862a99677f09614e9e456d36aae9ddd87c


--

___
Python tracker 

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



[issue36597] Travis CI: doctest failure

2019-04-11 Thread Inada Naoki


Inada Naoki  added the comment:

I think PR-12776 fixed "obj dead or exiting" error.
https://travis-ci.org/python/cpython/jobs/518656385

--

___
Python tracker 

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



  1   2   >