[issue22107] tempfile module misinterprets access denied error on Windows

2021-07-08 Thread bugale bugale


Change by bugale bugale :


--
nosy: +bugale bugale

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



[issue44527] subprocess.run gets stuck indefinitely

2021-06-28 Thread bugale bugale


New submission from bugale bugale :

The implementation for subprocess.run on Windows has a bug that causes it to 
hang indefinitely in some scenarios.
The issue can be easily reproduced by this code:

import subprocess
subprocess.run(['cmd.exe', '/c', 'ping 1.2.3.4 -n '], capture_output=True, 
timeout=1)

Instead of exiting after 1 second, it hangs indefinitely.

After looking at the code a bit, I found the issue:
https://github.com/python/cpython/blob/efe7d08d178a7c09bcca994f2068b019c8633d83/Lib/subprocess.py#L512

if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads.  communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()

In the case of Windows, after the process is killed, communicate is called 
without a timeout. This usually works because after the process is killed the 
pipes are closed and the communicate returns almost immediately.
However, if the created subprocess created other processes that hold the pipes, 
they are not closed and this line blocks indefinitely.

--
components: Library (Lib)
messages: 396653
nosy: bugale bugale
priority: normal
severity: normal
status: open
title: subprocess.run gets stuck indefinitely
type: behavior
versions: Python 3.9

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



[issue43284] Wrong windows build post version 2004

2021-03-02 Thread bugale bugale


bugale bugale  added the comment:

Is there a good reason to not use GetVersionEx?

--

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



[issue43284] Wrong windows build in 20H2

2021-02-21 Thread bugale bugale


New submission from bugale bugale :

Running `platform.platform()` on Windows 10 20H2 results in the build number 
19041:

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Windows-10-10.0.19041-SP0'

This is incorrect, the build number is 19042.
Using ctypes like in the answer here produces a correct result:
https://stackoverflow.com/questions/3234/python-ctypes-getting-0-with-getversionex-function

------
components: Windows
messages: 387450
nosy: bugale bugale, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Wrong windows build in 20H2
type: behavior
versions: Python 3.9

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



[issue32172] Add length counter for iterables

2017-11-29 Thread bugale bugale

New submission from bugale bugale <buga...@gmail.com>:

I have noticed that there is no convenient way in python to get the number of 
items in a generator.

For example:
  my_iterable = iter(range(1000))
  len(my_iterable) # Would not work

Of course, something like this would ruin the generator, and it will no longer 
be usable, but in some use cases one would like to know only the count of 
something.

It is possible to do it today using this line:
  sum(1 for x in my_iterable)

but it seems odd to me that there is no function like:
  itertools.count_iterable(my_iterable)
that does exactly this

--
components: Demos and Tools
messages: 307271
nosy: bugale bugale
priority: normal
severity: normal
status: open
title: Add length counter for iterables
type: enhancement
versions: Python 3.8

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32172>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com