[issue46049] ._pth files untested on Linux

2021-12-11 Thread Steve Dower


Steve Dower  added the comment:


New changeset bfc59ed0a00106f5ba4a32a0c5b3dbe71d12665d by Steve Dower in branch 
'main':
bpo-46049: Fixes ._pth support on non-Windows (GH-30051)
https://github.com/python/cpython/commit/bfc59ed0a00106f5ba4a32a0c5b3dbe71d12665d


--

___
Python tracker 

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



[issue45997] asyncio.Semaphore waiters deque doesn't work

2021-12-11 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +28277
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30052

___
Python tracker 

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



[issue25834] getpass falls back when sys.stdin is changed

2021-12-11 Thread Irit Katriel


Irit Katriel  added the comment:

Thanks, I'll close this and we can revisit if a new use case turns up.

--
resolution:  -> later
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



[issue34798] pprint ignores the compact parameter for dicts

2021-12-11 Thread Matt Bogosian


Matt Bogosian  added the comment:

Please consider highlighting that dicts are not included in the documentation. 
While *technically* true, this ...

> compact impacts the way that long sequences (lists, tuples, sets, etc) are 
> formatted. If compact is false (the default) then each item of a sequence 
> will be formatted on a separate line. If compact is true, as many items as 
> will fit within the width will be formatted on each output line.

... has several problems.

First, sequence is a term of art that also has a common meaning. This creates a 
potential ambiguity in the understanding of the reader. Resolving that 
ambiguity in this context requires that readers have already internalized that 
dicts are not Python sequences. Those new to Python may not understand the (to 
them, subtle) differences between Python's iterables and sequences. Second, the 
"etc" only expands that ambiguity and invites confusion. Third, the term 
"items" is strongly associated with dicts and is used several times throughout 
the paragraph.

This ...

> According to https://docs.python.org/3/library/pprint.html compact impacts 
> the way that sequences are displayed, and a dict is not a sequence.

... is unhelpfully pedantic, and ignorant of the needs of the newcomer (a key 
demographic of documentation). Documentation is a core product surface with a 
diverse audience. Rather than focus on technical correctness, documentation 
authors should focus on accessibility. Redundancy is a feature, not a bug. You 
can't predict how your reader got to that slice of the documentation. Imagine 
this as an opportunity to educate or reinforce concepts for readers, not as an 
opportunity to argue from a position of technical superiority.

The fact that there are now four developers who have taken their time to file 
patches, bugs, and comments is pretty strong signal that confusion exists among 
the audience and that the documentation is insufficient.

--
nosy: +posita

___
Python tracker 

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2021-12-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +functools' singledispatch does not support GenericAlias

___
Python tracker 

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, it is related to issue45665. It is a complicated case due to coincidence 
of several circumstances.

1. isinstance(list[int], type) is True, while isinstance(typing.List[int], 
type) is False. list[int] is considered a type in this check.

2. list[int].__mro__ == list.__mro__, while typing.List[int] does not have the 
__mro__ attribute.  list[int] is considered a type in this check.

3. issubclass(cls, list[int]) raises a TypeError (the same for 
typing.List[int]). list[int] cannot be used as a type here.

4. 2-argument registry() does not check the type of its first argument. 
f.registry(42, ...) is silently passed.

In 2-argument registry() typing.List[int] is passed due to (4) and ignored in 
dispatch() due to (2). list[int] is passed due to (4), but caused error due to 
(3).

In other uses of registry() (1-argument decorator factory and decorator with 
annotations) typing.List[int] is not passed due to 1. list[int] is passed due 
to (1) and caused error due to (3).

The proposed PR makes list[int] be treated the same way as typing.List[int]. It 
also makes 2-argument registry() rejecting invalid first argument, so all three 
forms of registry() accept and reject now the same types.

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



[issue46049] ._pth files untested on Linux

2021-12-11 Thread Steve Dower


Change by Steve Dower :


--
keywords: +patch
pull_requests: +28276
pull_request: https://github.com/python/cpython/pull/30051

___
Python tracker 

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



[issue34624] -W option and PYTHONWARNINGS env variable does not accept module regexes

2021-12-11 Thread Christian Heimes


Christian Heimes  added the comment:

Adding regular expression support to -W and PYTHONWARNINGS env var turns the 
options into potential attack vectors. It can introduce REDOS vulnerability.

--
keywords: +security_issue
nosy: +christian.heimes
type:  -> enhancement
versions: +Python 3.11 -Python 3.10, Python 3.6, 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



[issue46049] ._pth files untested on Linux

2021-12-11 Thread Steve Dower


New submission from Steve Dower :

Currently ._pth files are "enabled" for all platforms, but are only tested on 
Windows.

Extend the tests in test_site to work on all platforms.

--
assignee: steve.dower
components: Interpreter Core
messages: 408304
nosy: steve.dower
priority: normal
severity: normal
stage: patch review
status: open
title: ._pth files untested on Linux
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue46048] embeddable distro cannot import modules

2021-12-11 Thread Steve Dower


Change by Steve Dower :


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



[issue46048] embeddable distro cannot import modules

2021-12-11 Thread Steve Dower


Steve Dower  added the comment:


New changeset 971ece8e1738b1107dda692cc44c6d8ddce384cd by Steve Dower in branch 
'main':
bpo-46048: Fix parsing of single character lines in getpath readlines() 
(GH-30048)
https://github.com/python/cpython/commit/971ece8e1738b1107dda692cc44c6d8ddce384cd


--

___
Python tracker 

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



[issue46046] I/O bound threads got to no chance to run with small CPU bound threads with new GIL

2021-12-11 Thread Souvik Ghosh


Souvik Ghosh  added the comment:

Python-ideas link in here:-
https://mail.python.org/archives/list/python-id...@python.org/message/A5MX6SQUHP65JC6V5ZFCCHMMJURM4KHB/

--

___
Python tracker 

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



[issue25834] getpass falls back when sys.stdin is changed

2021-12-11 Thread Adam Bartoš

Adam Bartoš  added the comment:

Sorry, I don't. But my use case is not relevant any more since my package was a 
workround for problems with entering Unicode interactively on Windows, and 
these problems were resolved in Python since then.

--

___
Python tracker 

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



[issue45995] string formatting: normalize negative zero

2021-12-11 Thread John Belmonte


Change by John Belmonte :


--
keywords: +patch
nosy: +jbelmonte
nosy_count: 5.0 -> 6.0
pull_requests: +28274
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30049

___
Python tracker 

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



[issue46048] embeddable distro cannot import modules

2021-12-11 Thread Steve Dower


Change by Steve Dower :


--
keywords: +patch
pull_requests: +28273
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30048

___
Python tracker 

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



[issue46048] embeddable distro cannot import modules

2021-12-11 Thread Steve Dower


New submission from Steve Dower :

The embeddable distro cannot import native modules.

This is because the '.' entry in the ._pth file is incorrect parsed by the new 
getpath module (issue45582).

--
assignee: steve.dower
components: Interpreter Core
messages: 408300
nosy: lukasz.langa, steve.dower
priority: normal
severity: normal
stage: needs patch
status: open
title: embeddable distro cannot import modules
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-11 Thread Jonas Witschel


Change by Jonas Witschel :


--
nosy: +diabonas

___
Python tracker 

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



[issue46047] When using Py_NewInterpreter, some modules fail to import in Python 3.10

2021-12-11 Thread Jonas Witschel


Jonas Witschel  added the comment:

I notice this has already been reported as bpo-46006 and bpo-46034, so closing 
in favour of these.

--
resolution:  -> duplicate
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



[issue46042] Error range of "duplicate argument" SyntaxErrors is too big

2021-12-11 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

let's see whether I promised too much, I don't know CPython's symtable.c too 
well yet ;-). Will shout for help when I get stuck.

Anyway, here is a related bug, coming from the same symtable function 
symtable_add_def_helper, also with an imprecise error location:

$ cat x.py 
{i for i in range(5)
if (j := 0)
for j in range(5)}

$ ./python x.py 
  File "/home/cfbolz/projects/cpython/x.py", line 1
{i for i in range(5)

SyntaxError: comprehension inner loop cannot rebind assignment expression 
target 'j'

--

___
Python tracker 

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



[issue46047] When using Py_NewInterpreter, some modules fail to import in Python 3.10

2021-12-11 Thread Jonas Witschel


Jonas Witschel  added the comment:

Downstream bug report in Arch Linux: https://bugs.archlinux.org/task/72979

--

___
Python tracker 

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



[issue46043] Python Launcher Not Opening Files.

2021-12-11 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Are you on macOS 10.15 or later?  If so, this is a duplicate of issue40477.

A workaround mentioned in that issue is to make sure that Terminal.app is open.

--
type: crash -> behavior

___
Python tracker 

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



[issue46047] When using Py_NewInterpreter, some modules fail to import in Python 3.10

2021-12-11 Thread Jonas Witschel


New submission from Jonas Witschel :

Consider the following minimal example C code which is trying to import 
jsonschema (https://python-jsonschema.readthedocs.io/en/stable/), compiled 
using "gcc test_newinterpreter.c -I /usr/include/python3.10 -lpython3.10 -o 
test_newinterpreter" or similar:

#include 

int main(void) {
Py_Initialize();
PyThreadState *interpreter = Py_NewInterpreter();
PyRun_SimpleString("import jsonschema");
Py_Finalize();  
}

In Python 3.9.9, this works as expected. However in Python 3.10.0, the 
following error is produced:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.10/site-packages/jsonschema/__init__.py", line 21, in 

from jsonschema._types import TypeChecker
  File "/usr/lib/python3.10/site-packages/jsonschema/_types.py", line 168, in 

draft3_type_checker = TypeChecker(
TypeError: TypeChecker() takes no arguments

Removing the Py_NewInterpreter() call makes the example work as expected in 
Python 3.10.0.

This might be related to the enhancements to the type cache from bpo-42745.

Another recent bug report I found that might possibly be related is bpo-46036.

This bug breaks some WeeChat plugins that try to import one of the affected 
modules, e.g. weechat-matrix (https://github.com/poljar/weechat-matrix).

--
components: C API, Subinterpreters
messages: 408295
nosy: diabonas
priority: normal
severity: normal
status: open
title: When using Py_NewInterpreter, some modules fail to import in Python 3.10
type: compile error
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



[issue21964] inconsistency in list-generator comprehension with yield(-from)

2021-12-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Resolved in issue10544.

--
nosy: +serhiy.storchaka
resolution: out of date -> duplicate
stage: test needed -> resolved
status: pending -> closed
superseder:  -> yield expression inside generator expression does nothing

___
Python tracker 

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



[issue45929] extend json.tool --json-lines to ignore empty rows

2021-12-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The current implementation allows for the final character of the input to be a 
newline. It does not allow double newlines. In the original example 

   echo -e '{"foo":1}\n{"bar":2}\n'

the echo command adds a newline to the output (which already contains the 
trailing newline), so the result ends with two newlines. Use option -n to 
disable adding newline in echo.

I afraid that if we add support of empty lines, soon we will get requests for 
supporting comments, encoding cookies, single-quote strings, non-quoted keys, 
hexadecimal integers and other possible JSON extensions.

--

___
Python tracker 

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



[issue46046] I/O bound threads got to no chance to run with small CPU bound threads with new GIL

2021-12-11 Thread Souvik Ghosh


New submission from Souvik Ghosh :

According to David Beazley' talk in PyCon'2010 in Atlanta Georgia, he 
demonstrated about a new GIL with running CPU bound and I/O bound threads 
together.

He said the talk that the threads which are forced to timeout of 5ms, will have 
the lower priority(which is CPU bound) and the thread which suspends the GIL 
within 5ms will have higher priority (which is I/O bound). 

What happens in the following code is if I set args=(1000,) (seven zero 
after 1) then only I/O bound runs and returns when CPU bound takes much time to 
execute. But if I decrease that args to args=(1000,) then I/O bound got no 
chance to reaquire the GIL in the meantime even though the 
sys.getswitchinterval() is equal to 5ms(By default). If I/O bound doesn't 
reacquire GIL with args=(1,) then the time to execute to run 
only the CPU bound takes 0.426035414 seconds. Thats means almost ticks 
0.426035414/0.005=85 (approx) times to set the priority in between the 
two threads. In that case if the I/O got more priority within that time, it 
should have returned the value within that ticks. But I didn't happen. 

import threading
from queue import Queue
from timeit import default_timer as timer
import urllib.request


q = Queue()  # Queue technique to pass returns among threads while running


def decrement(numbers):  # CPU bound
while numbers > 0:
numbers -= 1
if not q.empty():
"""I added this method because this thread will run most of the time
because it's mostly cpu bound"""
print(numbers)
print(q.get(block=False))
print(timer() - start)  # It tell after when exactly I/O bound 
returns value after both the threads started to run


def get_data():  # I/O bound

with urllib.request.urlopen("https://www.google.com;) as dt:
q.put(dt.read(), block=False)


if __name__ == "__main__":
start = timer()
t1 = threading.Thread(target=get_data)
#t2 = threading.Thread(target=decrement, args=(1000,)) #For this I/O 
responds and returns
t2 = threading.Thread(target=decrement, args=(10,)) # I/O doesn't 
responds at all
t1.start()
t2.start()

t1.join()
t2.join()
print(timer() - start)

Look at the second code...


import threading
from queue import Queue
from timeit import default_timer as timer
import urllib.request
import sys


q = Queue()  # Queue technique to pass returns among threads while running


def decrement(numbers):  # CPU bound
while numbers > 0:
numbers -= 1
if not q.empty():
"""I added this method because this thread will run most of the time
because it's mostly cpu bound"""
print(numbers)
print(q.get(block=False))
print(timer() - start)  # It tell after when exactly I/O bound 
returns value after both the threads started to run


def get_data():  # I/O bound

with urllib.request.urlopen("https://www.google.com;) as dt:
q.put(dt.read(), block=False)


if __name__ == "__main__":
sys.setswitchinterval(0.0001)
start = timer()
t1 = threading.Thread(target=get_data)
#t2 = threading.Thread(target=decrement, args=(100,)) #I/O responds 
with this 
t2 = threading.Thread(target=decrement, args=(1,))# I/O doesn't 
responds at all even with this 0.0001 seconds of 
threads switching interval
t1.start()
t2.start()

t1.join()
t2.join()
print(timer() - start)

Can't we have a more better version of GIL to set I/O threads(overall) 
priorities even more better and not to degrade the CPU bound and better 
callbacks in response? Or, try to remove the GIL?

Thank you so much, great future of Python!

--
components: Interpreter Core
files: GIL9.py
messages: 408292
nosy: souvikghosh
priority: normal
severity: normal
status: open
title: I/O bound threads got to no chance to run with small CPU bound threads 
with new GIL
type: performance
versions: Python 3.10
Added file: https://bugs.python.org/file50487/GIL9.py

___
Python tracker 

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



[issue46045] NetBSD: do not use POSIX semaphores

2021-12-11 Thread Thomas Klausner


Change by Thomas Klausner :


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

___
Python tracker 

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



[issue46045] NetBSD: do not use POSIX semaphores

2021-12-11 Thread Thomas Klausner


New submission from Thomas Klausner :

On NetBSD by default, the following tests do not finish in > 1h:

1:07:13 load avg: 0.00 running: test_compileall (1 hour 7 min), 
test_multiprocessing_fork (1 hour 7 min), test_concurrent_futures (1 hour 6 min)

Defining HAVE_BROKEN_POSIX_SEMAPHORES fixes this, and they finish:

0:00:32 load avg: 10.63 [408/427/17] test_compileall passed ...
...
0:02:37 load avg: 3.04 [427/427/22] test_concurrent_futures passed (2 min 33 
sec)

The last one fails:
test_multiprocessing_fork

with most of the subtests failing like this:

ERROR: test_shared_memory_SharedMemoryServer_ignores_sigint 
(test.test_multiprocessing_fork.WithProcessesTestSharedMemory)
--
Traceback (most recent call last):
  File 
"/scratch/lang/python310/work/Python-3.10.1/Lib/test/_test_multiprocessing.py", 
line 4006, in test_shared_memory_SharedMemoryServer_ignores_sigint
sl = smm.ShareableList(range(10))
  File 
"/scratch/lang/python310/work/Python-3.10.1/Lib/multiprocessing/managers.py", 
line 1372, in ShareableList
sl = shared_memory.ShareableList(sequence)
  File 
"/scratch/lang/python310/work/Python-3.10.1/Lib/multiprocessing/shared_memory.py",
 line 327, in __init__
self.shm = SharedMemory(name, create=True, size=requested_size)
  File 
"/scratch/lang/python310/work/Python-3.10.1/Lib/multiprocessing/shared_memory.py",
 line 92, in __init__
self._fd = _posixshmem.shm_open(
OSError: [Errno 86] Not supported: '/psm_b1ec903a'

I think this is a separate issue, so I'd like to define 
HAVE_BROKEN_POSIX_SEMAPHORES for now.

This has been done in pkgsrc since at least python 2.7 (in 2011), I haven't dug 
deeper.

--
components: Interpreter Core
messages: 408291
nosy: wiz
priority: normal
severity: normal
status: open
title: NetBSD: do not use POSIX semaphores
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue45855] PyCapsule_Import still using PyImport_ImportModuleNoBlock

2021-12-11 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303
nosy_count: 2.0 -> 3.0
pull_requests: +28271
pull_request: https://github.com/python/cpython/pull/30046

___
Python tracker 

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



<    1   2