[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True

2019-06-27 Thread haizaar


haizaar  added the comment:

Thanks for looking at it.

My original code had "tar" running, which is a child of the shell as well... I 
assume running exec in the shell may help somewhat, but not a cure obviously.

I'm all for killing the process group. "Run something and get it's about" 
should be simple enough without requiring a programmer to know all POSIX 
process semantics.

--

___
Python tracker 

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



[issue37429] Python hangs on fork when a logger is in use in a background thread

2019-06-27 Thread Ryan Petrello


Ryan Petrello  added the comment:

Here's the stack of one the hung child processes under py2.7:

(gdb) py-bt
#4 Waiting for a lock (e.g. GIL)
#5 Waiting for a lock (e.g. GIL)
#7 Frame 0x7f346a925430, for file /usr/lib64/python2.7/Queue.py, line 118, in 
put (self=, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, 
_Condition__waiters=[], release=) at remote 0x7f3467df4150>, mutex=, not_full=<_Condition(_Verbose__verbose=False, 
_Condition__lock=, acquire=, 
_Condition__waiters=[], release=) at remote 0x7f3467df4110>, 
not_empty=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _shutdown=False, _max_workers=2, 
_thread_name_prefix='Thread---Type  to continue, or q  to 
quit---
PoolExecutor-0', _threads=set([<...>, <...>]), _work_queue=<...>) at remote 
0x7f3467df0f90>, fn=, 
args=(, process=1155, 
processName='Process-74', args=(), module='hang', filename='hang.py', 
levelno=20, exc_text=None, pathname='/tmp/hang.py', lineno=25, msg='exiting', 
exc_info=None, funcName='exit', relativeCreated=, 
levelname='INFO', msecs=) at remote 
0x7f346a972490>,), kwargs={}, f=, _shutdown=False, _max_workers=2, 
_thread_name_prefix='ThreadPoolExecutor-0', _threads=set([<...>, <...>]), 
_work_queue=<...>) at remote 0x7f3467df0f90>) at remote 0x7f3467df0f50>, 
record=, process=1155, 
processName='Process-74', args=(), module='hang', filename='hang.py', 
levelno=20, exc_text=None, pathname='/tmp/hang.py', lineno=25, msg='exiting', 
exc_info=None, funcName='exit', relativeCreated= to continue, 
or q  to quit---
loat at remote 0x1a7d568>, levelname='INFO', msecs=) 
at remote 0x7f346a972490>)
self.executor.submit(self.send, record)
#19 Frame 0x7f346a925240, for file /usr/lib64/python2.7/logging/__init__.py, 
line 1318, in callHandlers (self=, _shutdown=False, _max_workers=2, 
_thread_name_prefix='ThreadPoolExecutor-0', _threads=set([<...>, <...>]), 
_work_queue=<...>) at remote 0x7f3467df0f90>) at remote 0x7f3467df0f50>], 
level=10, disabled=0, propagate=1, filters=[]) at remote 0x7f3467de1a90>, 
record=, process=1155, 
processName='Process-74', args=(), module='hang', filename='hang.py', 
levelno=20, exc_text=None, pathname='/tmp/hang.py', lineno=25, msg='exiting', 
exc_info=None, funcName='exit', relativeCreated=, 
levelname='INFO', msecs=) at remote 0x7f346a972490>, 
c=<...>, found=1, hdlr=<...>)
hdlr.handle(record)
#22 Frame 0x7f3467df13e0, for file /usr/lib64/python2.7/logging/__init__.py, 
line 1278, in handle (self=, _shut---Type  to continue, or q  to 
quit---
down=False, _max_workers=2, _thread_name_prefix='ThreadPoolExecutor-0', 
_threads=set([<...>, <...>]), _work_queue=<...>) at remote 0x7f3467df0f90>) at 
remote 0x7f3467df0f50>], level=10, disabled=0, propagate=1, filters=[]) at 
remote 0x7f3467de1a90>, record=, 
process=1155, processName='Process-74', args=(), module='hang', 
filename='hang.py', levelno=20, exc_text=None, pathname='/tmp/hang.py', 
lineno=25, msg='exiting', exc_info=None, funcName='exit', 
relativeCreated=, levelname='INFO', msecs=) at remote 0x7f346a972490>)
self.callHandlers(record)
#25 Frame 0x1ae60e0, for file /usr/lib64/python2.7/logging/__init__.py, line 
1268, in _log (self=, _shutdown=False, _max_workers=2, 
_thread_name_prefix='ThreadPoolExecutor-0', _threads=set([<...>, <...>]), 
_work_queue=<...>) at remote 0x7f3467df0f90>) at remote 0x7f3467df0f50>], 
level=10, disabled=0, propagate=1, filters=[]) at remote 0x7f3467de1a90>, 
level=20, msg='exiting', args=(), exc_info=None, extra=None, fn='/tmp/hang.py', 
lno=25, func='exit', record=, process=1155, 
processName='Process-74', args=(...), ---Type  to continue, or q 
 to quit---

Here's the similar stack under py3.6:

(gdb) bt
#0  0x7f208166cadb in futex_abstimed_wait (cancel=true, private=,
abstime=0x0, expected=0, futex=0x88bbf0)
at ../nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c:43
#1  do_futex_wait (sem=sem@entry=0x88bbf0, abstime=0x0)
at ../nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c:223
#2  0x7f208166cb6f in __new_sem_wait_slow (sem=0x88bbf0, abstime=0x0)
at ../nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c:292
#3  0x7f208166cc0b in __new_sem_wait (sem=)
at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:28
#4  0x7f2081a05a80 in PyThread_acquire_lock_timed (lock=0x88bbf0,
microseconds=microseconds@entry=-1, intr_flag=intr_flag@entry=0)
at /usr/src/debug/Python-3.6.8/Python/thread_pthread.h:386
#5  0x7f2081a05c34 in PyThread_acquire_lock (lock=,
waitflag=waitflag@entry=1)
at /usr/src/debug/Python-3.6.8/Python/thread_pthread.h:595
#6  0x7f2081918797 in _enter_buffered_busy (self=self@entry=0x7f2081e29b48)
at /usr/src/debug/Python-3.6.8/Modules/_io/bufferedio.c:292
#7  0x7f2081a1f131 in buffered_flush (self=0x7f2081e29b48, args=)
at /usr/src/debug/Python-3.6.8/Modules/_io/bufferedio.c:852
---Type  to continue, or q  to quit---
#8  0x7f2081962dd0 in _PyCFunction_FastCallDict (

[issue30345] test_gdb fails on Python 3.6 when built with LTO+PGO

2019-06-27 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +14239
pull_request: https://github.com/python/cpython/pull/14423

___
Python tracker 

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



[issue37429] Python hangs on fork when a logger is in use in a background thread

2019-06-27 Thread Ryan Petrello


Ryan Petrello  added the comment:

This issue seems _very_ similar to https://bugs.python.org/issue6721, but I 
wasn't able to encounter the exact stack I've been seeing on my end.  
Specifically, when I run the reproducer script in this issue (hang.py) for a 
few minutes, hung child processes start to build up.

--

___
Python tracker 

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



[issue37429] Python hangs on fork when a logger is in use in a background thread

2019-06-27 Thread Ryan Petrello


New submission from Ryan Petrello :

It's possible to cause Python child processes to encountered a deadlock and 
hang on fork by:

1) Spawning one or more threads in a parent process
2) Have one of those threads emit log lines
3) Have the main thread use os.fork()
4) In the child, log immediately

The attached Python script can be used to reproduce this issue in Python 2.7.15 
and Python 3.6.5

--
components: Library (Lib)
files: hang.py
messages: 346732
nosy: ryan.petrello
priority: normal
severity: normal
status: open
title: Python hangs on fork when a logger is in use in a background thread
versions: Python 2.7, Python 3.6
Added file: https://bugs.python.org/file48441/hang.py

___
Python tracker 

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



[issue37427] sorted() and list.sort() don't accept non-boolean objects with __bool__() as `reverse` parameter

2019-06-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I'm finding it rather hard to guess what the rules are for what works and 
> what doesn't

So now that I've looked at the source: anything with an `__int__` method works, 
except that `float` instances are explicitly excluded. So this explains for 
example:

>>> sorted([1, 2, 3], reverse=numpy.float64(0.5))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: integer argument expected, got float
>>> sorted([1, 2, 3], reverse=numpy.float32(0.5))
[1, 2, 3]

--

___
Python tracker 

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



[issue37427] sorted() and list.sort() don't accept non-boolean objects with __bool__() as `reverse` parameter

2019-06-27 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +tim.peters

___
Python tracker 

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



[issue37427] sorted() and list.sort() don't accept non-boolean objects with __bool__() as `reverse` parameter

2019-06-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

I haven't looked at the source yet, but from experimentation I'm finding it 
rather hard to guess what the rules are for what works and what doesn't:

Python 3.7.3 (default, Mar 30 2019, 03:37:43) 
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal, fractions, numpy
>>> sorted([1, 2, 3], reverse=0.5)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: integer argument expected, got float
>>> sorted([1, 2, 3], reverse=decimal.Decimal(0.5))
[1, 2, 3]
>>> sorted([1, 2, 3], reverse=fractions.Fraction(0.5))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: an integer is required (got type Fraction)
>>> sorted([1, 2, 3], reverse=numpy.int64(1))
[3, 2, 1]
>>> sorted([1, 2, 3], reverse=numpy.bool_(True))
[3, 2, 1]

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue33926] test_gdb is skipped in builds since gdb is not installed as part of build script

2019-06-27 Thread miss-islington


miss-islington  added the comment:


New changeset 7e9d706fd6e2f49d2bd829890c46868105767769 by Miss Islington (bot) 
in branch '3.8':
bpo-33926: enable GDB tests on Travis CI (GH-14395)
https://github.com/python/cpython/commit/7e9d706fd6e2f49d2bd829890c46868105767769


--
nosy: +miss-islington

___
Python tracker 

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



[issue36889] Merge StreamWriter and StreamReader into just asyncio.Stream

2019-06-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14238
pull_request: https://github.com/python/cpython/pull/14422

___
Python tracker 

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



[issue37428] SSLContext.post_handshake_auth implicitly enables cert validation

2019-06-27 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue33926] test_gdb is skipped in builds since gdb is not installed as part of build script

2019-06-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14236
pull_request: https://github.com/python/cpython/pull/14420

___
Python tracker 

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



[issue33926] test_gdb is skipped in builds since gdb is not installed as part of build script

2019-06-27 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 667eaffb4e5d03bf8129773f79649c3befaa5b1a by Inada Naoki (Jeroen 
Demeyer) in branch 'master':
bpo-33926: enable GDB tests on Travis CI (GH-14395)
https://github.com/python/cpython/commit/667eaffb4e5d03bf8129773f79649c3befaa5b1a


--
nosy: +inada.naoki

___
Python tracker 

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



[issue37426] getpass.getpass not working with on windows when ctrl+v is used to enter the string

2019-06-27 Thread Eryk Sun


Eryk Sun  added the comment:

getpass() reads from the console via msvcrt.getwch(). This is a raw console 
read, so Ctrl+V is read as the SYN (0x16) control character. Only the following 
keys are handled specially by getpass: 

* Ctrl+C - raise KeyboardInterrupt
* Ctrl+H (backspace) - delete the previous character
* Ctrl+J (linefeed) and Ctrl+M (return) - return

getpass() behaves pretty much the same in a Linux terminal emulator, except 
Ctrl+H isn't backspace. 

Recent versions of the console host in Windows 10 have an option to support 
pasting via Ctrl+Shift+V, regardless of the input mode. This is pretty common 
in Unix terminal emulators as well. You can change this setting in the 
Properties->Options dialog for a particular window or shortcut, or the default 
setting in the Defaults->Options dialog. In the "HKCU\Console" registry key, 
the DWORD value name is "InterceptCopyPaste".

--
nosy: +eryksun

___
Python tracker 

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



[issue37416] If threading is not imported from the main thread it sees the wrong thread as the main thread.

2019-06-27 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

Understood. Thank you for the extra info. I'll read up on all the suggestions.

--

___
Python tracker 

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



[issue37428] SSLContext.post_handshake_auth implicitly enables cert validation

2019-06-27 Thread Christian Heimes


New submission from Christian Heimes :

Enabling TLS 1.3 post handshake auth also enables cert chain validation. 
OpenSSL documents SSL_VERIFY_POST_HANDSHAKE as ignored for client side. However 
tls_process_server_certificate in the client state machine code does not ignore 
the flag and checks for a correct cert chain.

see https://github.com/openssl/openssl/issues/9259 and 
https://github.com/openssl/openssl/blob/743694a6c29e5a6387819523fad5e3b7e613f1ee/ssl/statem/statem_clnt.c#L1899-L1918

--
assignee: christian.heimes
components: SSL
messages: 346725
nosy: christian.heimes
priority: high
severity: normal
status: open
title: SSLContext.post_handshake_auth implicitly enables cert validation
type: behavior
versions: Python 2.7, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue37426] getpass.getpass not working with on windows when ctrl+v is used to enter the string

2019-06-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue37416] If threading is not imported from the main thread it sees the wrong thread as the main thread.

2019-06-27 Thread Pavel Minaev


Pavel Minaev  added the comment:

It's also possible to hit if using some native code that starts a background 
thread without going via threading, and runs Python code on that background 
thread. In that case, if that Python code then does "import threading", and 
threading hasn't been imported yet, then you have this same problem.

Here's a pure Python repro using ctypes on Win32:

#--
import sys, time
from ctypes import *

ThreadProc = WINFUNCTYPE(c_uint32, c_void_p)

@ThreadProc
def thread_proc(_):
import threading
print(threading.current_thread() is threading.main_thread())
return 0

assert "threading" not in sys.modules
#import threading  # uncomment to fix

windll.kernel32.CreateThread(None, c_size_t(0), thread_proc, None, c_uint32(0), 
None)
time.sleep(1)

assert "threading" in sys.modules
import threading
print(threading.current_thread() is threading.main_thread())
#--

Here's the output:

>py -3 main.py
True
False
Exception ignored in: 
Traceback (most recent call last):
  File "C:\Python\3.7-64\lib\threading.py", line 1276, in _shutdown
assert tlock.locked()
AssertionError:

--

___
Python tracker 

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



[issue37427] sorted() and list.sort() don't accept non-boolean objects with __bool__() as `reverse` parameter

2019-06-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue37416] If threading is not imported from the main thread it sees the wrong thread as the main thread.

2019-06-27 Thread Pavel Minaev


Pavel Minaev  added the comment:

This is a bit tricky to explain... There's no easy way to achieve this effect 
"normally". It manifests due to the way some Python debuggers (specifically, 
pydevd and ptvsd - as used by PyCharm, PyDev, and VSCode) implement 
non-cooperative attaching to a running Python process by PID.

A TL;DR take is that those debuggers have to inject a new thread into a running 
process from the outside, and then run some Python code on that thread. There 
are OS APIs for such thread injection - e.g. CreateRemoteThread on Windows. 
There are various tricks that they then have to use to safely acquire GIL and 
invoke PyEval_InitThreads, but ultimately it comes down to running Python code.

That is the point where this can manifest. Basically, as soon as that injected 
code (i.e. the actual debugger) imports threading, things break. And advanced 
debuggers do need background threads for some functionality...

Here are the technical details - i.e. how thread injection happens exactly, and 
what kind of code it might run - if you're interested.
https://github.com/microsoft/ptvsd/issues/1542

I think that a similar problem can also occur in an embedded Python scenario 
with multithreading. Consider what happens if the hosted interpreter is 
initialized from the main thread of the host app - but some Python code is then 
run from the background thread, and that code happens to be the first in the 
process to import threading. Then that background thread becomes the "main 
thread" for threading, with the same results as described above.

The high-level problem, I think, is that there's an inconsistency between what 
Python itself considers "main thread" (i.e. main_thread in ceval.c, as set by 
PyEval_InitThreads), and what threading module considers "main thread" (i.e. 
_main_thread in threading.py). Logically, these should be in sync.

If PyEval_InitThreads is the source of truth, then the existing thread 
injection technique will "just work" as implemented already in all the 
aforementioned debuggers. It makes sure to invoke PyEval_InitThreads via 
Py_AddPendingCall, rather than directly from the background thread, precisely 
so that the interpreter doesn't get confused. 

Furthermore, on 3.7+, PyEval_InitThreads is already automatically invoked by 
Py_Initialize, and hence when used by python.exe, will mark the actual first 
thread in the process as the main thread. So, using it a the source of truth 
would guarantee that attach by thread injection works correctly in all 
non-embedded Python scenarios.

Apps hosting Python would still need to ensure that they always call 
Py_Initialize on what they want to be the main thread, as they already have to 
do; but they wouldn't need to worry about "import threading" anymore.

--

___
Python tracker 

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



[issue37427] sorted() and list.sort() don't accept non-boolean objects with __bool__() as `reverse` parameter

2019-06-27 Thread NODA, Kai


New submission from NODA, Kai :

class X:
def __bool__(self):
return True

x = [1, 2, 3]
x.sort(reverse=X())
print(x)
print(sorted([1, 2, 3], reverse=X()))

TypeError: an integer is required (got type X)

We can always still do

x.sort(reverse=bool(X()))
print(sorted([1, 2, 3], reverse=bool(X(

but that isn't cool

--
components: Interpreter Core
messages: 346722
nosy: nodakai
priority: normal
severity: normal
status: open
title: sorted() and list.sort() don't accept non-boolean objects with 
__bool__() as `reverse` parameter
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue37426] getpass.getpass not working with on windows when ctrl+v is used to enter the string

2019-06-27 Thread Atul Bagga


New submission from Atul Bagga :

Detailed issue filed here - https://github.com/microsoft/knack/issues/160

--
components: Library (Lib)
messages: 346721
nosy: Atul Bagga
priority: normal
severity: normal
status: open
title: getpass.getpass not working with on windows when ctrl+v  is used to 
enter the string
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



[issue37416] If threading is not imported from the main thread it sees the wrong thread as the main thread.

2019-06-27 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

The second import actually doesn't happen. You need to reload it. This can be 
tested by putting print('loading threading') in threading.py.

Your first method-thread will still think it's main thread. So no idea if this 
is a bug or wrong use. 'import threading' should be one of the first lines in 
your main code/thread?


import _thread
import time
import importlib
barrier = 0

def method():
import threading  # Will make threading the wrong thread.
global barrier
print(threading.main_thread())
print(threading.current_thread())
barrier = 1

_thread.start_new_thread(method, ())

while barrier != 1:
time.sleep(.1)

import threading
importlib.reload(threading)
print(threading.main_thread())
print(threading.current_thread())

--
nosy: +aldwinaldwin

___
Python tracker 

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



[issue32926] Add public TestCase method/property to get result of current test

2019-06-27 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
pull_requests:  -14235

___
Python tracker 

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



[issue32926] Add public TestCase method/property to get result of current test

2019-06-27 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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

___
Python tracker 

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



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-06-27 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

I am not sure I understand the use case. Other than "unmounting a mount point" 
the other scenarios look unrealistic to me and also require a fd instead of a 
path. Also, if you want to unmount a path you can do so via *onerror* instead 
(unmount + delete). Pre-emptively checking if you have the permission to do 
something is sort of unpythonic and racy.

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



[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True

2019-06-27 Thread Martin Panter

Martin Panter  added the comment:

Same thing going on as in Issue 30154. The shell is probably spawning the 
“sleep” command as a child process (grandchild of Python), and waiting for it 
to exit. When Python times out, it will kill the shell process, leaving the 
grandchild as an orphan. The “sleep” process will still be running and probably 
holds the “stdout” and/or “stderr” pipes open, and Python will wait 
indefinitely to be sure it has captured all the output to those pipes.

Also see Issue 26534 proposes APIs to kill a process group rather than the 
single child process.

--
nosy: +martin.panter
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> subprocess.run with stderr connected to a pipe won't timeout 
when killing a never-ending shell commanad

___
Python tracker 

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



[issue36656] Please add race-free os.link and os.symlink wrapper / helper

2019-06-27 Thread Tal Einat


Tal Einat  added the comment:

I think there is a general flaw with the suggested implementation approach.

An infinite loop as currently suggested seems dangerous to me.  For example, it 
could cause a program to stall indefinitely in some unforeseen edge-case.  I 
don't think this would be acceptable for something in the stdlib.

On the other hand, limiting this loop to a finite number of attempts would 
re-introduce the necessity of handling the case where creating the symlink 
fails. Users of the function would still need to deal with this case (or risk 
unhandled exceptions).

In either case, this wouldn't give users the simplicity and peace of mind that 
a truly atomic operation would.  ISTM that only using actually atomic 
operations, as provided by the underlying file system and/or OS, would allow us 
to provide that.

Given the above, I must say that I don't see this providing enough utility to 
justify inclusion in the stdlib, unless a better implementation approach can be 
found.

--
nosy: +taleinat

___
Python tracker 

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



[issue32926] Add public TestCase method/property to get result of current test

2019-06-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +ezio.melotti, michael.foord, rbcollins
stage: patch review -> 
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue32926] Add public TestCase method/property to get result of current test

2019-06-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests:  -14234

___
Python tracker 

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



[issue36656] Please add race-free os.link and os.symlink wrapper / helper

2019-06-27 Thread Tal Einat


Change by Tal Einat :


--
components: +Library (Lib)
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue32926] Add public TestCase method/property to get result of current test

2019-06-27 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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

___
Python tracker 

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



[issue33926] test_gdb is skipped in builds since gdb is not installed as part of build script

2019-06-27 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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

___
Python tracker 

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



[issue37415] Error build Python with Intel compiler

2019-06-27 Thread Borja


Borja  added the comment:

In pyconfig.h the variable HAVE_STD_ATOMIC appears like this:

/* Has stdatomic.h with atomic_int */
#define HAVE_STD_ATOMIC 1

I searched at  atomic_uintptr_t and found nothing.

--

___
Python tracker 

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



[issue37416] If threading is not imported from the main thread it sees the wrong thread as the main thread.

2019-06-27 Thread Pavel Minaev


Change by Pavel Minaev :


--
nosy: +int19h

___
Python tracker 

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



[issue37425] Using Pyinstaller with (Anaconda) Python 3.7.3 needs PyQt5 even if not imported in code

2019-06-27 Thread Sameer Bobade


New submission from Sameer Bobade :

I am writing a test code with Python and tested that it works on both Python 
3.7 and 3.7.3
The code uses tkinter, and does not use PyQT5
I use pyinstaller 3.4 I convert the python to exe.

With the same code and and same dependencies (including version number) - while 
converting code to exe using pyinstaller 3.4, with Python 3.7.3 - Pyinstaller 
asks for additional imports related to PyQt5 (and maybe more). This causes 
executable to expand in size with unwanted dependencies bundled in output.

Doing same thing with Python 3.7 removes the issue.
Not sure if this is Anaconda specific or general Python issue.

Both tests were done in virtual environment with Anaconda Python 3.7.3 as base.
Attached logs from pyinstaller for both versions.

Also reported to Anaconda - 
https://github.com/Anaconda-Platform/anaconda-project/issues/207

--
components: Windows
files: pyinstallerlog.zip
messages: 346715
nosy: Sameer Bobade, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Using Pyinstaller with (Anaconda) Python 3.7.3 needs PyQt5 even if not 
imported in code
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48440/pyinstallerlog.zip

___
Python tracker 

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



[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True

2019-06-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

On mac this exits immediately with 0.1 seconds as timeout but reproducible on 
Ubuntu with master.

--
nosy: +gregory.p.smith, xtreak

___
Python tracker 

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



[issue35389] Use gnu_get_libc_version() in platform.libc_ver()?

2019-06-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a719c8f4bd3cc5b1d98700c15c4a818f4d5617a4 by Victor Stinner in 
branch 'master':
bpo-35389: platform.platform() calls libc_ver() without executable (GH-14418)
https://github.com/python/cpython/commit/a719c8f4bd3cc5b1d98700c15c4a818f4d5617a4


--

___
Python tracker 

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



[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True

2019-06-27 Thread haizaar


New submission from haizaar :

Consider the following:

subprocess.run('sleep 10', shell=True, timeout=.1, capture_output=True)

It should raise after 0.1 seconds, but it does not - it waits 10 seconds till 
sleep finishes and only then raises "subprocess.TimeoutExpired: Command 'sleep 
10' timed out after 0.1 seconds"

Removing 'capture_output=True' or converting command string to list (and 
removing shell=True) makes it work.

I'm using Python 3.7.3 on Ubuntu 16.04. Reproduces on official docker Python 
3.7.3 image alpine3.8.

--
components: Library (Lib)
messages: 346712
nosy: haizaar
priority: normal
severity: normal
status: open
title: subprocess.run timeout does not function if shell=True and 
capture_output=True
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



<    1   2