[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-01-20 Thread Arie Bovenberg


Arie Bovenberg  added the comment:

@hynek interesting! 

The discussion in https://github.com/python-attrs/attrs/pull/420 on the weakref 
slot is very interesting as well.

Considering __weakref__ is something we don't want to make impossible in 
dataclasses, @eric.smith what would be your preferred solution?

--

___
Python tracker 

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



[issue46444] Wrong value of pi for larger values using math.cos() function

2022-01-20 Thread Mark Dickinson


Mark Dickinson  added the comment:

Hi Darshan. This isn't a bug in Python. You're running into the limitations of 
floating-point arithmetic.

There's a lot of good material on those limitations available on the web, 
starting with Python's own tutorial: 
https://docs.python.org/3/tutorial/floatingpoint.html

If you want to understand what's going on in this particular case, take a 
closer look at the values of 90 - 180/k when k=2**62 and k=2**63, say. Are they 
the same? Should they be? Why / why not?

--
nosy: +mark.dickinson
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue45834] Move runtime except: check to the parser

2022-01-20 Thread Irit Katriel


Irit Katriel  added the comment:

We decided on the PR that this is not worth doing.

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



[issue46437] Non-required `hasattr` checks in `test_typing`

2022-01-20 Thread Alex Waygood


Change by Alex Waygood :


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



[issue41906] logging.config.dictConfig does not work with callable filters

2022-01-20 Thread Mario Corchero


Mario Corchero  added the comment:

Great! I'll put something together then. If you have any preference about the 
implementation or any pointer on the way you think should be done, please let 
me know.

--

___
Python tracker 

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



[issue45767] Fix types for dev_t processing in posix module

2022-01-20 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46444] Wrong value of pi for larger values using math.cos() function

2022-01-20 Thread Darshan Kanade


Darshan Kanade  added the comment:

Thanks Mark, for the explanation. I had no idea about how the floating point 
values are represented as binary fractions in the computer hardware. It was a 
very informative document. Thanks again!

--
nosy:  -serhiy.storchaka

___
Python tracker 

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



[issue37091] subprocess - uncaught PermissionError in send_signal can cause hang

2022-01-20 Thread Irit Katriel


Irit Katriel  added the comment:

I think this was fixed in Issue37424.

--
nosy: +iritkatriel
resolution:  -> duplicate
status: open -> pending
superseder:  -> subprocess.run timeout does not function if shell=True and 
capture_output=True

___
Python tracker 

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



[issue46434] pdb help fails with AttributeError when using Windows embeddable package

2022-01-20 Thread sparrowt


sparrowt  added the comment:

Thanks, yes CLA should now be working its way through the system.

I guess a side question is: is it expected for docstring to have been stripped 
from the windows embeddable distribution, and how is that done if not with -OO? 
(I found --without-doc-strings but not any build scripts using it)

This patch is still valid either way I think - better to show a helpful error 
than to explode - but I am intrigued as to the reason behind this case, 
deliberate or not. e.g. is there an assumption that the embed redistributable 
is never going to be used interactively & thus we might as well save space?

--

___
Python tracker 

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



[issue43474] http.server.BaseHTTPRequestHandler end_header() fails

2022-01-20 Thread Géry

Géry  added the comment:

> http.server.BaseHTTPRequestHandler end_headers() can reference _header_buffer 
> array before it is assigned.

@grumblor I was about to open the same bug after reading the implementation of 
http.server this morning and noticing that the attribute _headers_buffer of 
BaseHTTPRequestHandler is used in 4 methods:

- send_response_only;
- send_header;
- end_headers;
- flush_headers

but its existence is not checked only in end_headers.

> It seems like sending zero headers is not supported

@andrei.avk It is actually supported by the syntax of HTTP/1.1 messages, cf. 
RFC 7230, § 3:

HTTP-message   = start-line
  *( header-field CRLF )
  CRLF
  [ message-body ]

For instance the method handle_expect_100 does not send any header:

def handle_expect_100(self):
self.send_response_only(HTTPStatus.CONTINUE)
self.end_headers()
return True

It only writes a start line (which includes \r\n) followed by an empty line 
(\r\n) as a response:

HTTP/1.1 100 Continue\r\n\r\n

But self.end_headers() does not raise an AttributeError here like one might 
expect from its implementation:

def end_headers(self):
if self.request_version != 'HTTP/0.9':
self._headers_buffer.append(b"\r\n")
self.flush_headers()

because, contrary to what its name suggests, self._headers_buffer does not only 
include the response headers but also the response start line, which is 
appended to the buffer before by self.send_response_only(HTTPStatus.CONTINUE):

def send_response_only(self, code, message=None):
"""Send the response header only."""
if self.request_version != 'HTTP/0.9':
if message is None:
if code in self.responses:
message = self.responses[code][0]
else:
message = ''
if not hasattr(self, '_headers_buffer'):
self._headers_buffer = []
self._headers_buffer.append(("%s %d %s\r\n" %
(self.protocol_version, code, message)).encode(
'latin-1', 'strict'))

So I am not sure it is a bug if we consider that send_response_only (which 
appends a start line to the buffer) is a precondition to end_headers (which 
appends an empty line to the buffer and flushes it). But then flush_headers 
should also have this precondition instead of preventing the AttributeError 
like this:

def flush_headers(self):
if hasattr(self, '_headers_buffer'):
self.wfile.write(b"".join(self._headers_buffer))
self._headers_buffer = []

Let’s ask Andrew Schaaf (@endian) who introduced flush_headers in Python 3.3 
(cf. https://bugs.python.org/issue3709) why he implemented end_headers by 
contract and flush_headers defensively.

--
nosy: +endian, maggyero

___
Python tracker 

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



[issue46400] Please update bundled libexpat to 2.4.3 with security fixes

2022-01-20 Thread thomgree


Change by thomgree :


--
nosy: +thomgree

___
Python tracker 

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



[issue46409] Add a new bytecode instruction to create generators

2022-01-20 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset b04dfbbe4bd7071d46c8688c2263726ea31d33cd by Mark Shannon in 
branch 'main':
bpo-46409: Make generators in bytecode (GH-30633)
https://github.com/python/cpython/commit/b04dfbbe4bd7071d46c8688c2263726ea31d33cd


--

___
Python tracker 

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



[issue46409] Add a new bytecode instruction to create generators

2022-01-20 Thread Mark Shannon


Change by Mark Shannon :


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



[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2022-01-20 Thread Mark Shannon


Change by Mark Shannon :


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



[issue45947] Place dict (and values) pointers at a fixed (negative) offset from the base of the object.

2022-01-20 Thread Mark Shannon


Change by Mark Shannon :


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



[issue41906] logging.config.dictConfig does not work with callable filters

2022-01-20 Thread Vinay Sajip


Vinay Sajip  added the comment:

> If you have any preference about the implementation or any pointer

Nothing particular, just try to fit in with the existing code conventions even 
where they don't follow modern idioms (e.g. a lot of the code in this package 
predates PEP 8 and new styles of string formatting).

--

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-20 Thread Akuli


Akuli  added the comment:

> I also think that keeping a status quo (ignoring the mapping attribute in 
> typing) is the lesser evil.

Can you clarify this? There are several things that typing could do, and I 
don't know which option you are referring to. I listed most of them below, and 
I'd like to know which exactly of them "is the lesser evil".

If we literally ignore the attribute, any usage of `.mapping` will be an error, 
which basically makes the whole `.mapping` feature useless for statically typed 
code. It also wouldn't appear in IDE autocompletions.

If we add it to `KeysView` and `ValuesView`, library authors will end up using 
`.mapping` with arguments annotated as `Mapping` or `MutableMapping`, not 
realizing it is purely a dict thing, not required from an arbitrary mapping 
object.

If we keep `.mapping` in dict but not anywhere else, as described already, it 
becomes difficult to override .keys() and .values() in a dict subclass. You 
can't just return a KeysView or a ValuesView. If that was allowed, how should 
people annotate code that uses `.mapping`? You can't annotate with `dict`, 
because that also allows subclasses of dict, which might not have a `.mapping` 
attribute.

Yet another option would be to expose `dict_keys` and `dict_values` somewhere 
where they don't actually exist at runtime. This leads to code like this:


from typing import Any, TYPE_CHECKING
if TYPE_CHECKING:
# A lie for type checkers to work.
from something_that_doesnt_exist_at_runtime import dict_keys, dict_values
else:
# Runtime doesn't check type annotations anyway.
dict_keys = Any
dict_values = Any


While this works, it isn't very pretty.

--
nosy: +Akuli

___
Python tracker 

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



[issue46441] Caret points to wrong line on 'return yield 42' in REPL

2022-01-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue24905] Allow incremental I/O to blobs in sqlite3

2022-01-20 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

If you are ok with the proposed API in GH-30680, I'll mark it as ready for 
review.

--

___
Python tracker 

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



[issue45767] Fix types for dev_t processing in posix module

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is device number -1 used in any context (for example as "unknown device 
number")?

--

___
Python tracker 

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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 1fb1f5d8bd084c20f0a5fde547b563c08d103f09 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-46339: Fix crash in the parser when computing error text for 
multi-line f-strings (GH-30529) (GH-30542)
https://github.com/python/cpython/commit/1fb1f5d8bd084c20f0a5fde547b563c08d103f09


--

___
Python tracker 

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



[issue46434] pdb help fails with AttributeError when using Windows embeddable package

2022-01-20 Thread Steve Dower


Steve Dower  added the comment:

See 
https://github.com/python/cpython/blob/b04dfbbe4bd7071d46c8688c2263726ea31d33cd/PC/layout/main.py#L256-L289

Basically, the .pyc files in the embeddable distro have been compiled with 
optimize=2, which is the equivalent of -OO. So yes, docstrings (and asserts) 
are expected to have been removed.

It shouldn't be removing docstrings from other modules that you provide 
yourself.

--

___
Python tracker 

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



[issue46339] PEG parser segfault from ast.literal_eval

2022-01-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Sharing objects between interpreters is bad

That's your opinion, I don't necessarily share it.

> and is causing complex bugs.

But converting static things (types, small ints) to heap is also causing bugs :(



Anyway, for this issue: is there a way to test if the types are correctly 
reinitialized if there are multiple finalize/init cycles?
I worry about introducing more unexpected issues here.

--

___
Python tracker 

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



[issue46400] Please update bundled libexpat to 2.4.3 with security fixes

2022-01-20 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +ned.deily, paul.moore, ronaldoussoren, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue46434] pdb help fails with AttributeError when using Windows embeddable package

2022-01-20 Thread sparrowt


sparrowt  added the comment:

Gottit thanks for explaining - so the existing check in `do_help` didn't catch 
this case because https://docs.python.org/3/library/sys.html#sys.flags only 
reflects command line flags, rather than whether or not it was actually 
optimised.

--

___
Python tracker 

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



[issue46434] pdb help fails with AttributeError when using Windows embeddable package

2022-01-20 Thread Steve Dower


Steve Dower  added the comment:

> the existing check in `do_help` didn't catch this case because 
> https://docs.python.org/3/library/sys.html#sys.flags only reflects command 
> line flags, rather than whether or not it was actually optimised.

Precisely. Your check is much more appropriate for what the actual issue 
is going to be, though keeping the existing check there means we can 
provide a more specific error message when we *know* that the user 
deliberately chose that behaviour.

--

___
Python tracker 

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



[issue46441] Caret points to wrong line on 'return yield 42' in REPL

2022-01-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks for the bug report, Guido!

Everything should be ok now

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



[issue46442] testExceptionCleanupNames doesn't test anything?

2022-01-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

I don't know for sure, but maybe it's trying to test "del" interacting with the 
fact that the "as e" part doesn't escape the "except" clause, unlike normal 
assignments:

>>> try:
... raise Exception
... except Exception as e:
... print('exception raised')
... foo = 1
...
exception raised
>>> foo
1
>>> e
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'e' is not defined

--
nosy: +eric.smith

___
Python tracker 

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



[issue46445] Multiple inheritance of TypedDict is not covered in `test_typing`

2022-01-20 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Why is this important?
1. Because multiple inheritance of `TypedDict` might not handle 
`__required_keys__`, or `__optional_keys__`, or `__annotations__` correctly, 
this is especially important because some classes might be defined as 
`total=False` and some as `total=True`
2. Some classes might be defined inline as `T = TypedDict('T', ...)`
3. Moreover, we have a special error we have to check: all superclasses must be 
`TypedDict`s as well (coverage shows that this error is not covered) 
https://github.com/python/cpython/blob/650720a0cfa1673938e6d1bad53b6c37c9edb47d/Lib/typing.py#L2328-L2331

I will send a PR for this.

--
components: Tests
messages: 411030
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Multiple inheritance of TypedDict is not covered in `test_typing`
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



[issue46445] Multiple inheritance of TypedDict is not covered in `test_typing`

2022-01-20 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
nosy: +gvanrossum, kj

___
Python tracker 

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



[issue46445] Multiple inheritance of TypedDict is not covered in `test_typing`

2022-01-20 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46427] Correct MSBuild's configuration for _freeze_module.exe

2022-01-20 Thread Steve Dower


Steve Dower  added the comment:

This configuration is intentional.

When cross-compiling, tools that are executed as part of the build need to be 
built for the tool platform, not the target platform.

--
nosy: +steve.dower
resolution:  -> not a bug
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



[issue46441] Caret points to wrong line on 'return yield 42' in REPL

2022-01-20 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya
nosy_count: 3.0 -> 4.0
pull_requests: +28911
pull_request: https://github.com/python/cpython/pull/30720

___
Python tracker 

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



[issue46446] OpenBSD not MULTIARCH

2022-01-20 Thread Kurt Mosiejczuk


New submission from Kurt Mosiejczuk :

Just like FreeBSD, MULTIARCH should not be passed to OpenBSD.

Just add another line like done for FreeBSD

--
components: Build
messages: 411032
nosy: kmosiejczuk
priority: normal
severity: normal
status: open
title: OpenBSD not MULTIARCH
type: compile error
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



[issue46446] OpenBSD not MULTIARCH

2022-01-20 Thread Kurt Mosiejczuk


Change by Kurt Mosiejczuk :


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

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:

If tomorrow static types are shared between sub-interpreters, it doesn't solve 
this problem: we still need to release memory allocated by Py_Initialize() in 
Py_Finalize() when Python is embedded. This issue is a sub-set of the big 
bpo-1635741 which explains the rationale. Again, this issue is not about 
sub-interpreters.

> Anyway, for this issue: is there a way to test if the types are correctly 
> reinitialized if there are multiple finalize/init cycles? I worry about 
> introducing more unexpected issues here.

I wasn't sure how to test it. But well, Dong-hee and you asked for tests, so I 
added tests for my PR ;-)

--

___
Python tracker 

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



[issue46441] Caret points to wrong line on 'return yield 42' in REPL

2022-01-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for the quick fix!

--

___
Python tracker 

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



[issue46429] Merge all deepfrozen files into one

2022-01-20 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ef3ef6fa43d5cca072eed2a66064e818de583be7 by Kumar Aditya in 
branch 'main':
bpo-46429: Merge all deepfrozen files into one (GH-30572)
https://github.com/python/cpython/commit/ef3ef6fa43d5cca072eed2a66064e818de583be7


--

___
Python tracker 

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



[issue45767] Fix types for dev_t processing in posix module

2022-01-20 Thread Dmitry Marakasov


Dmitry Marakasov  added the comment:

> Is device number -1 used in any context (for example as "unknown device 
> number")?

Yes, there's NODEV macro in both Linux and FreeBSD which expands to ((dev_t)-1).

--

___
Python tracker 

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2022-01-20 Thread Christian Heimes


Christian Heimes  added the comment:

Serhiy, could you please rebase your PR to tip of main branch? I'd like to try 
it out.

--
nosy: +christian.heimes
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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-20 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28913
pull_request: https://github.com/python/cpython/pull/30722

___
Python tracker 

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



[issue43683] Handle generator (and coroutine) state in the bytecode.

2022-01-20 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +28914
pull_request: https://github.com/python/cpython/pull/30723

___
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

2022-01-20 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Mike's fix unfortunately didn't work out.

What are the rules about closing old enhancement requests? modulefinder is an 
old and rarely used package, and I feel like the use case is better served by a 
PyPI package.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46442] testExceptionCleanupNames doesn't test anything?

2022-01-20 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
nosy: +sobolevn

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-01-20 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset c02e860ee79f29905be6fca997c96bb1a404bb32 by Christian Heimes in 
branch 'main':
bpo-40280: Misc fixes for wasm32-emscripten (GH-30722)
https://github.com/python/cpython/commit/c02e860ee79f29905be6fca997c96bb1a404bb32


--

___
Python tracker 

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



[issue46442] testExceptionCleanupNames doesn't test anything?

2022-01-20 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Perhaps it's testing that the implicit `del` doesn't blow up if the variable is 
already deleted.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46425] Multiple test modules fail to run if invoked directly

2022-01-20 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
pull_requests: +28915
pull_request: https://github.com/python/cpython/pull/30725

___
Python tracker 

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



[issue31603] Please add argument to override stdin/out/err in the input builtin

2022-01-20 Thread Wren Turkal


Wren Turkal  added the comment:

I'm not sure that I ever got a definitive issue, but I didn't have time to
push it forward. I still think the idea has merit. I'd love to see it
implemented, but I don't have the time to pursue it right now.

Thanks,
wt

On Mon, Jan 17, 2022 at 10:23 AM Irit Katriel 
wrote:

>
> Irit Katriel  added the comment:
>
> See also Issue1927.
>
> --
> nosy: +iritkatriel
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue46316] Optimize pathlib.Path.iterdir()

2022-01-20 Thread Zachary Ware


Zachary Ware  added the comment:


New changeset a1c88414926610a3527398a478c3e63c531dc742 by Barney Gale in branch 
'main':
bpo-46316: optimize `pathlib.Path.iterdir()` (GH-30501)
https://github.com/python/cpython/commit/a1c88414926610a3527398a478c3e63c531dc742


--
nosy: +zach.ware

___
Python tracker 

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



[issue46316] Optimize pathlib.Path.iterdir()

2022-01-20 Thread Zachary Ware


Change by Zachary Ware :


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



[issue43654] IDLE: Fix tab completion after settings and some keys

2022-01-20 Thread Tal Einat


Tal Einat  added the comment:

Terry, for all intents and purposes you're the one in charge of IDLE now. I 
suggest deciding whether to change all three bindings as in the current PR or 
only the one for completions. Just le me know and if needed I'll make a new PR.

--

___
Python tracker 

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



[issue46441] Caret points to wrong line on 'return yield 42' in REPL

2022-01-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset 30fb6d073d9ca00dff8e4155c523cdfa63abab6b by Batuhan Taskaya in 
branch 'main':
bpo-46441: Add a boilerplate to test syntax errors in interactive mode 
(GH-30720)
https://github.com/python/cpython/commit/30fb6d073d9ca00dff8e4155c523cdfa63abab6b


--

___
Python tracker 

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2022-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It may take a time, because the module initialization code has been completely 
rewritten.

--

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-01-20 Thread jokot3


Change by jokot3 :


--
nosy: +jokot3

___
Python tracker 

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



[issue45413] Add install scheme for virtual environments

2022-01-20 Thread Stefano Rivera


Change by Stefano Rivera :


--
nosy: +stefanor

___
Python tracker 

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



[issue46447] datetime.isoformat() documentation does not point to the risk of using it with naive datetime objects

2022-01-20 Thread Jean Carlo Machado


New submission from Jean Carlo Machado :

datetime.utcnow() already present a warning box describing the risk of using it 
without specifying timezone information. However, one might still have the same 
problem and never encounter this warning information by doing 
datetime.now().isoformat(). Or just by not reading the docs of datetime.utcnow, 
just the datetime.isoformat docs.

By adding a similar warning to the datetime.isoformat() we could make the risk 
clearer and reduce the likelihood of errors. Is when calling isoformat() where 
people get confident to be producing ISO's.

I just recently had an incident in my company where we produced naive datetimes 
using datetime.now() and serialized them using isoformat() while expecting them 
to be a transferrable ISO format. Nevertheless, the other system read the dates 
without Z in the end and interpreted it as local time.

If you agree that this suggestion could be a good improvement to the docs, I 
can send a patch in the next 2 weeks.

--
assignee: docs@python
components: Documentation
messages: 411046
nosy: docs@python, jeanCarloMachado
priority: normal
severity: normal
status: open
title: datetime.isoformat() documentation does not point to the risk of using 
it with naive datetime objects
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



[issue26792] docstrings of runpy.run_{module,path} are rather sparse

2022-01-20 Thread Humbdrag


Change by Humbdrag :


--
nosy: +humbdrag
nosy_count: 3.0 -> 4.0
pull_requests: +28916
pull_request: https://github.com/python/cpython/pull/30729

___
Python tracker 

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



[issue46071] Graphlib documentation (edge direction)

2022-01-20 Thread Tim Peters


Tim Peters  added the comment:

For the purpose of topological sorting, yes, it's by far most natural to give, 
for each node, the collection of that node's predecessors. And that's the way 
topsort applications typically collect their data to begin with, like, "here, 
for each recipe, is a list of ingredients needed first" or "before we can begin 
this job, here are the other jobs that need to complete first". or, as in 
makefiles, "here's a list of the targets that need to be built before we can 
start building the current target".

I definitely don't want to change the wording, because it's bog standard as is. 
For example, Wikipedia's "topological sorting" entry is typical:

"""
In computer science, a topological sort or topological ordering of a directed 
graph is a linear ordering of its vertices such that for every directed edge uv 
from vertex u to vertex v, u comes before v in the ordering. 
"""

It's what topsort _means_. We did not intend to implement a "reverse topsort" 
algorithm, and I see no attraction to doing so, neither in pretending we did so.

If the way the user collects their data stores only successor links (which, as 
above, seems odd in applications that actually use topsorts), then they need 
something like this instead:

ts = TopologicalSorter()
for u, successors in my_forward_graph.items():
for v in successors:
ts.add(v, u)

But that's something I never needed.

--

___
Python tracker 

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



[issue46086] Add ratio_min() function to the difflib library

2022-01-20 Thread Tal Einat


Tal Einat  added the comment:

I'm closing this for now since nobody has followed up and to the best of my 
understanding this wouldn't be an appropriate addition to the stdlib. 

This can be re-opened in the future if needed, of course.

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:

I checked with Valgrind the affect of PR 30645.

main branch:

==330902== LEAK SUMMARY:
==330902==  possibly lost: 29,128 bytes in 494 blocks
==330902==still reachable: 353,615 bytes in 3,577 blocks

With the PR:

==332161== LEAK SUMMARY:
==332161==  possibly lost: 24,456 bytes in 417 blocks
==332161==still reachable: 337,223 bytes in 3,423 blocks

It frees 21,064 bytes (20 kB) in Py_Finalize().

--

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:

Another measure using the command:

PYTHONHASHSEED=0 ./python -X showrefcount -c pass

I had to run the command 20 times to get a stable value, I don't know why.

main branch: [21981 refs, 5716 blocks]
PR: [21887 refs, 5667 blocks]

=> the PR removes 94 references and 49 memory blocks.

--

___
Python tracker 

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



[issue41857] Document timeout arguments to poll() in select module

2022-01-20 Thread Tal Einat


Change by Tal Einat :


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



[issue40529] Auto Completions with case insensitive

2022-01-20 Thread Tal Einat


Change by Tal Einat :


--
Removed message: https://bugs.python.org/msg382482

___
Python tracker 

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



[issue40529] Auto Completions with case insensitive

2022-01-20 Thread Tal Einat


Change by Tal Einat :


--
Removed message: https://bugs.python.org/msg382481

___
Python tracker 

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



[issue40529] Auto Completions with case insensitive

2022-01-20 Thread Tal Einat


Tal Einat  added the comment:

This should probably be brought up in the python-ideas mailing list, which is 
much more active than the group on discuss.python.org.

--

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified raises exception

2022-01-20 Thread Tal Einat


Tal Einat  added the comment:


New changeset 9e87c0e03fa501fb90008547983ce4c1dcaaf90c by Felix Fontein in 
branch 'main':
bpo-46080: fix argparse help generation exception in edge case (GH-30111)
https://github.com/python/cpython/commit/9e87c0e03fa501fb90008547983ce4c1dcaaf90c


--
nosy: +taleinat

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified raises exception

2022-01-20 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +28917
pull_request: https://github.com/python/cpython/pull/30730

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified raises exception

2022-01-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28918
pull_request: https://github.com/python/cpython/pull/30731

___
Python tracker 

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



[issue23162] collections.abc sequences don't check identity before equality

2022-01-20 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Test identity first in membership operation of ItemsView, 
ValuesView and Sequence in collections.abc

___
Python tracker 

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



[issue24527] The MimeTypes class cannot ignore global files per instance

2022-01-20 Thread Irit Katriel


Change by Irit Katriel :


--
type: behavior -> 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



[issue7275] CoverageResult fails to merge input file with non-empty callers in trace.py

2022-01-20 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy -patch
versions: +Python 3.10, Python 3.11, Python 3.9 -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



[issue7275] CoverageResult fails to merge input file with non-empty callers in trace.py

2022-01-20 Thread Irit Katriel


Irit Katriel  added the comment:

The patch needs to be converted to a GitHub PR.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue41857] Document timeout arguments to poll() in select module

2022-01-20 Thread Tal Einat


Tal Einat  added the comment:


New changeset 27df7566bc19699b967e0e30d7808637b90141f6 by Zane Bitter in branch 
'main':
bpo-41857: mention timeout argument units in select.poll() and select.depoll() 
doc-strings (GH-22406)
https://github.com/python/cpython/commit/27df7566bc19699b967e0e30d7808637b90141f6


--
nosy: +taleinat

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified raises exception

2022-01-20 Thread miss-islington


miss-islington  added the comment:


New changeset e5edc8d737a45d9d8b9b93b8be52f85d79d0f417 by Miss Islington (bot) 
in branch '3.10':
bpo-46080: fix argparse help generation exception in edge case (GH-30111)
https://github.com/python/cpython/commit/e5edc8d737a45d9d8b9b93b8be52f85d79d0f417


--

___
Python tracker 

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



[issue27302] csv.Sniffer guesses wrong when unquoted fields contain quotes

2022-01-20 Thread Irit Katriel


Change by Irit Katriel :


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



[issue46448] TypedDict inspect.signature error

2022-01-20 Thread jhwang


New submission from jhwang :

I have Python 3.10.1 (Dec, 2021) installed and I see an error when inspecting 
signature of TypedDict class. This is the same issue reported on Issue43006 
(msg385535 - (view)). It was marked as resolved but the error looks persistent. 
Can someone confirm if this was fixed or any release version with the fix? 


import inspect

class T(typing.TypedDict):
a: int

print(inspect.signature(T))

was `(*args, **kwargs)` and now raises `ValueError: no signature found for 
builtin type `

--
components: Library (Lib)
messages: 411056
nosy: jhwang
priority: normal
severity: normal
status: open
title: TypedDict inspect.signature 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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified raises exception

2022-01-20 Thread miss-islington


miss-islington  added the comment:


New changeset c6691a7ccbd027298ea2486014b55db037fffc9f by Miss Islington (bot) 
in branch '3.9':
bpo-46080: fix argparse help generation exception in edge case (GH-30111)
https://github.com/python/cpython/commit/c6691a7ccbd027298ea2486014b55db037fffc9f


--

___
Python tracker 

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



[issue28982] multiprocessing.Queue.get(block=True, timeout=0) always raises queue.Empty

2022-01-20 Thread Irit Katriel


Irit Katriel  added the comment:

On 3.11 I get this on both Mac and windows:

>>> from multiprocessing import Queue
>>> q = Queue()
>>> q.put('foo')
>>> q.get(True, 0)  # raises Empty
'foo'

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



[issue46427] Correct MSBuild's configuration for _freeze_module.exe

2022-01-20 Thread neonene


neonene  added the comment:

> When cross-compiling, tools that are executed as part of the build need to be 
> built for the tool platform, not the target platform.

My PR does not against that at this point, as proposed codes are based on your 
PR28322 (09b4ad11f323f8702cde795e345b75e0fbb1a9a5).
If we now need to prepare for future MSVC *on* ARM, then current _freeze_module 
configurations in "pcbuild.sln" also need to be reconsidered:

{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM.ActiveCfg = Debug|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM.Build.0 = Debug|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM64.ActiveCfg = Debug|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Debug|ARM64.Build.0 = Debug|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|ARM.ActiveCfg = 
Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|ARM.Build.0 = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|ARM64.ActiveCfg = 
Release|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGInstrument|ARM64.Build.0 = Release|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|ARM.ActiveCfg = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.PGUpdate|ARM64.ActiveCfg = Release|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM.ActiveCfg = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM.Build.0 = Release|Win32
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM64.ActiveCfg = Release|x64
{19C0C13F-47CA-4432-AFF3-799A296A4DDC}.Release|ARM64.Build.0 = Release|x64


Anyway, what I care about is the usage of "PreferredToolArchitecture" property 
in the current configuration.
The property has nothing to do with whether the host is ARM* or not. Another 
property will do in the future.

When building x86 python with 64bit compiler (set 
PreferredToolArchitecture=x64), _freeze_module gets a x64 executable.

The following change is acceptable?

-  $(PreferredToolArchitecture)
+  

They are the same with no envvar. _freeze_module is always 32bit, though.

--

___
Python tracker 

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



[issue46071] Graphlib documentation (edge direction)

2022-01-20 Thread David Mc Dougall


David Mc Dougall  added the comment:

The "reverse-toposort" is actually quite a good idea. The end-user is usually 
going to want to iterate over the sorted output in the "reverse" order anyways, 
especially if they're doing task ordering / dependency resolution.

Also, the underlying algorithm produces the "reverse" ordering by default. In 
my experience from writing and using my own topological sorting programs using 
the "correct" definition: the toposorter reverses the list, and then the users 
iterates over it in reverse order.

--

___
Python tracker 

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



[issue19479] textwrap.dedent doesn't work properly with strings containing CRLF

2022-01-20 Thread Irit Katriel


Change by Irit Katriel :


--
type: behavior -> enhancement
versions: +Python 3.11 -Python 2.7, Python 3.3

___
Python tracker 

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



[issue46400] Please update bundled libexpat to 2.4.3 with security fixes

2022-01-20 Thread Ned Deily


Ned Deily  added the comment:

The bundled expat is potentially used by all Python builds, not just Windows or 
Mac builds.

--

___
Python tracker 

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



[issue46400] Please update bundled libexpat to 2.4.3 with security fixes

2022-01-20 Thread Ned Deily


Change by Ned Deily :


--
nosy:  -ned.deily, paul.moore, ronaldoussoren, steve.dower, tim.golden, 
zach.ware

___
Python tracker 

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



[issue46071] Graphlib documentation (edge direction)

2022-01-20 Thread David Mc Dougall


David Mc Dougall  added the comment:

> If the way the user collects their data stores only successor links (which, 
> as above, seems odd in applications that actually use topsorts), then they 
> need something like this instead:

Actually they only need to do this:

ts = TopologicalSorter(my_forward_graph).static_order()
ts = reversed(ts)


I think part of the issue here is that the document uses two terms to describe 
the same thing: "predecessor" and "edge-direction". Everywhere it discusses 
predecessors it gets it right, but the edge direction is hopelessly confused 
because they tried to use the "normal" definition of topo-sort and the only way 
to make that work is to also reverse the direction of the graph's edges to 
compensate (and the two reversals cancel each other out).

The edge direction is only mentioned twice in the whole document, once to 
define topo-sort and again to define the graph format.

If the users problem fits into the task dependency paradigm, then this library 
makes a lot of sense. But for users who just have a directed graph, the 
documentation is really really confusing. 

I think it would be much better if the document explained that this was a 
"reversed" topological sort with a slightly different definition, and used a 
"bog standard" graph format like for example in this tutorial: 
https://www.python.org/doc/essays/graphs/

--

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:

Another measure using the command:

PYTHONHASHSEED=0 ./python -X showrefcount -c pass

I had to run the command 20 times to get a stable value, I don't know why.

main branch: [21981 refs, 5716 blocks]
PR: [21887 refs, 5667 blocks]

=> the PR removes 94 references and 49 memory blocks.

--

___
Python tracker 

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



[issue46070] [subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression)

2022-01-20 Thread STINNER Victor


Change by STINNER Victor :


--
Removed message: https://bugs.python.org/msg411050

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e9e3eab0b868c7d0b48e472705024240d5c39d5c by Victor Stinner in 
branch 'main':
bpo-46417: Finalize structseq types at exit (GH-30645)
https://github.com/python/cpython/commit/e9e3eab0b868c7d0b48e472705024240d5c39d5c


--

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28919
pull_request: https://github.com/python/cpython/pull/30732

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-20 Thread Inada Naoki


Inada Naoki  added the comment:

> If we literally ignore the attribute, any usage of `.mapping` will be an 
> error, which basically makes the whole `.mapping` feature useless for 
> statically typed code. It also wouldn't appear in IDE autocompletions.

`.mapping` is not exist between Python 3.0~3.9. And it is not feature that is 
long awaited by many users.

See https://bugs.python.org/issue40890#msg370841
Raymond said:

  Traditionally, we do expose wrapped objects:  property() exposes fget,  
partial() exposes func, bound methods expose __func__, ChainMap() exposes maps, 
etc.
  Exposing this attribute would help with introspection, making it possible to 
write efficient functions that operate on dict views.

Type hints is very useful for application code, especially when it is large.
But introspection is very rarely used in such typed code bases. I don't think 
`.mapping` is useful for many users, like `.fget` of the property.
So adding `# type: ignore` in such lines is the "lesser evil".


> If we add it to `KeysView` and `ValuesView`, library authors will end up 
> using `.mapping` with arguments annotated as `Mapping` or `MutableMapping`, 
> not realizing it is purely a dict thing, not required from an arbitrary 
> mapping object.

It doesn't make sense at all, IMO.
If we really need `.mapping` in typeshed, we should add it to 
`KeysViewWithMapping`.
So mapping classes that don't inherit dict shouldn't be forced to implement 
`.mapping`.


> If we keep `.mapping` in dict but not anywhere else, as described already, it 
> becomes difficult to override .keys() and .values() in a dict subclass. You 
> can't just return a KeysView or a ValuesView. If that was allowed, how should 
> people annotate code that uses `.mapping`? You can't annotate with `dict`, 
> because that also allows subclasses of dict, which might not have a 
> `.mapping` attribute.

`# type: ignore`.


> Yet another option would be to expose `dict_keys` and `dict_values` somewhere 
> where they don't actually exist at runtime. This leads to code like this:
>
> from typing import Any, TYPE_CHECKING
> if TYPE_CHECKING:
> # A lie for type checkers to work.
> from something_that_doesnt_exist_at_runtime import dict_keys, dict_values
> else:
> # Runtime doesn't check type annotations anyway.
> dict_keys = Any
> dict_values = Any
>
> While this works, it isn't very pretty.

What problem this problem solve? `SortedDict.keys()` can not return `dict_keys`.
As far as I think, your motivation is making dict subclass happy with type 
checkers.
But this option doesn't make dict subclass happy at all.

--

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6415e2ee4955b1a995c1e75544e2506b03780c3d by Victor Stinner in 
branch 'main':
bpo-46417: _testembed.c avoids Py_SetProgramName() (GH-30732)
https://github.com/python/cpython/commit/6415e2ee4955b1a995c1e75544e2506b03780c3d


--

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28920
pull_request: https://github.com/python/cpython/pull/30733

___
Python tracker 

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



[issue45384] Accept Final as indicating ClassVar for dataclass

2022-01-20 Thread Mehdi2277


Mehdi2277  added the comment:

I recently hit this issue working on a config/parsing runtime type checking 
library (similar in spirit to pydantic).

The one other special typeform I was using these with that led me to discover 
this issue was Annotated. I use Annotated a fair amount to do some runtime 
analysis and I was used to `Annotated[typeform]` always works. But ClassVar and 
Final are special and `Annotated[ClassVar[...]] `and `Annotated[Final[...]]` 
both fail. I find `Annotated` interaction also weird. I ended up working around 
it by doing `ClassVar[Annotated[...]]` and stripping the classvar/final to look 
for the annotation metadata.

I think all 3 of annotated/final/classvar should be order compatible as they 
all serve to add information on the type they contain. 

If we ignore Annotated, I would say ClassVar/Final should be order compatible 
and a rule that Final[ClassVar[...]] works but not ClassVar[Final[...]] or vice 
versa would be weird.

--
nosy: +med2277

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28921
pull_request: https://github.com/python/cpython/pull/30734

___
Python tracker 

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue46071] Graphlib documentation (edge direction)

2022-01-20 Thread Tim Peters


Tim Peters  added the comment:

I'm going to leave this to Pablo - adding the `graph` argument was his idea ;-)

It would, I think, have been better if this argument had been named, say, 
"preds" instead of "graph".

The docs, to my eyes, are entirely clear about that `graph` is a representation 
based on mapping a node to its predecessors:

"""
If the optional graph argument is provided it must be a dictionary representing 
a directed acyclic graph where the keys are nodes and the values are iterables 
of all predecessors of that node in the graph (the nodes that have edges that 
point to the value in the key). 
"""

but it could perhaps be usefully emphasized that "the usual" graph 
representation in Python maps a node to its successors instead.

The stuff about "direction" continues to make no sense to me, though. The class 
computes the (forward!) topsort of the graph passed to it, given that the graph 
is presented as mapping nodes to predecessors. It's only "reversed" if you 
refuse to believe the docs, and insist that `graph` is mapping a node to its 
successors. But it's not.

>>> import graphlib
>>> ts = graphlib.TopologicalSorter({'A' : ['B']})
>>> list(ts.static_order())
['B', 'A']

Nothing is "reversed". The argument passed is the predecessor form of the graph 
B -> A, and [B, A] is the forward topsort of that graph.

--

___
Python tracker 

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



[issue22833] The decode_header() function decodes raw part to bytes or str, depending on encoded part

2022-01-20 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

This behavior is definitely unfortunate, but by now it's also been baked into 
more than a decade of Python 3 releases, so backward compatibility constraints 
make it difficult to fix.

How can we be sure this change won't break users' code?

For reference, here are a few uses of the function I found in major open-source 
packages:
- 
https://github.com/httplib2/httplib2/blob/cde9e87d8b2c4c5fc966431965998ed5f45d19c7/python3/httplib2/__init__.py#L1608
 - this assumes it only ever hits the (bytes, encoding) case.
- 
https://github.com/cherrypy/cherrypy/blob/98929b519fbca003cbf7b14a6b370a3cabc9c412/cherrypy/lib/httputil.py#L258
 - this assumes it only gets (str, None) or (bytes, encoding) pairs, which 
seems unsafe. But if it currently sees (str, None) and would see (bytes, None) 
with this change, it would break.

An alternative solution could be a new function with a sane return type.

Even if we decide to not change anything, we should document the surprising 
return type at https://docs.python.org/3.10/library/email.header.html.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f389b37fb1cebe7ed66331cdd373a014695261f6 by Victor Stinner in 
branch 'main':
bpo-46417: _thread uses PyStructSequence_NewType() (GH-30733)
https://github.com/python/cpython/commit/f389b37fb1cebe7ed66331cdd373a014695261f6


--

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 17f268a4ae6190b2659c89c6f32ad2d006e0e3c8 by Victor Stinner in 
branch 'main':
bpo-46417: time module uses PyStructSequence_NewType() (GH-30734)
https://github.com/python/cpython/commit/17f268a4ae6190b2659c89c6f32ad2d006e0e3c8


--

___
Python tracker 

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



  1   2   >