[issue43574] Regression in overallocation for literal list initialization in v3.9+

2021-03-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue33935] [Windows] samefile() should not use zero-valued st_dev and st_ino

2021-03-20 Thread Eryk Sun


Change by Eryk Sun :


--
title: shutil.copyfile throws incorrect SameFileError on Google Drive File 
Stream -> [Windows] samefile() should not use zero-valued st_dev and st_ino

___
Python tracker 

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



[issue4198] os.path.normcase gets fooled on windows with mapped linux network drive

2021-03-20 Thread Eryk Sun


Eryk Sun  added the comment:

Filesystem paths in Windows are normally opened case insensitive, but a 
filesystem can choose to ignore this. NTFS does so for directories that flagged 
as case sensitive [1]. ntpath.normcase() doesn't incorporate this information. 
It would have to query the case-sensitive information for each component in the 
path. Instead it just assumes that all path components are case insensitive. 
That said, the way it does this does not correspond to how Windows filesystems 
implement case-insensitive comparisons. See bpo-42658. If supporting 
case-sensitive directories is needed, it should be addressed in that issue.

> same = os.path.samefile(f, f)
> print(same) # expected True; got False

I just followed up on investigating this. Apparently the VirtualBox 
"VBoxSharedFolderFS" filesystem generates a different file reference number 
randomly on each access. This violates the requirements for 
FileInternalInformation as specified in [MS-FSCC][2]. If file reference numbers 
aren't supported, the filesystem is supposed to return 0. That said, Python's 
samefile() doesn't currently follow the spec either. It blindly uses the st_dev 
(volume serial number) and st_ino (file reference number) values even when 
they're 0. See bpo-33935.

---

[1] 
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_case_sensitive_information
[2] 
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/7d796611-2fa5-41ac-8178-b6fea3a017b3

--
resolution:  -> not a bug
stage: needs patch -> 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



[issue33935] shutil.copyfile throws incorrect SameFileError on Google Drive File Stream

2021-03-20 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Extension Modules
versions: +Python 3.10, 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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-20 Thread Andrew Dailey


New submission from Andrew Dailey :

Hello,

I think I might've stumbled onto an oversight with how an SSLSocket handles 
overwriting its SSLContext within an sni_callback. If both "_msg_callback" and 
"sni_callback" are defined on an SSLContext object and the sni_callback 
replaces the context with new one, the interpreter locks up indefinitely. It 
fails to respond to keyboard interrupts and must be forcefully killed.

This seems to be a common use case of the sni_callback: create a new context 
with a different cert chain and attach it to the current socket (which replaces 
the existing one). If _msg_callback never gets defined on the original context 
then this deadlock never occurs. Curiously, if you assign the same 
_msg_callback to the new context before replacement, this also avoids the 
deadlock.

I've attached as minimal of a reproduction as I could come up with. I think the 
code within will probably do a better job explaining this problem than I've 
done here in prose. I've only tested it on a couple Linux distros (Ubuntu 
Server and Void Linux) but the lock occurs 100% of the time in my experience.

In the brief time I've spent digging into the CPython source, I've come to 
understand that replacing the SSLContext on an SSLSocket isn't "just" a simple 
replacement but actually involves some OpenSSL mechanics (specifically, 
SSL_set_SSL_CTX) [0]. I'm wondering if maybe this context update routine isn't 
properly cleaning up whatever resources / references were being used by the 
msg_callback? Maybe this is even closer to an OpenSSL bug (or a least a gotcha)?

I also feel the need to explain why I'd even be using an undocumented property 
(SSLContext._msg_callback) in the first place. I'm trying to implement a 
program that automatically manages TLS certs on a socket via Let's Encrypt and 
the ACME protocol (RFC8555). Part of this process involves serving up a 
specific cert when a connection requests the acme-tls/1 ALPN protocol. Given 
the existing Python SSL API, I don't believe there is any way for me to do this 
"correctly".

The documentation for SSLContext.sni_callback [1] mentions that the 
selected_alpn_protocol function should be usable within the callback but I 
don't that is quite true. According to the OpenSSL docs [2]:
Several callbacks are executed during ClientHello processing, including the 
ClientHello, ALPN, and servername callbacks. The ClientHello callback is 
executed first, then the servername callback, followed by the ALPN callback.

If there is a better way for me to identify a specific ALPN protocol _before_ 
the sni_callback, I could definitely use the guidance. That would avoid this 
deadlock altogether (even though it'd still be waiting to catch someone 
else...).

This is my first Python issue so I hope what I've supplied makes sense. If 
there is anything more I can do to help or provide more info, please let me 
know.

[0] https://github.com/python/cpython/blob/3.9/Modules/_ssl.c#L2194
[1] https://docs.python.org/3/library/ssl.html#ssl.SSLContext.sni_callback
[2] 
https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_tlsext_servername_callback.html

--
assignee: christian.heimes
components: SSL
files: deadlock.zip
messages: 389216
nosy: christian.heimes, theandrew168
priority: normal
severity: normal
status: open
title: Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback
type: behavior
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49897/deadlock.zip

___
Python tracker 

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



[issue43576] python3.6.4 os.environ error when write chinese to file

2021-03-20 Thread rushant

New submission from rushant <953779...@qq.com>:

# -*- coding: utf-8 -*-
import os
job_name = os.environ['a']
print(job_name)
print(isinstance(job_name, str))
print(type(job_name))
with open('name.txt', 'w', encoding='utf-8')as fw:
fw.write(job_name)


i have set environment param by :
export a="中文"
it returns error:
中文
True

Traceback (most recent call last):
  File "aa.py", line 8, in 
fw.write(job_name)
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-5: 
surrogates not allowed

--
components: C API
messages: 389215
nosy: rushant
priority: normal
severity: normal
status: open
title: python3.6.4 os.environ error when write chinese to file
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



[issue43447] Generate vectorcall code to parse arguments using Argument Clinic

2021-03-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

I agree with we should update AC to generate vectorcall.
I am going to investigate what we can :)

--

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Vedran Čačić

Vedran Čačić  added the comment:

Yes, I know what strong typing means, and can you please read again what I've 
written? It was exactly about "In the face of ambiguity, refuse the temptation 
to guess.", because binary operators are inherently ambiguous when given 
differently typed operands. Methods are not: the method _name_ itself is 
resolved according to self's type, it seems obvious to me that the arguments 
should too. Otherwise "explicit fanatics" would probably want to write 
list.append(things, more) instead of things.append(more).

The only reason we're having this conversation is that when it was introduced, 
`join` was a function, not a method. If it were a method from the start, we 
would've never even questioned its stringification of the iterable elements 
(and of course it would do that from the start, cf. set or dict update methods).

Gregory: yes, `bytes` elements are a problem, but that's a completely 
orthogonal problem (probably best left for linters). The easiest way to see it: 
do you object to (the current behavior of)

>>> s = {2, 7}
>>> s.update(b'Veky')

? :-)

--

___
Python tracker 

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



[issue43572] "Too many open files" on macOS buildbot

2021-03-20 Thread Matt Billenstein


Matt Billenstein  added the comment:

Ah, word, was looking at stdout -- 256 is pretty low, raised it to 200k...

--

___
Python tracker 

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



[issue43575] map() instantiation time reducing by using PEP 590 vectorcall

2021-03-20 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue43572] "Too many open files" on macOS buildbot

2021-03-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

>> I don't see that error message - where are you seeing it?


You need to search for it in the full log:


stderr:
---
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/test/test_importlib/partial/pool_in_threads.py",
 line 9, in t
with multiprocessing.Pool(1):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/context.py",
 line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/pool.py",
 line 212, in __init__
self._repopulate_pool()
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/pool.py",
 line 303, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/pool.py",
 line 326, in _repopulate_pool_static
w.start()
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/process.py",
 line 121, in start
self._popen = self._Popen(self)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/context.py",
 line 284, in _Popen
return Popen(process_obj)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/popen_spawn_posix.py",
 line 32, in __init__
super().__init__(process_obj)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/popen_fork.py",
 line 19, in __init__
self._launch(process_obj)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/popen_spawn_posix.py",
 line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-macos/build/Lib/multiprocessing/spawn.py",
 line 176, in get_preparation_data
dir=os.getcwd(),
OSError: [Errno 24] Too many open files

--

___
Python tracker 

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



[issue43575] map() instantiation time reducing by using PEP 590 vectorcall

2021-03-20 Thread Dong-hee Na


New submission from Dong-hee Na :

+---+--+--+
| Benchmark | map_bench_master | map_bench_vectorcall |
+===+==+==+
| bench map | 151 ns   | 116 ns: 1.30x faster |
+---+--+--+

We already apply this feature for filter().
No reason not to apply map().

--
assignee: corona10
components: Interpreter Core
files: map_bench.py
messages: 389210
nosy: corona10, vstinner
priority: normal
severity: normal
status: open
title: map() instantiation time reducing by using PEP 590 vectorcall
type: performance
versions: Python 3.10
Added file: https://bugs.python.org/file49896/map_bench.py

___
Python tracker 

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



[issue43574] Regression in overallocation for literal list initialization in v3.9+

2021-03-20 Thread Chad Netzer


Change by Chad Netzer :


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

___
Python tracker 

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



[issue43572] "Too many open files" on macOS buildbot

2021-03-20 Thread Matt Billenstein


Matt Billenstein  added the comment:

In any case - I've raised file/process limits on the buildbot.

--

___
Python tracker 

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



[issue42137] Prefer using __spec__ over module_repr() for ModuleType.__repr__

2021-03-20 Thread Brett Cannon


Change by Brett Cannon :


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

___
Python tracker 

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



[issue43572] "Too many open files" on macOS buildbot

2021-03-20 Thread Matt Billenstein


Matt Billenstein  added the comment:

I don't see that error message - where are you seeing it?

--

___
Python tracker 

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



[issue42137] Prefer using __spec__ over module_repr() for ModuleType.__repr__

2021-03-20 Thread Brett Cannon


Change by Brett Cannon :


--
dependencies:  -[importlib] deprecate module_repr() methods

___
Python tracker 

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



[issue43574] Regression in overallocation for literal list initialization in v3.9+

2021-03-20 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue43574] Regression in overallocation for literal list initialization in v3.9+

2021-03-20 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +serhiy.storchaka, vstinner

___
Python tracker 

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



[issue43574] Regression in overallocation for literal list initialization in v3.9+

2021-03-20 Thread Chad Netzer


New submission from Chad Netzer :

In Python v3.9+ there was a regression in the amount of used memory for
list-literals, due to switching to using list_extend() to allocate memory for
the new list to accomodate the literal elements.

Example, in Python v3.8.x (and before):
```
$ python38
Python 3.8.5 (default, Sep  4 2020, 02:22:02)
>>> [1].__sizeof__()
48
>>> [1,2].__sizeof__()
56
>>> [1,2,3].__sizeof__()
64
```

whereas for v3.9 (and later):
```
$ python39
Python 3.9.2 (default, Feb 19 2021, 17:09:53)
>>> [1].__sizeof__()
48
>>> [1,2].__sizeof__()
56
>>> [1,2,3].__sizeof__()
104  # a 60% increase in memory allocated
```

However, this seems like an unintented regression, and is a side-effect of the
new way of building the lists from literals, using the list_extend() function 
(via
list_resize(), which overallocates).  In particular, a consequence is that
making a copy of the list that's initialized from a literal can end up using
less memory:
```
$ python39
Python 3.9.2 (default, Feb 19 2021, 17:09:53)
>>> a = [1,2,3]
>>> b = list(a)  # Same behavior if list.copy() or slice copy is performed
>>> a.__sizeof__()
104
>>> b.__sizeof__()
64
```

Prior to v3.9, the byte-code for making a list from a literal had the
"BUILD_LIST" opcode with an explicit length argument, allowing allocation of
the exact amount of memory needed for the literal.  As of v3.9, the
LIST_EXTEND opcode is used, instead.  I believe the simplest way of restoring
the old behavior is to change list_extend() to not overallocate when the list
being extended currently has 0 elements.


Ie. a minimal-change patch to restore the previous behavior (though with a
side-effect of removing the overallocaton of a list that is initialzed empty,
and then immediately extended):

diff --git a/Objects/listobject.c b/Objects/listobject.c
index e7987a6d35..7820e033af 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -75,8 +75,9 @@ list_resize(PyListObject *self, Py_ssize_t newsize)
 if (newsize - Py_SIZE(self) > (Py_ssize_t)(new_allocated - newsize))
 new_allocated = ((size_t)newsize + 3) & ~(size_t)3;

-if (newsize == 0)
-new_allocated = 0;
+/* Don't overallocate for lists that start empty or are set to empty. */
+if (newsize == 0 || Py_SIZE(self) == 0)
+new_allocated = newsize;
 num_allocated_bytes = new_allocated * sizeof(PyObject *);
 items = (PyObject **)PyMem_Realloc(self->ob_item, num_allocated_bytes);
 if (items == NULL) {



Relevant/related bugs/PRs:
# Switched to initializing list literals w/ LIST_EXTEND
https://bugs.python.org/issue39320
https://github.com/python/cpython/pull/17984

# Commit where over-allocation of list literals first appeared
https://bugs.python.org/issue38328
https://github.com/python/cpython/pull/17114
https://github.com/python/cpython/commit/6dd9b64770af8905bef293c81d541eaaf8d8df52

https://bugs.python.org/issue38373
https://github.com/python/cpython/pull/18952
https://github.com/python/cpython/commit/2fe815edd6778fb9deef8f8044848647659c2eb8

--
components: Interpreter Core
messages: 389207
nosy: Chad.Netzer
priority: normal
severity: normal
status: open
title: Regression in overallocation for literal list initialization in v3.9+
type: resource usage
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue42137] Prefer using __spec__ over module_repr() for ModuleType.__repr__

2021-03-20 Thread Brett Cannon


Brett Cannon  added the comment:

Thinking about it more, raising ImportWarning (or DeprecationWarning) is 
unnecessarily noisy as the existence of the module isn't problematic, it just 
won't be used anymore in the future. So updating the code to use __spec__ first 
and then document in "What's New" should be good enough.

--
assignee:  -> brett.cannon
title: Raise an ImportWarning for calling module_repr() on loaders -> Prefer 
using __spec__ over module_repr() for ModuleType.__repr__

___
Python tracker 

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



[issue42914] pprint numbers with underscore

2021-03-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't think underscores can be on by default.  It needs to be opt-in to be 
backwards compatible.

--

___
Python tracker 

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



[issue43573] [types] Document __spec__ for types.ModuleType

2021-03-20 Thread Brett Cannon


New submission from Brett Cannon :

https://docs.python.org/3/library/types.html#types.ModuleType does not document 
__spec__.

--
assignee: docs@python
components: Documentation
messages: 389204
nosy: brett.cannon, docs@python
priority: normal
severity: normal
status: open
title: [types] Document __spec__ for types.ModuleType
versions: Python 3.10, 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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2021-03-20 Thread Eryk Sun


Eryk Sun  added the comment:

> oh, I missed that a notification happens to the other process(es) in a 
> common case, a bit of retrying with backoff would actually make sense 

The other common problem with deleting an empty directory is when it's opened 
as the working directory of a process. This case fails as a sharing violation 
because the open doesn't share delete access. There's nothing reasonable to do 
about it without user interaction, which would be a complicated bit of code: 
find the process that has the directory open, display a message to the user in 
the desktop session of the process, and wait for a response. That's not a good 
candidate for the standard library.

--

___
Python tracker 

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



[issue40894] asyncio.gather() cancelled() always False

2021-03-20 Thread Ben Buchwald


Ben Buchwald  added the comment:

Hopefully I'm not too late to comment on this. I also just hit this issue, but 
I do not agree with the proposed PR. Only modifying 
_GatheringFuture.cancelled() just fixes one of the side-effects of the problem. 
The state of the future is still FINISHED and not CANCELLED and there are still 
other differences that can be observed due to this. When calling .exception() a 
cancelled future should *raise* a CancelledError, but with a _GatheringFuture 
it will return a CancelledError regardless of the value that .cancelled() 
returns. Also, if you don't fetch the exception of a future, when it gets 
deleted it will warn you, but this is not supposed to happen with cancellation. 
This unexpected warning was how I discovered that I have this issue, and the 
proposed fix doesn't solve my case.

Instead of overriding .cancelled() on _GatheringFuture, gather() should be 
updated to actually cancel the _GatheringFuture. I suggest that in gather's 
_done_callback this:

if outer._cancel_requested:
# If gather is being cancelled we must propagate the
# cancellation regardless of *return_exceptions* argument.
# See issue 32684.
exc = fut._make_cancelled_error()
outer.set_exception(exc)

Should be changed to:

if outer._cancel_requested:
# If gather is being cancelled we must propagate the
# cancellation regardless of *return_exceptions* argument.
# See issue 32684.
exc = fut._make_cancelled_error()
super(_GatheringFuture, other).cancel(fut._cancel_message)

This alone would only fix it in the return_exceptions=True case. To fix it when 
return_exceptions=False, a bit higher up in the same function, change:

if not return_exceptions:
if fut.cancelled():
# Check if 'fut' is cancelled first, as
# 'fut.exception()' will *raise* a CancelledError
# instead of returning it.
exc = fut._make_cancelled_error()
outer.set_exception(exc)
return

to:

if not return_exceptions:
if fut.cancelled():
# Check if 'fut' is cancelled first, as
# 'fut.exception()' will *raise* a CancelledError
# instead of returning it.
if outer._cancel_requested:
  super(_GatheringFuture, outer).cancel(fut._cancel_message)
else:
  exc = fut._make_cancelled_error()
  outer.set_exception(exc)
return

This case is a little trickier. Notice that I added a new if. As Caleb and Kyle 
pointed out, a task gets cancelled implicitly if its child gets cancelled. To 
be consistent with that behavior, you wouldn't actually care if 
_cancel_requested is set, if you'd always just call the super cancel. However, 
I actually think that gather *should* differ from Task here. A task wraps a 
single coroutine. If that coroutine is cancelled it makes sense that the task 
is implicitly cancelled. But with gather, I'm not convinced that cancelling one 
of the children should apply to the whole gather. It think it makes more sense 
that one child being cancelled would be treated as an exceptional return of the 
collection.

The one other thing I'd change is that I'd not actually use fut._cancel_message 
as I do in those examples above. I'd save the original message in 
_GatheringFuture.cancel() when setting _cancel_requested, and then use 
outer._cancel_message. I've attached The whole code I would suggest. I don't 
have time right now to make my own PR, but since Timm already has an open PR, 
hopefully this helps.

--
nosy: +sparkyb
Added file: https://bugs.python.org/file49895/gather.py

___
Python tracker 

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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

oh, I missed that a notification happens to the other process(es) in a common 
case, a bit of retrying with backoff would actually make sense there.  But I 
wouldn't let a retry run for longer than a second or three, as code tends to 
assume that rmtree is pretty quick and if something is going to close 
asynchronously, it should close quickly.

--

___
Python tracker 

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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2021-03-20 Thread Eryk Sun


Eryk Sun  added the comment:

> Isn't this just "how windows behaves" on some filesystems with 
> little that we can do about it?

The suggestion was to include an error handler that retries unlink() and 
rmdir() -- particularly rmdir() -- a given number of times, probably with an 
exponential back off, before giving up and failing. This accounts for race 
conditions in which the delete succeeds but the file/directory can't be 
unlinked because it's currently open (with delete sharing). A lot of these 
cases are similar to ReadDirectoryChangesExW(), in which the owner of the open 
is immediately notified that the directory was deleted. If they're well 
behaved, like Explorer, they immediately close their handle to allow the 
directory to be unlinked by the system. But that may not be soon enough for the 
process that deleted the directory. The suggested retry loop would help to work 
around this race condition. A couple people were in favor of this being 
provided by the standard library, so everyone isn't forced to implement there 
own workaround for a common problem.

--

___
Python tracker 

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



[issue37871] Windows: WindowsConsoleIO produces mojibake for strings longer than 32 KiB

2021-03-20 Thread Eryk Sun


Eryk Sun  added the comment:

> side note: do we need to care about Windows 7 anymore in 
> 3.10 given that microsoft no longer supports it?

If the fix comes in time for Python 3.8, then it needs to support Windows 7. 
For Python 3.9+, the 32 KiB limit can be removed. 

The console documentation still includes the misleading disclaimer about 
"available heap". This refers to a relatively small block of shared memory (64 
KiB IIRC) that's overlayed by a heap, not the default process heap. Shared 
memory is used by system LPC ports to efficiently pass large messages between a 
system server (e.g. csrss.exe, conhost.exe) and a client process. The console 
API used to use an LPC port, but in Windows 8.1+ it uses a driver instead, so 
none of the "available heap" warnings apply anymore. Microsoft should clarify 
the docs to stress that the warning is for Windows 7 and earlier.

--

___
Python tracker 

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



[issue42914] pprint numbers with underscore

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue32592] Drop support of Windows Vista and Windows 7

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
title: Drop support of Windows Vista and 7 in Python 3.9 -> Drop support of 
Windows Vista and Windows 7
type:  -> enhancement

___
Python tracker 

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



[issue42917] Block stack size for frame objects should be dynamically sizable

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)

2021-03-20 Thread Felix C. Stegerman


Change by Felix C. Stegerman :


--
nosy: +obfusk

___
Python tracker 

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



[issue43080] pprint for dataclass instances

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

+0.5 I lean towards just accepting this under the conditions Eric describes 
given that dataclass is a stdlib concept and nobody is likely to claim that 
such output from pprint is a bad thing.

The larger "some form of protocol for pprint to work on all sorts of other 
things" issue (regardless of how) remains a long term wish list item that'll 
probably wind up in PEP land if someone wants to take it on.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43542] Add image/heif(heic) to list of media types in mimetypes.py

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue43542] Add image/heif(heic) to list of media types in mimetypes.py

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 20a5b7e986377bdfd929d7e8c4e3db5847dfdb2d by Ilya Stepin in branch 
'master':
bpo-43542: Add heif/heic formats in mimetypes (GH-24917)
https://github.com/python/cpython/commit/20a5b7e986377bdfd929d7e8c4e3db5847dfdb2d


--

___
Python tracker 

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



[issue38890] subprocess.Popen should not emit a ResourceWarning for a detached process

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

On POSIX the norm for anything daemonizing itself is to fork() and let the 
parent die so that its original process with the child pid has ended.  But I'm 
used to this being the responsibility of the daemon process.  Not the code 
launching the daemon.

Related, a deferred PEP on supporting any form of daemon stuff in the stdlib:  
https://www.python.org/dev/peps/pep-3143/ along with 
https://pypi.org/project/python-daemon/ and a plethora of other 
daemon/daemonize related PyPI libraries.

Those tend to be about implement proper become a daemon behavior in Python 
processes themselves.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-20 Thread Eryk Sun

Eryk Sun  added the comment:

> In my experience, most applications use the ANSI code page because 
> they use the ANSI flavor of the Windows API.

The default encoding at startup and in the "C" locale wouldn't change. It would 
only differ from the default if setlocale(LC_CTYPE, locale_name) sets it 
otherwise. The suggestion is to match the behavior of nl_langinfo(CODESET) in 
Linux and many other POSIX systems.

When I say the default encoding won't change, I mean that the Universal C 
Runtime (ucrt) system component uses the process ANSI code page as the default 
locale encoding for setlocale(LC_CTYPE, ""). This agrees with what Python has 
always done, but it disagrees with previous versions of the CRT in Windows. 
Personally, I think it's a misstep because the user locale isn't necessarily 
compatible with the process code page, but I'm not looking to change this 
decision. For example, if the user locale is "el_GR" (Greek, Greece) but the 
process code page is 1252 (Latin) instead of 1253 (Greek), I get the following 
result in Python 3.4 (VC++ 10) vs Python 3.5 (ucrt):

>py -3.4 -c "from locale import *; print(setlocale(LC_CTYPE, ''))"
Greek_Greece.1253

>py -3.5 -c "from locale import *; print(setlocale(LC_CTYPE, ''))"
Greek_Greece.1252

The result from VC++ 10 is consistent with the user locale. It's also 
consistent with multilingual user interface (MUI) text, such as error messages, 
or at least it should be, because the user locale and user preferred language 
(i.e. Windows display language) should be consistent. (The control panel dialog 
to set the user locale in Windows 10 has an option to match the display 
language, which is the recommended and default setting.)  For example, Python 
uses system error messages that are localized to the user's preferred language:

>py -c "import os; os.stat('spam')"
Traceback (most recent call last):
  File "", line 1, in 
FileNotFoundError: [WinError 2] Δεν είναι δυνατή η εύρεση του καθορισμένου 
αρχείου από το σύστημα: 'spam'

This example is on a system where the process (system) ANSI code page is 1252 
(Latin), which cannot encode the user's preferred Greek text. Thankfully Python 
3.6+ uses the console's Unicode API, so neither the console session's output 
code page nor the process code page gets in the way. On the other hand, if this 
Greek text is written to a file or piped to a child process using 
subprocess.Popen(), Python's choice of locale encoding based on the process 
code page (Latin) is incompatible with Greek text, and thus it's incompatible 
with the current user's preferred locale and language settings.

The process ANSI code page from GetACP() has its uses, which are important. 
It's a system setting that's independent of the current user locale and thus 
useful when interacting with the legacy system API and as a common encoding for 
inter-process data exchange when applications do not use Unicode and may be 
operating in different locales. So if you're writing to a legacy-encoded text 
file that's shared by multiple users or piping text to an arbitrary program, 
then using the ANSI code page is probably okay. Though, especially for IPC, 
there's a good chance that's it's wrong since Windows has never set, let alone 
enforced, a standard in that case. 

Using the process ANSI code page in the "C" locale makes sense to me. 

> What is the use case for using ___lc_codepage()? Is it a different 
> encoding?

I always forget the "_func" suffix in the name; it's ___lc_codepage_func() [1]. 
The lc_codepage value is the current LC_CTYPE codeset as an integer code page. 
It's the equivalent of nl_langinfo(CODESET) in POSIX. For UTF-8, the code page 
is CP_UTF8 (65001), but this get displayed in locale strings as "UTF-8" (or 
variants such as "utf8"). It could be the LC_CTYPE encoding of just the current 
thread, but Python does not enable per-thread locales.

The CRT has exported ___lc_codepage_func() since VC++ 7.0 (2002), and before 
that the current lc_codepage value itself was directly exported as 
__lc_codepage. However, this triple-dundered function is documented as internal 
and not recommended for use. That's why the code snippet I showed uses 
_get_current_locale() with locinfo cast to __crt_locale_data_public *. This 
takes "public" in the struct name at face value. Anything that's declared 
public should be safe to use, but the locale_t type is frustratingly 
undocumented even for this public data [2].

If neither approach is supported, locale.get_current_locale_encoding() could 
instead parse the current locale encoding from setlocale(LC_CTYPE, NULL). The 
resulting locale string usually includes the codeset (e.g. 
"Greek_Greece.1253"). The exceptions are the "C" locale and BCP-47 (RFC 5646) 
locales that do not explicitly use UTF-8 (e.g. "el_GR" or "el" instead of 
"el_GR.UTF-8"), but these cases can be handled reliably.

---

[1] 

[issue43569] test_importlib failed on installed Python

2021-03-20 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I've submitted a PR and triggered build by buildbots, but I don't see that the 
indicated builder is building the PR. Shall I just submit and see what happens? 
Any other ideas how to verify the installed builder buildbots?

--

___
Python tracker 

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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Isn't this just "how windows behaves" on some filesystems with little that we 
can do about it?

The only real action item I can see here is that if it is _reasonable_ for us 
to detect the situation and improve the error message, that'd help the users 
(and reduce bugreports like this).

Otherwise I suggest closing it as wont fix / working as the platform intends.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

There is a lot of doubt.  That should clearly raise an exception because this 
function is intended to only operate on strings.

Trivial types examples like that gloss over the actual problem.

data_from_some_computations = [b"foo", b"bar"]  # probably returned by a 
function

... later on, some other place in the code ...

colon_sep_data = ":".join(data_from_some_computations)

I guarantee you that 99.999% of the time everyone wants an exception there 
instead of their colon_sep_data to contain `b"foo":b"bar"`.

Implicit conversions always lead to hard to pin down bugs.  An exception raised 
at the source of the problem is very easy to debug in comparison.

--

___
Python tracker 

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



[issue43542] Add image/heif(heic) to list of media types in mimetypes.py

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith
versions: +Python 3.10

___
Python tracker 

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



[issue37871] Windows: WindowsConsoleIO produces mojibake for strings longer than 32 KiB

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Steve's approach makes sense and should be robust.

side note: do we need to care about Windows 7 anymore in 3.10 given that 
microsoft no longer supports it?

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Emil Stenström

Emil Stenström  added the comment:

Terry, Gregory: The suggestion is not to change what 1 + "2" does, I fully 
agree that it behaves at it should. The suggestion is to change what 
",".join(1, "2") does. There's no doubt that the intended result is "1, 2". 
That's why it's possible to coerce.

About the example with a list with mixed types: If the reason that example is 
buggy is "this list should only have strings", a better way to enforce that is 
to add types to enforces it.

--

___
Python tracker 

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



[issue43487] Rename __unicode__ methods to __str__ in 2to3 conversion

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

We're not accepting anything new into lib2to3 anymore as it is deprecated and 
slated for eventual removal.  I recommend putting any fixers you develop up as 
on PyPI as package(s) for others to use.

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



[issue29178] Adding bytes.frombuffer(byteslike) constructor

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
stage:  -> patch review
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



[issue27602] Enable py launcher to launch repository Python.

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue43571] Add option to create MPTCP sockets

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks for the contribution!

Simple constant addition.  I ignored the contributor CLA status as a result.  
There's only one way to write this non-logic plumbing.

--
assignee:  -> gregory.p.smith
resolution:  -> fixed
stage: patch review -> commit review
status: open -> closed

___
Python tracker 

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



[issue43571] Add option to create MPTCP sockets

2021-03-20 Thread Gregory P. Smith


New submission from Gregory P. Smith :


New changeset b05b48dd7ab68bf0046356f2abd6d7fe3b5b3d77 by Rui Cunha in branch 
'master':
bpo-43571: Add IPPROTO_MPTCP macro (GH-24946)
https://github.com/python/cpython/commit/b05b48dd7ab68bf0046356f2abd6d7fe3b5b3d77


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43520] Make Fraction(string) handle non-ascii slashes

2021-03-20 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue43520] Make Fraction(string) handle non-ascii slashes

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

The proposal I like is for a unicode numeric normalization functions that 
return the ascii equivalent to exist.

These ideally belong in a third party PyPI library anyways, as they're the kind 
of thing that needs updating every time a new unicode revision comes out.  And 
there are often multiple cultural interpretations for some symbols, despite any 
standard, so you'd wind up with a variety of functions and options for which 
behavior to obtain.  That isn't the kind of thing that make for a good stdlib.

Doing this by default within the language syntax itself (and thus stdlib 
constructors) is potentially dangerous and confusing as everything in existence 
in the world today that processes Python source code already has baked in 
single-ascii-token assumptions.  While parsing and tooling could be evolved for 
that, it'd be a major ecosystem impacting change.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-20 Thread Jason R. Coombs


Change by Jason R. Coombs :


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

___
Python tracker 

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



[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)

2021-03-20 Thread Robert Pollak


Change by Robert Pollak :


--
nosy: +jondo

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread miss-islington


miss-islington  added the comment:


New changeset 107cf078910db7c1cafdd486270ba8083d72aed7 by Antoine Pitrou in 
branch '3.9':
[3.9] bpo-43517 (followup): Install additional test directory (GH-24950) 
(GH-24951)
https://github.com/python/cpython/commit/107cf078910db7c1cafdd486270ba8083d72aed7


--

___
Python tracker 

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



[issue43572] "Too many open files" on macOS buildbot

2021-03-20 Thread Antoine Pitrou


New submission from Antoine Pitrou :

See https://buildbot.python.org/all/#/builders/366/builds/960/steps/5/logs/stdio

--
messages: 389184
nosy: mattbillenstein, pablogsal, pitrou, zach.ware
priority: normal
severity: normal
status: open
title: "Too many open files" on macOS buildbot

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks Antoine!

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-20 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Oh, "installed python". So maybe Python requires one register files in more 
than one place to add them to the installation.

--

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

-10.  I agree with Serhiy.  Automatic type conversion is rarely a feature.  It 
leads to silent bugs when people pass the wrong things.  Be explicit.

We are intentionally not one of those everything is really a string languages 
like Perl or Javascript.

This core API behavior change is big enough to need a PEP and steering council 
approval.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I read all the responses as of this timestamp. They left me more persuaded that 
joining objects with a string (or bytes) is explicit enough that the objects 
*must* be coerced to strings.

A problem with coercion in "1 + '2'" is that there is no 'must'.  The desired 
answer could be either 3 or '12', and neither can be converted to the other, so 
don't guess.

The desired answer for "1 + .5" is much more obviously 1.5 rather than either 1 
or 2, plus the former avoids information loss and leaves the option available 
of rounding or converting however one wants.

One tweet answered my question about masking a bug. Suppose 'words' is intended 
to be an iterable of strings.

>>> words = ['This', 'is', 'a', 'list', 'of', 7, 'words']  # Buggy
>>> print(*words)  # Auto-coercion masks the bug.
This is a list of 7 words
>>> '-'.join(words)  # Current .join does not.
Traceback (most recent call last):
  File "", line 1, in 
'-'.join(words)
TypeError: sequence item 5: expected str instance, int found

With the proposed change, detection of the bug is delayed, as is already the 
case with print.  How much do we care about this possibility?  One possible 
answer is to add a new method, such as 'joins' or builtin function 'join'.

Given the variety of opinions, I think a PEP and SC decision would be needed.

--

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
pull_requests: +23709
pull_request: https://github.com/python/cpython/pull/24951

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread miss-islington


miss-islington  added the comment:


New changeset 66c8adfa27aeea004657ef29b6db4e4c360ad611 by Antoine Pitrou in 
branch 'master':
bpo-43517 (followup): Install additional test directory (GH-24950)
https://github.com/python/cpython/commit/66c8adfa27aeea004657ef29b6db4e4c360ad611


--

___
Python tracker 

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



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Foolish me. Commenting out the first exec results in the 2nd exec raising.  
Commenting out the 2nd exec also results in the class code raising, which is 
what I expected.  The point of the class code is to partially explain the 
exception, which is not a bug, but a consequence of passing separate global and 
initial local namespaces, combined with comprehensions being executed, starting 
in 3.0, in a new local namespace, separate from the one you passed in.

The exec doc in https://docs.python.org/3/library/functions.html#exec explains 
the effect of passing different global and local namespaces with "If exec gets 
two separate objects as globals and locals, the code will be executed as if it 
were embedded in a class definition."  There is no class, but this is the only 
way to get the same effect in Python code (without exec/eval).

The NameError has nothing to do with subscripting as it happens upon the 
attempt to load c.  Remove the subscription and the exception it remains.  
Instead, it arises because in 3.x, but not in 2.x, comprehensions are executed 
in a separate local namespace, the same as a method, where the passed in local 
namespace is invisible.

Here are simpler examples that both raise NameError.

exec("c=1\nlist(c for i in [1])", globals(), {})


class A:
c =1
def f(self): c

A().f()

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
pull_requests: +23708
pull_request: https://github.com/python/cpython/pull/24950

___
Python tracker 

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



[issue42137] Raise an ImportWarning for calling module_repr() on loaders

2021-03-20 Thread Brett Cannon


Brett Cannon  added the comment:

Should try to use __spec__ first, but if it isn't set then fall back on 
module_repr() and raise an ImportWarning. See 
Lib/importlib/_bootstrap.py:_module_repr.

--

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Emil Stenström

Emil Stenström  added the comment:

Since the proposal is fully backwards compatible I don’t think preferring the 
old version is a reason against this nicer API. After all, people that like the 
current version can continue using it as they do today. 

Teaching Python to beginners is a great way to find the warts of a language 
(I’ve done it too). In the beginning people struggle with arrays and if-blocks, 
and having to go into how map and the str constructor work together to get a 
comma separated list of ints is just too much. Beginners are an important group 
of programmers that this proposal will clearly benefit.

I’m sure there will be some “None”-strings that will slip through this, but I 
think the upside far outweighs the downside in this case.

Big +1 from me.

--
nosy: +EmilStenstrom

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-20 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Interestingly, the pull request never alerted to any buildbot failures.

Any idea how I can reproduce the issue locally? Is there a docker image that 
would likely replicate the environment in which the tests are failing?

--

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread miss-islington


miss-islington  added the comment:


New changeset ac17ed60f2033253248be494a8e1980fe7e3531d by Antoine Pitrou in 
branch '3.9':
[3.9] bpo-43517: Fix false positive in detection of circular imports (GH-24895) 
(GH-24948)
https://github.com/python/cpython/commit/ac17ed60f2033253248be494a8e1980fe7e3531d


--
nosy: +miss-islington

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-20 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
assignee:  -> jaraco
nosy: +jaraco

___
Python tracker 

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



[issue43452] Microoptimize PyType_Lookup for cache hits

2021-03-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +23707
pull_request: https://github.com/python/cpython/pull/24949

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
pull_requests: +23706
pull_request: https://github.com/python/cpython/pull/24948

___
Python tracker 

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



[issue43452] Microoptimize PyType_Lookup for cache hits

2021-03-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue43452] Microoptimize PyType_Lookup for cache hits

2021-03-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset ee48c7d54147ae906776b9f6f96e8920e097d0c4 by Dino Viehland in 
branch 'master':
bpo-43452: Micro-optimizations to PyType_Lookup (GH-24804)
https://github.com/python/cpython/commit/ee48c7d54147ae906776b9f6f96e8920e097d0c4


--
nosy: +pablogsal

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-20 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 2fd16ef406bba239b1334057fb499496a84b3aa2 by Antoine Pitrou in 
branch 'master':
bpo-43517: Fix false positive in detection of circular imports (#24895)
https://github.com/python/cpython/commit/2fd16ef406bba239b1334057fb499496a84b3aa2


--

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, I'm running a user poll on Twitter and have asked people to state their 
rationale:

https://twitter.com/raymondh/status/1373315362062626823

Take it with a grain of salt.  Polls totals don't reflect how much thought each 
person put into their vote.

--

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Of 721 uses of the join() method (excluding os.path.join()) 
> in the stdlib, only 10 need forceful stringification with 
> map(str, ...)

Thanks for looking a real world code.  I'm surprised that the standard library 
stats aren't representative of my experience, perhaps because I tend to write 
numeric code and do more output formatting than is used internally.

--

___
Python tracker 

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



[issue43571] Add option to create MPTCP sockets

2021-03-20 Thread Rui Cunha


Change by Rui Cunha :


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

___
Python tracker 

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



[issue43570] pyspecific.py > AuditEvent mess with translations

2021-03-20 Thread Julien Palard


Change by Julien Palard :


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

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-20 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue43571] Add option to create MPTCP sockets

2021-03-20 Thread Rui Cunha


Change by Rui Cunha :


--
components: Extension Modules
nosy: RuiCunhaM, ncoghlan, petr.viktorin
priority: normal
severity: normal
status: open
title: Add option to create MPTCP sockets
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue43570] pyspecific.py > AuditEvent mess with translations

2021-03-20 Thread Julien Palard

New submission from Julien Palard :

In case an `.. audit-event::` has a content, Sphinx gets confused:

It will provide both "auto-generated" and the content in po files, for 
interactivehook for example we have:

#: library/sys.rst:953
msgid ""
"Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` 
"
"with argument ``hook``."
msgstr ""

#: library/sys.rst:955
msgid ""
"Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` 
"
"with the hook object as the argument when the hook is called on startup."
msgstr ""
"Lève un :ref:`évènement d'audit ` 
``cpython.run_interactivehook`` "
"avec l'objet de point d'entrée comme argument lorsqu'il est appelé au "
"démarrage."

Which is not needed as only the content is used to render the doc, but it's the 
least issue. The issue is that Sphinx will then check the used one (content) 
against the translation of the auto-generated one leading it to trigger a 
warning on case the :ref: used don't match, typically for:


.. audit-event:: sys.unraisablehook hook,unraisable sys.unraisablehook

   Raise an auditing event ``sys.unraisablehook`` with arguments
   ``hook``, ``unraisable`` when an exception that cannot be handled occurs.
   The ``unraisable`` object is the same as what will be passed to the hook.
   If no hook has been set, ``hook`` may be ``None``.


Sphinx will compare the auto-generated one:

Raises an :ref:`auditing event ` ``sys.unraisablehook`` with 
arguments ``hook``, ``unraisable``.

Against our translated one (Lève un évènement d'audit ...).

Issue is, as in "Raise an auditing event" there's no :ref:, but as we 
translated "Raises an :ref:`auditing event `" we used one, Sphinx 
whines about inconsistent term references.

As far as I understand it, it's related, or near, the:

if self.content:
self.state.nested_parse(self.content, self.content_offset, pnode)
else:
n, m = self.state.inline_text(text, self.lineno)
pnode.extend(n + m)

part of pyspecific.py.

--
assignee: docs@python
components: Documentation
messages: 389169
nosy: docs@python, mdk, steve.dower
priority: normal
severity: normal
status: open
title: pyspecific.py >  AuditEvent mess with translations
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue43563] Use dedicated opcodes to speed up calls/attribute lookups with super() as receiver

2021-03-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Currently, super() is decoupled from the core language.  It is just a builtin 
that provides customized attribute lookup.  This PR makes super() more tightly 
integrated with the core language, treating it as if it were a keyword and part 
of the grammar.  Also note, users can currently create their own versions of 
super(), shadowing the builtin super().

--
nosy: +rhettinger

___
Python tracker 

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



[issue43536] 3.9.2 --without-pymalloc --with-pydebug --with-valgrind: test failed: test_posix

2021-03-20 Thread Ned Deily


Ned Deily  added the comment:

Please report the verbose results from the failing test cases; otherwise we are 
just guessing at what the exact failure is.  Use the -w or -v options to 
test.regrtest.

--
nosy: +ned.deily

___
Python tracker 

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



[issue23948] Deprecate os.kill() on Windows

2021-03-20 Thread John Ehresman


John Ehresman  added the comment:

The original idea was to not use kill on win32 because developers often assume 
it will work like it does on unix-like OS's -- my claim is while kill could be 
improved on win32, it still won't support all the things kill can do elsewhere. 
 

I don't think this idea has much, if any support so I suggest closing this bug 
and opening other specific bugs to improve it on win32 for the ideas mentioned 
in the comments.

--

___
Python tracker 

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



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-20 Thread Chris Morton


Chris Morton  added the comment:

Hi Terry, The reason why your code does not reproduce the issue is because you 
first execute the code in a global context which then puts the definition of c 
in that context. Subsequent calling in the local context then works. If you 
remove the first exec call (no need for the Class lines either), you will now 
see the issue in 3.8.
This issue is reproducible for other containers such as lists and sets, instead 
of dictionary, in this case. Replacing range(len(c)) with range(4) also shows 
the same error. The error relates to the use of the indexing operator []. The 
same error is observed with other sequences such as:

c={1,2,3,4} 

or

c='1234'

--

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2021-03-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +23703
pull_request: https://github.com/python/cpython/pull/24944

___
Python tracker 

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



[issue42129] Support resources in namespace packages

2021-03-20 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue.

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue42129] Support resources in namespace packages

2021-03-20 Thread STINNER Victor


STINNER Victor  added the comment:

Please see bpo-43569: "test_importlib failed on installed Python" regression 
introduced by commit 67148254146948041a77d8a2989f41b88cdb2f99.

--
nosy: +vstinner

___
Python tracker 

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



[issue11354] argparse: nargs could accept range of options count

2021-03-20 Thread Alex Kanitz


Alex Kanitz  added the comment:

Given that people were asking for real-world use cases, here's one: 
high-throughput sequencing, e.g., in RNA-Seq 
(https://en.wikipedia.org/wiki/RNA-Seq), typically yields either one or two 
output files, depending on the type of the sequencing library. As the 
processing of these library types is very similar, bioinformatics tools dealing 
with these inputs thus typically have APIs that take exactly 1 or 2 files as 
inputs. As there is quite a wide range of tools for dealing with such inputs, 
several of which implemented in Python, I believe there is indeed an interest 
in this functionality. On a more conceptual note: it is also consistent with 
similar and often-used functionality in regexes, from which, I suppose, the '+' 
and '*' notation is borrowed.

Currently implementing such a tool, I ran into the argparse limitation 
described here: either I (a) use a positional param with nargs=1 for the first 
file and define an optional param for the second file (inconsistent, 
non-intuitive and semantically incorrect API, because if there IS a second 
file, it is not really optional), (b) use nargs='+', do the admittedly simple 
post-processing/validation and either ignore keep the auto-generated usage 
string(wrong/misleading), hardcode the correct usage string (maintenance burden 
because of several optional params) or apply this patch (or just the auto-usage 
generation function), which seems rather expensive, or (c) have the user pass 
the second file in one string, separated by a comma or similar (also not very 
intuitive and needs some checks to ensure that the filename/s don't actually 
include commas).

--
nosy: +uniqueg

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-20 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like tests were added by:

commit 67148254146948041a77d8a2989f41b88cdb2f99
Author: Jason R. Coombs 
Date:   Thu Mar 4 13:43:00 2021 -0500

bpo-42129: Add support for resources in namespaces (GH-24670)

* Unify behavior in ResourceReaderDefaultsTests and align with the behavior 
found in importlib_resources.
* Equip NamespaceLoader with a NamespaceReader.
* Apply changes from importlib_resources 5.0.4

--

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-20 Thread STINNER Victor


New submission from STINNER Victor :

Example on aarch64 Fedora Stable Clang Installed 3.x:
https://buildbot.python.org/all/#/builders/14/builds/804

==
ERROR: test_open_binary (test.test_importlib.test_open.OpenDiskNamespaceTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/test_open.py",
 line 67, in setUp
from . import namespacedata01
ImportError: cannot import name 'namespacedata01' from 'test.test_importlib' 
(/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/__init__.py)

==
ERROR: test_open_binary_FileNotFoundError 
(test.test_importlib.test_open.OpenDiskNamespaceTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/test_open.py",
 line 67, in setUp
from . import namespacedata01
ImportError: cannot import name 'namespacedata01' from 'test.test_importlib' 
(/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/__init__.py)

==
ERROR: test_open_text_FileNotFoundError 
(test.test_importlib.test_open.OpenDiskNamespaceTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/test_open.py",
 line 67, in setUp
from . import namespacedata01
ImportError: cannot import name 'namespacedata01' from 'test.test_importlib' 
(/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/__init__.py)

==
ERROR: test_open_text_default_encoding 
(test.test_importlib.test_open.OpenDiskNamespaceTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/test_open.py",
 line 67, in setUp
from . import namespacedata01
ImportError: cannot import name 'namespacedata01' from 'test.test_importlib' 
(/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/__init__.py)

==
ERROR: test_open_text_given_encoding 
(test.test_importlib.test_open.OpenDiskNamespaceTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/test_open.py",
 line 67, in setUp
from . import namespacedata01
ImportError: cannot import name 'namespacedata01' from 'test.test_importlib' 
(/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/__init__.py)

==
ERROR: test_open_text_with_errors 
(test.test_importlib.test_open.OpenDiskNamespaceTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/test_open.py",
 line 67, in setUp
from . import namespacedata01
ImportError: cannot import name 'namespacedata01' from 'test.test_importlib' 
(/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/__init__.py)

==
ERROR: test_is_dir (test.test_importlib.test_reader.MultiplexedPathTest)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/test/test_importlib/test_reader.py",
 line 48, in test_is_dir
self.assertEqual(MultiplexedPath(self.folder).is_dir(), True)
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang-installed/build/target/lib/python3.10/importlib/readers.py",
 line 63, in __init__
raise NotADirectoryError('MultiplexedPath only supports directories')

[issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-20 Thread STINNER Victor


STINNER Victor  added the comment:

Python uses GetACP(), the ANSI code page of the operating system, for years. 
What is the advantage of using a different encoding? In my experience, most 
applications use the ANSI code page because they use the ANSI flavor of the 
Windows API.

What is the use case for using ___lc_codepage()? Is it a different encoding?

--

___
Python tracker 

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



[issue43520] Make Fraction(string) handle non-ascii slashes

2021-03-20 Thread STINNER Victor

STINNER Victor  added the comment:

Usually, constructors try to accept format returned by repr(obj), or even 
str(obj). It's the case for Fraction:

>>> str(fractions.Fraction(1, 2))
'1/2'
>>> fractions.Fraction("1/2")
Fraction(1, 2)

It works as expected.

I dislike the idea of trying to handle more Unicode characters which "look 
like" "/", or characters like "⅔". It sounds like a can of worm, and I don't 
think that such feature belongs to the stdlib. You can easily write your helper 
function accepting string and returning a fraction.

If someone is motivated to accept more character, I would prefer to have an 
unified proposition covering all Python number types (int, float, Fraction, 
complex, etc.) and listing all characters. Maybe a PEP would make sense.

--

___
Python tracker 

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



[issue37871] Windows: WindowsConsoleIO produces mojibake for strings longer than 32 KiB

2021-03-20 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



[issue29971] Lock.acquire() not interruptible on Windows

2021-03-20 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



[issue30405] build.bat: register binaries for py launcher

2021-03-20 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



[issue32862] os.dup2(fd, fd, inheritable=False) behaves inconsistently

2021-03-20 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



[issue32865] os.pipe creates inheritable FDs with a bad internal state on Windows

2021-03-20 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



[issue28188] os.putenv should support bytes arguments on Windows

2021-03-20 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



[issue24505] shutil.which wrong result on Windows

2021-03-20 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



  1   2   >