[issue45914] Very first multiprocessing example not working on Windows 11

2021-11-27 Thread Alex Waygood


Change by Alex Waygood :


--
type: crash -> behavior
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue23010] "unclosed file" warning when defining unused logging FileHandler in dictConfig

2021-11-27 Thread Vinay Sajip


Vinay Sajip  added the comment:

This had dropped off my radar completely, but I still can't see where there's 
an actual bug here. This simplified script:

import logging
import sys

LOGGING = {
'version': 1,
'handlers': {
'logfile': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/tmp/debug.log',
},
},
}

print('Starting: %s' % sys.version)
from logging.config import dictConfig
dictConfig(LOGGING)
print('After dictconfig')
print('_handlerList 1, initial:', logging._handlerList, len(logging._handlers))
import importlib
print('_handlerList 2, about to import shutil:', logging._handlerList, 
len(logging._handlers))
import shutil
print('_handlerList 3, just imported shutil:', logging._handlerList, 
len(logging._handlers))
print('')

when run with Python 3.10, produces

Starting: 3.10.0+ (heads/3.10:7203ecd332, Oct 29 2021, 10:04:19) [GCC 7.5.0]
After dictconfig
_handlerList 1, initial: [] 1
_handlerList 2, about to import shutil: [] 1
/home/vinay/.local/lib/python3.10/_compression.py:33: ResourceWarning: unclosed 
file <_io.FileIO name='/tmp/debug.log' mode='ab' closefd=True>
  class DecompressReader(io.RawIOBase):
ResourceWarning: Enable tracemalloc to get the object allocation traceback
_handlerList 3, just imported shutil: [] 0

But ... there are no loggers that use this handler, so the only reference would 
be the weak reference in _handlerList - it gets freed up at some point (in this 
case, when shutil is imported, but I don't believe that's necessarily relevant) 
and that causes the ResourceWarning, but where's the problem? If you either add 
a reference to the handler (by adding it to a logger) or adding "delay: True" 
to the handler configuration dict to delay opening the file, the 
ResourceWarning is no longer seen.

I tested with Python 3.4 - 3.10 and all versions behave the same way - it could 
just be down to where weak references get dumped, which is down to the vagaries 
of GC. I don't see this as a "leak" - the ResourceWarning is showing the 
developer that they opened a file for no particular reason and didn't use it.

--

___
Python tracker 

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



[issue23599] single and double quotes stripped upon paste with MacPorts libedit

2021-11-27 Thread Ned Deily


Ned Deily  added the comment:

Getting back to this old issue, retesting with a current MacPorts Python 3.9.9 
and libedit @20210910-3.1_1, I no longer see the problematic disappearance of 
the smart quotes; the example now produces the expected "invalid character in 
identifier" SyntaxError. So no further action is needed.

--
resolution:  -> out of date
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



[issue45904] Pasting the U00FF character into Python REPL misinterprets character

2021-11-27 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the report. macOS does not ship with the GNU readline library due to 
its GPL licensing and instead relies on the BSD editline library, libedit, 
which, while providing similar functionality, has a different API than GNU 
readline. However, editline does provide a compatibility layer that provides 
much, but not all, of the GNU readline API. Third-party programs like Python 
have linked with that compatibility layer for many years but there are some 
shortcomings with it, like when trying to use full Unicode in the REPL as in 
your case.

There have been many reports over the years of similar problems in Python and 
in other products that use the readline compatibility layer of libedit. If this 
behavior is unacceptable, the standard recommendation on the webs has been to 
use a version of the product that is linked with GNU readline rather than with 
libedit's readline layer. (Alas, Python does not support directly linking with 
libedit's native API which would likely avoid these issues.) The potential 
drawback to using GNU readline is that it is licensed under GPL v3 which may be 
unacceptable for some users.

There is a third-party package on PyPI called gnureadline which allowed 
replacing the Python readline module with one linked with GNU readline; I'm not 
sure what its status is as it doesn't appear to have been updated recently. 
Alternatively, there are Python distributions from other sources (like Homebrew 
and MacPorts) that optionally provide GNU readline for Python. 

Hope that helps!

--
nosy: +ned.deily
resolution:  -> third party
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



[issue45914] Very first multiprocessing example not working on Windows 11

2021-11-27 Thread Eryk Sun


Eryk Sun  added the comment:

> AttributeError: Can't get attribute 'f' 
> on 

The Windows API only supports the spawn method of process creation. In POSIX 
(except macOS), the default is the fork method, for which the child inherits 
the interactive main module of the parent. If you switch to the spawn method in 
Linux via multiprocessing.set_start_method('spawn'), you'll see the same error. 

multiprocessing is one package where it's necessary in Windows to test examples 
using a script. This is implied in the guidelines when it says to "[m]ake sure 
that the main module can be safely imported by a new Python interpreter without 
causing unintended side effects (such a starting a new process)". It's the fact 
the main module has to be importable by child processes that matters in this 
case. The behavior is noted with an example at the end of the introduction:

Note
Functionality within this package requires that the __main__ module
be importable by the children. This is covered in Programming 
guidelines however it is worth pointing out here. This means that 
some examples, such as the multiprocessing.pool.Pool examples will 
not work in the interactive interpreter. For example: ...

If it were up to me this note would be at the beginning of the introduction, 
where everyone would certainly see it. As is, the reader is expected to at 
least scan over the entire introduction.

--
nosy: +eryksun

___
Python tracker 

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



[issue45116] Performance regression 3.10b1: inlining issue in the big _PyEval_EvalFrameDefault() function with Visual Studio (MSC)

2021-11-27 Thread neonene


neonene  added the comment:

I requested the MSVC team to reconsider the inlining issues, including 
__forceinline.
https://developercommunity.visualstudio.com/t/1595341


The stuck at link due to __forceinline can be avoided by completing the 
_Py_DECREF optimization outside _PyEval_EvalFrameDefault:

static inline void // no __forceinline
_Py_DECREF_impl(...) {
...
}
static __forceinline void
_Py_DECREF(...) {  // no conditional branch in the function
_Py_DECREF_impl(...);
}


In _PyEval_EvalFrameDefault, wrapping the callees like above seems better for 
performance than just specifying __forceinline under the current MSVC.

--

___
Python tracker 

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



[issue33376] [pysqlite] Duplicate rows can be returned after rolling back a transaction

2021-11-27 Thread Ma Lin


Ma Lin  added the comment:

This issue is not resolved, but was covered by a problematic behavior.
Maybe this issue will be solved in issue44092, I'll study that issue later.

--

___
Python tracker 

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



[issue33376] [pysqlite] Duplicate rows can be returned after rolling back a transaction

2021-11-27 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
stage: resolved -> 

___
Python tracker 

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



[issue45914] Very first multiprocessing example not working on Windows 11

2021-11-27 Thread Chang Zhou


New submission from Chang Zhou :

Very first multiprocessing example not working on Windows 11

https://docs.python.org/3/library/multiprocessing.html

from multiprocessing import Pool

def f(x):
return x*x

if __name__ == '__main__':
with Pool(5) as p:
print(p.map(f, [1, 2, 3]))

Tried Python 3.7, 3.8, 3.9, 3.10
Also tried Ubuntu which works fine.
But on Windows (clean installed python):


>>> from multiprocessing import Pool
>>> def f(x):
... return x*x
...
>>> with Pool(5) as p:
...   print(p.map(f, [1, 2, 3]))
...
Process SpawnPoolWorker-14:
Process SpawnPoolWorker-13:
Traceback (most recent call last):
Process SpawnPoolWorker-15:
  File "C:\Program Files\Python39\lib\multiprocessing\process.py", line 315, in 
_bootstrap
self.run()
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\multiprocessing\process.py", line 108, in 
run
self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python39\lib\multiprocessing\process.py", line 315, in 
_bootstrap
self.run()
  File "C:\Program Files\Python39\lib\multiprocessing\pool.py", line 114, in 
worker
task = get()
  File "C:\Program Files\Python39\lib\multiprocessing\process.py", line 108, in 
run
self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python39\lib\multiprocessing\queues.py", line 368, in 
get
return _ForkingPickler.loads(res)
  File "C:\Program Files\Python39\lib\multiprocessing\pool.py", line 114, in 
worker
task = get()
AttributeError: Can't get attribute 'f' on 
  File "C:\Program Files\Python39\lib\multiprocessing\queues.py", line 368, in 
get
return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'f' on 
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\multiprocessing\process.py", line 315, in 
_bootstrap
self.run()
  File "C:\Program Files\Python39\lib\multiprocessing\process.py", line 108, in 
run
self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python39\lib\multiprocessing\pool.py", line 114, in 
worker
task = get()
  File "C:\Program Files\Python39\lib\multiprocessing\queues.py", line 368, in 
get
return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'f' on 

--
components: Windows
messages: 407186
nosy: paul.moore, quattrozhou, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Very first multiprocessing example not working on Windows 11
type: crash
versions: Python 3.10, 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



[issue33376] [pysqlite] Duplicate rows can be returned after rolling back a transaction

2021-11-27 Thread Ma Lin


Ma Lin  added the comment:

Since 243b6c3b8fd3144450c477d99f01e31e7c3ebc0f (21-08-19), this bug can't be 
reproduced.

In `pysqlite_do_all_statements()`, 243b6c3 resets statements like this:

sqlite3_stmt *stmt = NULL;
while ((stmt = sqlite3_next_stmt(self->db, stmt))) {
if (sqlite3_stmt_busy(stmt)) {
(void)sqlite3_reset(stmt);
}
}

But the `pysqlite_Statement.in_use` flag is not reset.
In `_pysqlite_query_execute()` function, if `pysqlite_Statement.in_use` flag is 
1, it creates a new `pysqlite_Statement` instance. So this line will use a new 
statement:

gen = conn.execute("SELECT c FROM t WHERE ?", (1,))

The duplicate row is from `pysqlite_Cursor.next_row` before 
3df0fc89bc2714f5ef03e36a926bc795dcd5e05a (21-08-25).

A digressive suggestion is whether it can be changed like this, and add a check 
for resetting statement. So that statements are not allowed to be reset by 
other Cursors, which may improve code robust:

typedef struct
{
...
-   int in_use;
+   pysqlite_Cursor *in_use; // points to the attached cursor
...
} pysqlite_Statement;

--

___
Python tracker 

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



[issue19460] Add test for MIMENonMultipart

2021-11-27 Thread jiahua wang


Change by jiahua wang :


--
keywords: +patch
nosy: +180909
nosy_count: 4.0 -> 5.0
pull_requests: +28049
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29817

___
Python tracker 

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



[issue45913] Doctest Seg Fault with Python 3.10 on CI

2021-11-27 Thread Dan Yeaw


New submission from Dan Yeaw :

When running pytest --doctest-modules, I am getting seg faults on the GitHub 
Actions CI when running doctests covering module docstrings.

runner@fv-az177-300:~/work/gaphor/gaphor$ source .venv/bin/activate
(.venv) runner@fv-az177-300:~/work/gaphor/gaphor$ xvfb-run gdb python

(gdb) run -m pytest
Starting program: /home/runner/work/gaphor/gaphor/.venv/bin/python -m pytest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffecd32700 (LWP 22846)]
[New Thread 0x7fffebd31700 (LWP 22847)]
[New Thread 0x7fffead30700 (LWP 22848)]
[New Thread 0x7fffe9d2f700 (LWP 22849)]
[New Thread 0x7fffdbfff700 (LWP 22850)]
[New Thread 0x7fffdaffe700 (LWP 22851)]
[New Thread 0x7fffd9ffd700 (LWP 22852)]
[New Thread 0x7fffc700 (LWP 22853)]
[Detaching after fork from child process 22854]
= test session starts ==
platform linux -- Python 3.10.0, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/runner/work/gaphor/gaphor, configfile: pyproject.toml, 
testpaths: gaphor, tests, docs
plugins: mock-3.6.1, cov-3.0.0
collected 1135 items   

gaphor/action.py 
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
__GI___libc_free (mem=0x20) at malloc.c:3102
3102malloc.c: No such file or directory.
(gdb) source python-gdb.py
(gdb) py-bt
Traceback (most recent call first):
  
  File "", line 241, in _call_with_frames_removed
  File "", line 1176, in create_module
  File "", line 571, in module_from_spec
  File "", line 674, in _load_unlocked
  File "", line 1006, in _find_and_load_unlocked
  File "", line 1027, in _find_and_load
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/pdb.py", line 
157, in __init__
import readline
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/doctest.py", line 
364, in __init__
pdb.Pdb.__init__(self, stdout=out, nosigint=True)
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/doctest.py", line 
1481, in run
self.debugger = _OutputRedirectingPdb(save_stdout)
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/doctest.py", line 
1856, in run
r = DocTestRunner.run(self, test, compileflags, out, False)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/doctest.py",
 line 287, in runtest
self.runner.run(self.dtest, out=failures)  # type: ignore[arg-type]
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/runner.py",
 line 162, in pytest_runtest_call
item.runtest()
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/pluggy/_callers.py",
 line 39, in _multicall
res = hook_impl.function(*args)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/pluggy/_manager.py",
 line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/pluggy/_hooks.py",
 line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/runner.py",
 line 255, in 
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/runner.py",
 line 311, in from_call
result: Optional[TResult] = func()
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/runner.py",
 line 254, in call_runtest_hook
return CallInfo.from_call(
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/runner.py",
 line 215, in call_and_report
call = call_runtest_hook(item, when, **kwds)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/runner.py",
 line 126, in runtestprotocol
reports.append(call_and_report(item, "call", log))
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/runner.py",
 line 109, in pytest_runtest_protocol
runtestprotocol(item, nextitem=nextitem)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/pluggy/_callers.py",
 line 39, in _multicall
res = hook_impl.function(*args)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/pluggy/_manager.py",
 line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/pluggy/_hooks.py",
 line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File 
"/home/runner/work/gaphor/gaphor/.venv/lib/python3.10/site-packages/_pytest/main.py",
 line 348, in pytest_runtestloop
item.config.hook.pytest_runtest_protocol(item=item, 

[issue45912] [argparse] Print texts starting with capital letters and finish with dot for more formality

2021-11-27 Thread Silvio Clecio


New submission from Silvio Clecio :

Using a simple program as example, the argparse library prints the following 
text:

usage: app.py [-h]

options:
  -h, --help  show this help message and exit

However, for more formality, it would be nice to print something like this:

Usage: app.py [-h]

Options:
  -h, --help  Show this help message and exit.

Notice the sentences start as capital letters and the helper string finishes 
with dot.

--
components: Parser
messages: 407183
nosy: lys.nikolaou, pablogsal, silvioprog
priority: normal
severity: normal
status: open
title: [argparse] Print texts starting with capital letters and finish with dot 
for more formality

___
Python tracker 

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



[issue45911] SystemError occured while running an extention

2021-11-27 Thread xmlsax


New submission from xmlsax <1627213...@qq.com>:

I got an  while running openfile.open. 
Python release 3.9.6

--
components: C API
files: openfile.c
messages: 407182
nosy: xmlsax
priority: normal
severity: normal
status: open
title: SystemError occured while running an extention
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file50460/openfile.c

___
Python tracker 

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



[issue45902] Bytes and bytesarrays can be sorted with a much faster count sort.

2021-11-27 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

General consensus: There isn't a common need for this.

--
nosy: +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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

Okay, so that's all hypothetical. It looks like the status quo is not
likely to change, so we should just document it. I wonder if keeely is
interested in submitting a PR for the docs?

--

___
Python tracker 

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



[issue23819] test_asyncio fails when run under -O

2021-11-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'm sure there's more to it, but I found at least this failure:

~/cpython$ ./python.exe -O -m test test_asyncio -m test_set_event_loop
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 2.02 Run tests sequentially
0:00:00 load avg: 2.02 [1/1] test_asyncio
test test_asyncio failed -- Traceback (most recent call last):
  File "/Users/guido/cpython/Lib/test/test_asyncio/test_events.py", line 2595, 
in test_set_event_loop
self.assertRaises(AssertionError, policy.set_event_loop, object())
^^
AssertionError: AssertionError not raised by set_event_loop

test_asyncio failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
test_asyncio

Total duration: 134 ms
Tests result: FAILURE


Also this one:

~/cpython$ ./python.exe -O -m test test_asyncio -m 
test_create_datagram_endpoint_addr_error
0:00:00 load avg: 2.19 Run tests sequentially
0:00:00 load avg: 2.19 [1/1] test_asyncio
test test_asyncio failed -- Traceback (most recent call last):
  File "/Users/guido/cpython/Lib/test/test_asyncio/test_base_events.py", line 
1593, in test_create_datagram_endpoint_addr_error
self.assertRaises(
^^
  File "/Users/guido/cpython/Lib/unittest/case.py", line 734, in assertRaises
return context.handle('assertRaises', args, kwargs)
   
  File "/Users/guido/cpython/Lib/unittest/case.py", line 218, in handle
callable_obj(*args, **kwargs)
^
  File "/Users/guido/cpython/Lib/asyncio/base_events.py", line 637, in 
run_until_complete
return future.result()
   ^^^
  File "/Users/guido/cpython/Lib/asyncio/base_events.py", line 1287, in 
create_datagram_endpoint
infos = await self._ensure_resolved(

  File "/Users/guido/cpython/Lib/asyncio/base_events.py", line 1369, in 
_ensure_resolved
info = _ipaddr_info(host, port, family, type, proto, *address[2:])
   ^^^
TypeError: _ipaddr_info() takes from 5 to 7 positional arguments but 12 were 
given

test_asyncio failed (1 error)

== Tests result: FAILURE ==

1 test failed:
test_asyncio

Total duration: 165 ms
Tests result: FAILURE


I think calling assertRaises(AssertionError, ...) is definitely an 
anti-pattern. We can't remove all assertions from the asyncio library, but I 
think the ones that are explicitly checked for by the tests should go, at 
least. (Probably replaced with TypeError or ValueError in most cases.)

--

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Eryk Sun


Eryk Sun  added the comment:

> What does "the builtin readline support" refer to here? 
> Presumably not GNU Readline?

That's referring to the readline(ish) support that's built into the console 
host for ReadFile() and ReadConsole() calls when the input stream is in 
line-input mode. I've never seen the console developers speak positively of 
this feature on their GitHub repo. They've suggested the addition of a native 
readline API on the client side, like PowerShell's PSReadLine module provides. 
But who knows when/if that would be released.

Python has the third-party pyreadline module, but it's no longer actively 
developed. To bring pyreadline into the standard library would be a non-trivial 
task. OTOH, I assume if Microsoft provided an official readline API, which does 
all the heavy lifting, that Python could support it in the readline extension 
module, if the API is basically compatible with libreadline/libedit.

--

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks, Eryk, I only read the part of the issue that landed in my inbox (fhe 
first message and everything after Terry added me to the nosy list). Sorry.

You wrote:

> The console/terminal team at Microsoft apparently don't want to do anything 
> with the builtin readline support, which is seen as a legacy feature.

What does "the builtin readline support" refer to here? Presumably not GNU 
Readline?

--

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Eryk Sun


Eryk Sun  added the comment:

> AFAIK the reason command history works in cmd.py on Windows is 
> that it's built into the terminal program. Or maybe into the
> operating system.

As mentioned in msg406800, input editing, history (e.g. up/down arrows, F7 
popup, F8 completion), and alias support is implemented by the Windows console 
host (conhost.exe or openconsole.exe) for ReadFile() and ReadConsole() calls 
when the input stream is in line-input mode. Currently, it's the same whether a 
classic console session or a pseudoconsole (headless) session is hosted. When 
Windows Terminal is used, the overall connection of components looks like 
Python<->ConDrv (kernel device)<->OpenConsole<->NamedPipe (kernel 
device)<->Windows Terminal. The headless console's use of Windows Terminal for 
the user interface doesn't matter to Python's ReadConsoleW() call.

A headless console session always starts with 4 history buffers (one for each 
attached process) that store up to 50 commands. For a classic console session, 
the initial number and size of history buffers can be configured in the session 
properties or defaults. It can always be set dynamically via 
SetConsoleHistoryInfo(). There's *undocumented* support to get the commands 
from a history buffer that's associated with the name of an attached process: 
GetConsoleCommandHistoryLengthW(executable_name) and 
GetConsoleCommandHistoryW(buffer, buffer_length, executable_name). However, the 
API provides no function to set the command history. I suppose one could loop 
over WriteConsoleInputW() and ReadConsoleW() to implement it as a kludge.

--

___
Python tracker 

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



[issue45558] shutil.copytree: Give the option to disable copystat

2021-11-27 Thread Doron Behar

Doron Behar  added the comment:

> Can you provide a description of what motivated you to change the behavior or 
> what benefits this change would have for you or others?

Sometimes, you wish to copy a whole directory from a read-only file system and 
you don't want it to be read-only in the destination.

> Do you know why others haven’t reported this need previously?

On NixOS all of the files that belong to packages are read-only. I encountered 
the need for this feature in GNURadio, at:

https://github.com/gnuradio/gnuradio/pull/5227

The following Stack overflow question also suggests the need for this 
functionality is a bit common:

https://stackoverflow.com/a/17022146/4935114

--

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

AFAIK the reason command history works in cmd.py on Windows is that it's built 
into the terminal program. Or maybe into the operating system.

Thus, the user can use line editing and history, but there is no API (in 
Python) to interact with these.

I'm sure Steve Dower can explain the exact situation -- it may depend on which 
Windows version and which terminal program you use (my only recent experience 
is with winterm on Windows 10).

I agree that (once we sort out what works in what versions of Windows and which 
terminal programs) we should clarify this in the docs.

--
nosy: +steve.dower

___
Python tracker 

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



[issue45614] traceback of exception with non-unicode __module__

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 4dfae6f38e1720ddafcdd68043e476ecb41cb4d5 by Irit Katriel in 
branch 'main':
bpo-45614: Fix traceback display for exceptions with invalid module name 
(GH-29726)
https://github.com/python/cpython/commit/4dfae6f38e1720ddafcdd68043e476ecb41cb4d5


--

___
Python tracker 

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



Re: CERTIFICATE_VERIFY_FAILED Windows only?

2021-11-27 Thread Chris Angelico
On Sun, Nov 28, 2021 at 6:38 AM Ulli Horlacher
 wrote:
>
> My program uses https and runs fine on Linux, but on Windows it crashes:
>
> Google chrome and firefox both say the certifacte is valid:
>
> https://fex.flupp.org/fop/U4xC4kz8/X-20211127192031.png
>
> https://fex.flupp.org/fop/mBabXKSz/X-20211127192416.png
>
> Why does Python complain (only on Windows!)?
>

What version of Python is it, and where did you install it from? On
some versions, Python will use Microsoft's provided certificate store.
One solution may be to fetch Mozilla's root certs from PyPI:

https://pypi.org/project/certifi/

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45614] traceback of exception with non-unicode __module__

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Eryk Sun


Eryk Sun  added the comment:

> You can take the view that it's not a bug (with some justification), 
> but a few lines in the cmd docs would make all the difference in 
> terms of wasted time.

If anything, I think the readline documentation should have a note explaining 
the situation in Windows. The documentation of the cmd module already makes the 
readline dependency clear: 

If the readline module is loaded, input will automatically inherit 
bash-like history-list editing (e.g. Control-P scrolls back to the
last command, Control-N forward to the next one, Control-F moves the 
cursor to the right non-destructively, Control-B moves the cursor to 
the left non-destructively, etc.).

--

___
Python tracker 

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



[issue24040] plistlib assumes dict_type is descendent of dict

2021-11-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The patch LGTM, and I have nothing to add. Ronald, do you mind to create a PR.

--
assignee:  -> ronaldoussoren
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45902] Bytes and bytesarrays can be sorted with a much faster count sort.

2021-11-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Raymond. It is difficult to find any use case for sorting bytes 
objects (I cannot find any).

As for using radix sort in list.sort() in special case of small integer keys, 
it is difficult to implement, because we should preserve the initial order of 
items with the same key. I am not sure that it is possible to implement stable 
radix sort with linear complexity. In any case the overhead will be more 
significant.

--

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Guido and Raymond, you are the two active coredevs that have contributed the 
most lines to cmd module.  What do either of you think?

--
nosy: +gvanrossum, rhettinger

___
Python tracker 

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



[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Sorry, you obviously mean
https://docs.python.org/3/library/cmd.html#module-cmd
What to add where still applies.

--

___
Python tracker 

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



[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What else can it be? dict.fromkeys() adds keys in the order of obtaining them, 
and it obtains them by iterating its argument. If we need a special note here, 
we need a special note for list(), tuple(), filter(), enumerate() and all other 
functions which consume an iterable.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thanks for the suggestion but I’m going to decline. We has many APIS that 
consume an iterable and all of them do so In iteration order.  Even the regular 
dict() constructor takes an iterable of tuples and adds them in iteration 
order.  Also, I’m not concerned because of our experience with OrderedDict() 
which for a decade had a fromkeys() method and there has never been a question 
about it.   There was even an idiom for deducing a list while maintaining 
order: list(OrderedDict.fromkeys(seq)).

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



[issue45881] Cross compiling on Linux is untested, undocumented, and broken

2021-11-27 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 545aebd2ecef9f6c3b2ca1973e3e0515d8355ce3 by Christian Heimes in 
branch '3.10':
[3.10] bpo-45881: Use CC from env first for cross building (GH-29752). 
(GH-29753)
https://github.com/python/cpython/commit/545aebd2ecef9f6c3b2ca1973e3e0515d8355ce3


--

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

What specific sentences would you like where in which doc.  (Please link as 
'cmd doc' is too vague.)

--

___
Python tracker 

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



CERTIFICATE_VERIFY_FAILED Windows only?

2021-11-27 Thread Ulli Horlacher
My program uses https and runs fine on Linux, but on Windows it crashes:

W10dev:/cygdrive/p: python fextasy.py -D
DEBUG(fextasy.py): verbose=0
DEBUG(fextasy.py): User-Agent: fextasy-20211127_1806 Windows 10.0.19041
DEBUG(fextasy.py): TCPCONNECT to fex.flupp.org:443
Traceback (most recent call last):
  File "P:\fextasy.py", line 1351, in 
main()
  File "P:\fextasy.py", line 232, in main
file = fexget('')
  File "P:\fextasy.py", line 622, in fexget
if not http_connect(server,port):
  File "P:\fextasy.py", line 956, in http_connect
if not tcp_connect(server,port): return
  File "P:\fextasy.py", line 973, in tcp_connect
sock = context.wrap_socket(sock,server_hostname=host)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\ssl.py", 
line 512, in wrap_socket
return self.sslsocket_class._create(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\ssl.py", 
line 1070, in _create
self.do_handshake()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\ssl.py", 
line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate 
verify failed: certificate has expired (_s
sl.c:997)


The sourcecode here is:

def tcp_connect(host,port):
  global sock

  message(f"D:TCPCONNECT to {host}:{port}")
  try:
sock = socket.create_connection((host,port))
  except socket.error as e:
message("E:cannot connect to %s:%d - %s" % (host,port,e.strerror))
return False
  sock.settimeout(timeout)
  if port == 443:
context = ssl.create_default_context()
sock = context.wrap_socket(sock,server_hostname=host)
  return True



Google chrome and firefox both say the certifacte is valid:

https://fex.flupp.org/fop/U4xC4kz8/X-20211127192031.png

https://fex.flupp.org/fop/mBabXKSz/X-20211127192416.png

Why does Python complain (only on Windows!)?



-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Eventfd with epoll BlockingIOError

2021-11-27 Thread Barry Scott

> On 25 Nov 2021, at 22:29, jenk...@tutanota.com wrote:
> 
> Thanks very much for your reply.  
> 
> I am now getting a single event returned in Python, but it's not the right 
> event, as I'll explain below. 
> 
> I rearranged the Python code based on your comments:
> 
> #!/usr/bin/python3
> import sys
> import os
> import select
> 
> print("Inside Python")
> 
> event_fd = int(sys.argv[3])
> 
> print("Eventfd received by Python")
> print(event_fd)
> 
> event_write_value = 100
> 
> ep = select.epoll(-1)
> ep.register(event_fd, select.EPOLLIN | select.EPOLLOUT )
> 
> os.set_blocking(event_fd, False)
> 
> #__
> 
> print("Starting poll loop")
> 
> for fd_event in ep.poll():
> print("Python fd_event")
> print(fd_event)
> fd_received = fd_event[0]
> event_received = fd_event[1]
> 
> You advised to leave off select.EPOLLOUT from the line ep.register(event_fd, 
> select.EPOLLIN | select.EPOLLOUT ) -- which makes sense because I'm not 
> waiting for that event -- but without it both processes freeze in the for 
> loop (below print("Starting poll loop")) so we never receive an EPOLLIN 
> event.  So I included it, and here is the screen output from gdb:
> 
> Inside Python
> Eventfd received by Python
> 5
> Everything OK in Python
> Starting poll loop
> Python fd_event
> (5, 4)
> Writing to Python
> 5 Received from Python
> 8 Writing to Python
> Failed epoll_wait Bad file descriptor
> 5 Received from Python
> 8 Writing to Python
> Failed epoll_wait Bad file descriptor
> 5 Received from Python
> -1time taken 0.000629
> Failed to close epoll file descriptor
> Unlink_shm status: Bad file descriptor
> fn() took 0.000717 seconds to execute
> [Inferior 1 (process 26718) exited normally]
> (gdb) q
> 
> The Python fd_event tuple is 5, 4 -- 5 is the correct file descriptor and 4 
> is an EPOLLOUT event, which is not what I want. 
> 
> The eventfd is created in C as nonblocking:
> 
> int eventfd_initialize() {
>   int efd = eventfd(0, EFD_NONBLOCK);

So it is not a semaphore as EFD_SEMAPHORE is not set.
Thus you intend to send arbitrary 64 int values and know that the value of 0

>   return efd; }
> 
> When C writes it calls epoll_wait:
> 
> ssize_t epoll_write(int event_fd, int epoll_fd, struct epoll_event * 
> event_struc, int action_code)
> {
>int64_t ewbuf[1];

The type is wrong its uint64_t.

>ewbuf[0] = (int64_t)action_code;
>int maxevents = 1;
>int timeout = -1;
> 
>fprintf(stdout, " Writing to Python \n%d", event_fd);
> 
> write(event_fd, , 8);

> 
> if (epoll_wait(epoll_fd, event_struc, maxevents, timeout) == -1)

Why is this here? Surely you need the python code to unblock because 
action_code is != 0.

> {
> fprintf(stderr, "Failed epoll_wait %s\n", strerror(errno));
> }
> 
> ssize_t rdval = read(event_fd, , 8);   

Why are you reading here? That is what you expect the python code to do.

Do you want to know if python has read the value written? If so then wait for 
the fd to be writeable...

> 
> fprintf(stdout, " Received from Python \n%ld", rdval);

How do you know if the value read is from python?
Why isn't it the value you wrote above?

If you want two ways communications you need 2 eventfd's I'd guess.
One to allow you to send a >0 64 bit int to python.
One to allow python to send a >0 64 bit int to C.

--

What is the problem you are solving?

Is eventfd even the right solution to that problem?

Maybe you would be better off using Unix Domain Sockets that allow
you to send and receive a block of bytes.

Barry



> 
> return 0;
> }
> 
> The C side initializes its epoll this way:
> 
> int epoll_initialize(int efd, int64_t * output_array)
> {
>   struct epoll_event ev = {};
>   int epoll_fd = epoll_create1(0);
> 
>   struct epoll_event * ptr_ev = 
>   
>   if(epoll_fd == -1)
>   {
> fprintf(stderr, "Failed to create epoll file descriptor\n");
> return 1;
>   }
> 
>   ev.events = EPOLLIN | EPOLLOUT;
>   ev.data.fd = efd; //was 0
> 
>   if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, efd, ) == -1)
>   {
>   fprintf(stderr, "Failed to add file descriptor to epoll\n");
>   close(epoll_fd);
>   return 1;
>   }
> 
>   output_array[0] = epoll_fd;
>   output_array[1] = (int64_t)ptr_ev; //
> 
>   return 0;
> }
> 
> Technically C is not waiting for an EPOLLIN event, but again without it both 
> processes freeze unless either C or Python includes both events.  So that 
> appears to be where the problem is. 
> 
> The Linux epoll man page says, "epoll_wait waits for I/O events, blocking the 
> calling thread if no events are currently available."   
> https://man7.org/linux/man-pages/man7/epoll.7.html 
> .  That may be the clue 
> to why both processes freeze when I poll on only one event in each one. 
> 
> Thanks for any ideas based on this update, and thanks again for your earlier 
> reply. 
> 
> Jen
> 
> 
> -- 
> Sent with Tutanota, the secure & ad-free mailbox. 
> 
> 
> 
> Nov 

[issue43286] [doc] Clarify that Popen.returncode does not get auto-set when the process terminates

2021-11-27 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue33581] Document "optional components that are commonly included in Python distributions."

2021-11-27 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue27161] Confusing exception in Path().with_name

2021-11-27 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue45909] sysconfig --generate-posix-vars creates wrong file when cross compiling

2021-11-27 Thread Christian Heimes


Christian Heimes  added the comment:

I just realized that PYTHON_FOR_BUILD is far more complicated. Our WASM build 
system sets the env var to "$(pwd)/cpython/builddir/build/python". The 
configure script expects us to set several additional env vars.

The logic goes like this for cross compiling:

if PYTHON_FOR_BUILD is empty:
find Python interpreter with same version as PACKAGE_VERSION
set PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) 
_PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f 
pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib 
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) 
'$interp
else:
use user-supplied PYTHON_FOR_BUILD

Since we don't set any of the variables _PYTHON_PROJECT_BASE, 
_PYTHON_HOST_PLATFORM, and _PYTHON_SYSCONFIGDATA_NAME, we get wrong sysconfig 
data file.

--

___
Python tracker 

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



[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread keeely


keeely  added the comment:

You can take the view that it's not a bug (with some justification), but a few 
lines in the cmd docs would make all the difference in terms of wasted time.

I have now abandoned my Windows port and suggested users install WSL2 instead 
which is the easiest way forward for me, but it'd be nice to have known from 
the start that portions of cmd functionality are not available for Win32 
instead of the indirect references via readline.  You could throw us a bone 
here.

--

___
Python tracker 

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



[issue43286] [doc] Clarify that Popen.returncode does not get auto-set when the process terminates

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
components: +Library (Lib)
keywords: +easy
title: Clarify that Popen.returncode does not get auto-set when the process 
terminates -> [doc] Clarify that Popen.returncode does not get auto-set when 
the process terminates
versions: +Python 3.11, Python 3.9

___
Python tracker 

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



[issue25477] text mode for pkgutil.get_data

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

Closing due to lack of interest (the OP removed himself from the nosy list, and 
it is empty now).

--
nosy: +iritkatriel
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



[issue33581] Document "optional components that are commonly included in Python distributions."

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27161] Confusing exception in Path().with_name

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

I agree that it's not worth changing the code for this. If someone tries to 
pass {"a": "b"} as a name then, yeah, they get a weird error message.

--
nosy: +iritkatriel
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



Re: Failure to Display Top menu

2021-11-27 Thread Christian Gollwitzer

Am 26.11.21 um 21:38 schrieb Peter Mwale:

Hello, my python 3.10 shell is not displaying the top menu. What should I
do?



You should explain, what you do exactly. The Python interpreter does not 
have a menu.


a) What platform are you on? Windows, macOS, Linux?

b) How did ou start Python and what was the expectation?

Christian
--
https://mail.python.org/mailman/listinfo/python-list


[issue42268] ./configure failing when --with-memory-sanitizer specified

2021-11-27 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +28048
pull_request: https://github.com/python/cpython/pull/29815

___
Python tracker 

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



[issue42268] ./configure failing when --with-memory-sanitizer specified

2021-11-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset e71c12efcddc1076d5367461a5b416092267aa77 by Pablo Galindo Salgado 
in branch 'main':
bpo-42268: Fail the configure step if the selected compiler doesn't support 
memory sanitizer (GH-29806)
https://github.com/python/cpython/commit/e71c12efcddc1076d5367461a5b416092267aa77


--

___
Python tracker 

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



[issue23991] ZipFile sanity checks

2021-11-27 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue25477] text mode for pkgutil.get_data

2021-11-27 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

On the other hand, we can probably just remove the TODO

--

___
Python tracker 

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



[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I agree with Serhiy and Batuhan. Please reach to python-dev of you really want 
to pursue this even after what has been already discussed.

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



[issue24851] infinite loop in faulthandler._stack_overflow

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

I think this was fixed in issue38965.

--
nosy: +iritkatriel, ned.deily
resolution:  -> duplicate
status: open -> pending
superseder:  -> test_stack_overflow (test.test_faulthandler.FaultHandlerTests) 
is stuck with GCC10

___
Python tracker 

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



[issue23991] ZipFile sanity checks

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

I get NotADirectory errors now, I believe they were added in issue40564.

--
nosy: +iritkatriel
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Using zipfile.Path with several files prematurely closes zip

___
Python tracker 

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



[issue45910] mailbox should support options for calling email parser

2021-11-27 Thread bpoaugust


New submission from bpoaugust :

It looks like mailbox uses email.message_from_... for parsing emails.

However it does not allow for passing any options to the parser.

In particular the policy cannot be provided.

It would be useful if there was a way to pass such options.

--
components: email
messages: 407154
nosy: barry, bpoaugust, r.david.murray
priority: normal
severity: normal
status: open
title: mailbox should support options for calling email parser

___
Python tracker 

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



[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Vedran Čačić

Vedran Čačić  added the comment:

Absolutely, but that's not my problem. I take your sentence to mean that when I 
do something with a _dict_ argument, it should try to preserve its insertion 
order as much as possible (given the semantics of the concrete method in 
question). I agree.

But my question is about constructing a dict from something other than a dict 
(here, a str, simply because it's easiest to visualize). I'm sure you don't 
mean to say dict.fromkeys retains the insertion order of its argument always, 
since it's obviously false if you give it a set.

What I'd like to be specified here (or elsewhere, but here I think it's useful) 
is that _iteration order_ of the argument to dict.fromkeys is preserved as 
_insertion order_ (and therefore iteration order) of the resulting dict. 
Besides, I don't see any other point where it should be specified... the only 
other constructor, `dict` itself, gives a very precise description 
(https://docs.python.org/3/library/stdtypes.html#dict) of how it creates a dict 
from its argument(s). Of course, there it mattered even before Py3.7, since 
values were important. In dict.fromkeys values are all the same, but order 
still matters and should (IMO) be specified.

--

___
Python tracker 

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



[issue21557] [doc] os.popen & os.system lack shell-related security warnings

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
title: os.popen & os.system lack shell-related security warnings -> [doc] 
os.popen & os.system lack shell-related security warnings
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5

___
Python tracker 

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



[issue17708] sys.flags.hash_randomization doesn't return correct value

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

This is working now (note that since 3.10 hash randomisation is enabled by 
default):

cpython % export PYTHONHASHSEED=random
cpython % ./python.exe -c "import sys; print(sys.flags.hash_randomization)"
1
cpython % export PYTHONHASHSEED=0  
cpython % ./python.exe -c "import sys; print(sys.flags.hash_randomization)"
0
cpython % export PYTHONHASHSEED=1  
cpython % ./python.exe -c "import sys; print(sys.flags.hash_randomization)"
1

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue22755] contextlib.closing documentation should use a new example

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

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



[issue23010] "unclosed file" warning when defining unused logging FileHandler in dictConfig

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.4

___
Python tracker 

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



[issue45902] Bytes and bytesarrays can be sorted with a much faster count sort.

2021-11-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I’m -1 on this. Given that use cases are rare, there is no need to burden the 
code base with an optimization of something we can already do in other ways.

Also, I don’t like that the APIs for list.sort(), bytes.sort(), and 
bytearray.sort() wouldn’t match.  IMO that would do more harm than good.

--

___
Python tracker 

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



[issue22996] Order of _io objects finalization can lose data in reference cycles

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue24301] gzip module failing to decompress valid compressed file

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11:

>>> from gzip import GzipFile
>>> from io import BytesIO
>>> file = BytesIO()
>>> with GzipFile(fileobj=file, mode="wb") as z:
... z.write(b"data")
... 
4
>>> file.write(b"garbage")
7
>>> file.seek(0)
0
>>> GzipFile(fileobj=file).read()
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/iritkatriel/src/cpython-654/Lib/gzip.py", line 301, in read
return self._buffer.read(size)
   ^^^
  File "/Users/iritkatriel/src/cpython-654/Lib/_compression.py", line 118, in 
readall
while data := self.read(sys.maxsize):
  ^^
  File "/Users/iritkatriel/src/cpython-654/Lib/gzip.py", line 499, in read
if not self._read_gzip_header():
   
  File "/Users/iritkatriel/src/cpython-654/Lib/gzip.py", line 468, in 
_read_gzip_header
last_mtime = _read_gzip_header(self._fp)
 ^^^
  File "/Users/iritkatriel/src/cpython-654/Lib/gzip.py", line 428, in 
_read_gzip_header
raise BadGzipFile('Not a gzipped file (%r)' % magic)

gzip.BadGzipFile: Not a gzipped file (b'ga')

--
nosy: +iritkatriel
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.4

___
Python tracker 

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



[issue28352] winfo_pathname(..) | window id "xyz" doesn't exist in this application. | Python 3.4.4

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as there is not enough information to understand the issue and there 
were no replies to followup questions.  Please create a new issue if you are 
still seeing this problem on a current version (>= 3.9).

--
nosy: +iritkatriel
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



[issue23950] Odd behavior with "file" and "filename" attributes in cgi.FieldStorage

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

All the dict methods retain insertion order. There is nothing special about 
fromkeys().

--

___
Python tracker 

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



[issue25477] text mode for pkgutil.get_data

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> enhancement
versions: +Python 3.11 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue26346] PySequenceMethods documentation missing sq_slice and sq_ass_slice

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
components: +C API
type:  -> enhancement
versions: +Python 3.11 -Python 3.5

___
Python tracker 

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



[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

We just rejected the same issue 2 days ago. If you feel very strong about this; 
instead of creating new ticket in the same place, you might want to try 
python-dev instead. 

Re: the todo comment, feel free to send a patch that removes it. I don't thank 
that is still applicable.

--

___
Python tracker 

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



[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread theeshallnotknowethme


theeshallnotknowethme  added the comment:

List and sets as right operands in literal contains are optimized to constant 
tuples and frozensets, and I'd like to take this optimization a step further.

--

___
Python tracker 

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



[issue45909] sysconfig --generate-posix-vars creates wrong file when cross compiling

2021-11-27 Thread Ethan Smith


Change by Ethan Smith :


--
nosy: +ethan smith

___
Python tracker 

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



[issue23360] Content-Type when sending data with urlopen()

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

Martin, I think you fixed this in 

https://github.com/python/cpython/commit/3c0d0baf2badfad7deb346d1043f7d83bb92691f#diff-533bd604631e0e26ce55dfa75a878788f3c4d7d7ccb3bbaeaa2ee2a9c956ffe8

--
nosy: +iritkatriel
resolution:  -> out of date
status: open -> pending

___
Python tracker 

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



[issue24040] plistlib assumes dict_type is descendent of dict

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 3.4

___
Python tracker 

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



[issue19737] Documentation of globals() and locals() should be improved

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue25415] [doc] "there is no public constructor" should be reworded in io module documentation

2021-11-27 Thread Irit Katriel


Irit Katriel  added the comment:

Martin's patch needs to be converted to a GitHub PR and reviewed.

--
keywords: +easy -patch
nosy: +iritkatriel
title: I can create instances of io.IOBase -> [doc] "there is no public 
constructor" should be reworded in io module documentation
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5, Python 3.6

___
Python tracker 

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



[issue23323] [doc] mention that flags arg to imaplib's append should be a string

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
title: Issue with imaplib and append messages passing a tuple with flags -> 
[doc] mention that flags arg to imaplib's append should be a string
type:  -> enhancement
versions: +Python 3.11 -Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue21914] Create unit tests for Turtle guionly

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
type:  -> enhancement
versions: +Python 3.11 -Python 3.5

___
Python tracker 

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



[issue45881] Cross compiling on Linux is untested, undocumented, and broken

2021-11-27 Thread Christian Heimes


Change by Christian Heimes :


--
dependencies: +sysconfig --generate-posix-vars creates wrong file when cross 
compiling

___
Python tracker 

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



[issue45909] sysconfig --generate-posix-vars creates wrong file when cross compiling

2021-11-27 Thread Christian Heimes


New submission from Christian Heimes :

"sysconfig --generate-posix-vars" creates pybuilddir.txt and a 
platform-specific sysconfig data file like 
build/lib.linux-x86_64-3.11/_sysconfigdata__linux_x86_64-linux-gnu.py

When creating a cross-compile build of Python, sysconfig mixes data from the 
cross compile build and the host build. It creates a pybuilddir.txt and 
build/lib directory with correct values (e.g. wasm32-unknown-emscripten) but 
sysconfigdata file with name values from the host Python PYTHON_FOR_BUILD (e.g 
x86_64-unknown-linux-gnu). 

$ cat pybuilddir.txt 
build/lib.wasm32-unknown-emscripten-3.11

$ ls build/lib.wasm32-unknown-emscripten-3.11/_sysconfigdata*   

build/lib.wasm32-unknown-emscripten-3.11/_sysconfigdata__linux_x86_64-linux-gnu.py

$ grep CC 
build/lib.wasm32-unknown-emscripten-3.11/_sysconfigdata__linux_x86_64-linux-gnu.py
 
 'CC': 'gcc',

$ grep ^CC Makefile
CC= emcc

--
components: Build, Cross-Build
messages: 407141
nosy: Alex.Willmer, christian.heimes
priority: normal
severity: normal
status: open
title: sysconfig --generate-posix-vars creates wrong file when cross compiling
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



[issue15498] Eliminate the use of deprecated OS X APIs in getpath.c

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 3.4

___
Python tracker 

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



[issue22811] _top_level_dir state leaks on defaultTestLoader

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> unittest: _top_level_dir is incorrectly persisted between calls 
to different load_test methods

___
Python tracker 

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



[issue15010] unittest: _top_level_dir is incorrectly persisted between calls to different load_test methods

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11 -Python 2.7, Python 3.7, Python 3.8

___
Python tracker 

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



[issue23819] test_asyncio fails when run under -O

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 3.5

___
Python tracker 

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



[issue10483] http.server - what is executable on Windows

2021-11-27 Thread mike mcleod


mike mcleod  added the comment:

I will work on this next week.

--

___
Python tracker 

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



[issue1284670] Allow to restrict ModuleFinder to get "direct" dependencies

2021-11-27 Thread mike mcleod


mike mcleod  added the comment:

Ok, I will work on this soon and make further comments.

--

___
Python tracker 

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



[issue45907] Optimize literal comparisons and contains

2021-11-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> It doesn't seem to make sense why other operations on literals are optimized 
> but these particular ones aren't optimized (much).

The existing optimizer optimizes the following cases (note that the parser does 
not produce negative or complex numbers, they are created by the optimizer):

   -1
   1-2j
   1/3
   16*1024
   2**32-1
   1<<12
   b'a'[0]

They all are extremely common. Virtually every Python file contain some of such 
expressions, and they are often used in loops. In contrary, it is difficult to 
find any example of using comparison operations with all constant operands.

--

___
Python tracker 

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



[Python-announce] [RELEASE] pyspread 2.0.1

2021-11-27 Thread Martin Manns


pyspread 2.0.1
==

This is a bugfix release for pyspread 2.0.


Bug fixes:
 * Font tests removed because of frequent issues with Debian's font 
aliasing system

 * Outdated information regarding SVG export removed from documentation


About pyspread
==

Pyspread is a non-traditional spreadsheet that is based on and written
in the programming language Python.

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website:   https://pyspread.gitlab.io/
Download page: https://pypi.org/project/pyspread/
Signature for tarball:

https://gitlab.com/pyspread/downloads/-/raw/master/releases/pyspread-2.0.tar.gz.sig
Source code:   https://gitlab.com/pyspread/pyspread


Dependencies


Mandatory:
 * Python (≥ 3.6)
 * numpy (>=1.1)
 * PyQt5 (≥ 5.10, requires PyQt5.Svg)
 * setuptools (>=40.0)
 * markdown2 (>= 2.3)

Recommended:
 * matplotlib (>=1.1.1)
 * pyenchant (>=1.1)
 * pip (>=18)
 * python-dateutil (>= 2.7.0)

For building the apidocs with Sphinx see apidocs/requirements.txt


Enjoy

Martin

___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue45653] Freeze the encodings module.

2021-11-27 Thread Kumar Aditya


Change by Kumar Aditya :


--
pull_requests: +28047
pull_request: https://github.com/python/cpython/pull/29814

___
Python tracker 

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



[issue20126] sched doesn't handle at the expected time those events which are added after scheduler starts

2021-11-27 Thread Irit Katriel


Change by Irit Katriel :


--
title: sched doesn't handle events added after scheduler starts as expected -> 
sched doesn't handle at the expected time those events which are added after 
scheduler starts

___
Python tracker 

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



[issue45903] What’s New In Python 3.11: wrong reference to Signature.from_callable

2021-11-27 Thread Hugo van Kemenade


Hugo van Kemenade  added the comment:

Thanks Jakub! I've made https://github.com/python/cpython/pull/29813 to fix it.

--

___
Python tracker 

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



[issue45320] Remove deprecated inspect functions

2021-11-27 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


--
pull_requests: +28046
pull_request: https://github.com/python/cpython/pull/29813

___
Python tracker 

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



[issue45903] What’s New In Python 3.11: wrong reference to Signature.from_callable

2021-11-27 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


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

___
Python tracker 

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



[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +methane, rhettinger

___
Python tracker 

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



Re: Negative subscripts

2021-11-27 Thread Chris Angelico
On Sat, Nov 27, 2021 at 7:21 PM dn via Python-list
 wrote:
> The expression list is evaluated once; it should yield an iterable
> object. An iterator is created for the result of the expression_list.
> The suite is then executed once for each item provided by the iterator,
> in the order returned by the iterator. Each item in turn is assigned to
> the target list using the standard rules for assignments (see Assignment
> statements), and then the suite is executed. When the items are
> exhausted (which is immediately when the sequence is empty or an
> iterator raises a StopIteration exception), the suite in the else
> clause, if present, is executed, and the loop terminates.
> »
> https://docs.python.org/3/reference/compound_stmts.html#the-for-statement
>
>
> That said, I'm wondering if all is strictly true when the
> expression_list is a generator, which by definition features
> lazy-execution rather than up-front list production. So, things may
> depend upon the full-nature of the application.

Yes, it is. Evaluating a generator expression gives you a generator
object, which is an iterable.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Negative subscripts

2021-11-27 Thread dn via Python-list
On 27/11/2021 19.11, Frank Millman wrote:
> On 2021-11-26 11:24 PM, dn via Python-list wrote:
>> On 26/11/2021 22.17, Frank Millman wrote:
>>> In my program I have a for-loop like this -
>>>
>> for item in x[:-y]:
>>> ...    [do stuff]
>>>
>>> 'y' may or may not be 0. If it is 0 I want to process the entire list
>>> 'x', but of course -0 equals 0, so it returns an empty list.
>> ...
>>
> 
> [...]
> 
> That was an interesting read - thanks for spelling it out.
> 
>>
> for y in [ 0, 1, 2, 3, 4, 5 ]:
>> ... print( y, x[ :len( x ) - y ] )
>> ...
>> 0 ['a', 'b', 'c', 'd', 'e']
>> 1 ['a', 'b', 'c', 'd']
>> 2 ['a', 'b', 'c']
>> 3 ['a', 'b']
>> 4 ['a']
>> 5 []
>>
>> and yes, if computing y is expensive/ugly, for extra-credit, calculate
>> the 'stop' value outside/prior-to the for-loop!
>>
> 
> Ignoring the 'ugly' for the moment, what if computing y is expensive?
> 
> To check this, I will restate the example to more closely match my use
> case.
> 
 x = [1, 2, 3, 4, 5, 6, 7]
 y = [5, 4, 3]
 z = []

 for i in x[ : len(x) - len(y) ]:
> ...   i
> ...
> 1
> 2
> 3
> 4

 for i in x[ : len(x) - len(z) ]:
> ...   i
> ...
> 1
> 2
> 3
> 4
> 5
> 6
> 7

> 
> So it works perfectly (not that I had any doubts).
> 
> But what if it is expensive to compute y? Or to rephrase it, is y
> computed on every iteration, or only on the first one?
> 
> Without knowing the internals, it is not possible to tell just by
> looking at it. But there is a technique I learned from Peter Otten
> (haven't heard from him for a while - hope he is still around).
> 
 def lng(lst):
> ...   print(f'*{len(lst)}*')
> ...   return len(lst)
> ...

 for i in x[ : lng(x) - lng(y) ]:
> ...   i
> ...
> *7*
> *3*
> 1
> 2
> 3
> 4

 for i in x[ : lng(x) - lng(z) ]:
> ...   i
> ...
> *7*
> *0*
> 1
> 2
> 3
> 4
> 5
> 6
> 7

> 
> From this it is clear that y is only computed once, when the loop is
> started. Therefore I think it follows that there is no need to
> pre-compute y.
> 
> Hope this makes sense.

Perfect sense (== @Peter sense).


To confirm:

«8.3. The for statement¶

The for statement is used to iterate over the elements of a sequence
(such as a string, tuple or list) or other iterable object:

for_stmt ::=  "for" target_list "in" expression_list ":" suite
  ["else" ":" suite]

The expression list is evaluated once; it should yield an iterable
object. An iterator is created for the result of the expression_list.
The suite is then executed once for each item provided by the iterator,
in the order returned by the iterator. Each item in turn is assigned to
the target list using the standard rules for assignments (see Assignment
statements), and then the suite is executed. When the items are
exhausted (which is immediately when the sequence is empty or an
iterator raises a StopIteration exception), the suite in the else
clause, if present, is executed, and the loop terminates.
»
https://docs.python.org/3/reference/compound_stmts.html#the-for-statement


That said, I'm wondering if all is strictly true when the
expression_list is a generator, which by definition features
lazy-execution rather than up-front list production. So, things may
depend upon the full-nature of the application.


Assuming, as-per these simple examples, there is no advantage to
pre-computation, it may be more readable to 'prepare' the control-values
separately, thereby simplifying the (appearance of the) for-statement.


The problem at this level, are the terms: "fairly long", "pretty ugly"*,
and "expensive". There are various tactics which might be brought to
bear, but will only be applicable in specific situations. So, too little
information, too much speculation...

For example if there is repetition inside the loop, where a particular
x[ i ] is related to something multiple times - perhaps in  multiple
executions of the loop, 'memoisation' may save recalculation -
particularly if this happens inside a nested-loop. This has nothing to
do with the for-loop itself. It trades memory-space for execution-time -
one "expense" for another. However, only you can tell if it, or any
other idea, might be relevant in this application...


* can you make up your mind? Is it pretty, or ugly?
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Vedran Čačić

New submission from Vedran Čačić :

I'm sure this is exactly how it should work, I just want to know if you think 
it is documented properly, so I can rely on it. In my opinion the docs should 
be more precise.

>>> ''.join(dict.fromkeys('axbxc'))
'axbc'

Is this guaranteed by the documentation? Of course, dict iteration order is now 
guaranteed to be insertion order, but still, nowhere do the docs say that 
fromkeys inserts the keys into new dictionary in order in which they appear in 
its argument.

(Probably the reason for this is that dict iteration order was fixed in 3.7, 
yet fromkeys existed a long time before that.)

I propose an addition to the documentation:

> Create a new dictionary with keys from iterable (in order) and values set to 
> value.

https://docs.python.org/3/library/stdtypes.html

--
assignee: docs@python
components: Documentation
messages: 407136
nosy: docs@python, veky
priority: normal
severity: normal
status: open
title: dict.fromkeys insertion order
versions: Python 3.10, Python 3.11

___
Python tracker 

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