[issue45896] Conflicting statements in docs about default support for asyncio subprocesses on Windows

2021-11-24 Thread Rob


Rob  added the comment:

Ok will do. Thanks for confirming.

--

___
Python tracker 

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



[issue45896] Conflicting statements in docs about default support for asyncio subprocesses on Windows

2021-11-24 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

You are correct, the first statement is outdated.

Please feel free to make a pull request.

--

___
Python tracker 

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



[issue45897] Frozen dataclasses with slots raise TypeError

2021-11-24 Thread Eric V. Smith


Change by Eric V. Smith :


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



[issue45897] Frozen dataclasses with slots raise TypeError

2021-11-24 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith

___
Python tracker 

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



[issue45897] Frozen dataclasses with slots raise TypeError

2021-11-24 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eric.smith

___
Python tracker 

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



[issue45897] Frozen dataclasses with slots raise TypeError

2021-11-24 Thread Alex Waygood


Alex Waygood  added the comment:

This looks to be due to the fact that `slots=True` leads to the creation of an 
entirely new class (see line 1102), meaning that in the `super(cls, self)` 
calls in lines 611 and 618 (in the `_frozen_get_del_attr` function, responsible 
for generating `__setattr__` and `__delattr__` methods), `self` is no longer an 
instance of `cls`.

I believe this can be fixed by tweaking `_frozen_get_del_attr` so that `cls` in 
the generated `__setattr__` and `__delattr__` methods is dynamically computed 
(`cls = type(self)`), rather than read from a closure, as is currently the case.

--
components: +Library (Lib)
nosy: +AlexWaygood

___
Python tracker 

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



[issue45897] Frozen dataclasses with slots raise TypeError

2021-11-24 Thread Trey Hunner


New submission from Trey Hunner :

When making a dataclass with slots=True and frozen=True, assigning to an 
invalid attribute raises a TypeError rather than a FrozenInstanceError:

>>> from dataclasses import dataclass
>>> @dataclass(frozen=True, slots=True)
... class Vector:
... x: float
... y: float
... z: float
...
>>> v = Vector(1, 2, 3)
>>> v.a = 4
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 5, in __setattr__
TypeError: super(type, obj): obj must be an instance or subtype of type

--
messages: 406973
nosy: trey
priority: normal
severity: normal
status: open
title: Frozen dataclasses with slots raise TypeError
type: behavior
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



[issue45896] Conflicting statements in docs about default support for asyncio subprocesses on Windows

2021-11-24 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +asvetlov, yselivanov
type:  -> behavior
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



[issue45727] Parse error when missing commas is inconsistent

2021-11-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset c72311d91787005713bb5daf4532a86e06496afd by Pablo Galindo Salgado 
in branch '3.10':
[3.10] bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if 
inside parentheses. (GH-29767)
https://github.com/python/cpython/commit/c72311d91787005713bb5daf4532a86e06496afd


--

___
Python tracker 

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



[issue45876] Improve accuracy of stdev functions in statistics

2021-11-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Here's a reference for this use of round-to-odd: 
> https://www.lri.fr/~melquion/doc/05-imacs17_1-expose.pdf

Thanks Mark.  It looks like I'll be getting a little education over the 
Thanksgiving holiday :-)

Shown below is the code that I'm thinking of using to test for correct 
rounding.  Is this the right way to do it?

# Verify correct rounding.  Find exact values for half the distance
# to the two adjacent representable floats.  The unrounded function
# input should fall between the exact squares of those values.

for i in range(10_000_000):
numerator: int = randrange(10 ** randrange(40)) + 1
denonimator: int = randrange(10 ** randrange(40)) + 1
x: Fraction = Fraction(numerator, denonimator)

root: float = sqrt_frac(numerator, denonimator)

r_up: float = math.nextafter(root, math.inf)
half_way_up: Fraction = (Fraction(root) + Fraction(r_up)) / 2
half_way_up_squared: Fraction = half_way_up ** 2

r_down: float = math.nextafter(root, -math.inf)
half_way_down: Fraction = (Fraction(root) + Fraction(r_down)) / 2
half_way_down_squared: Fraction = half_way_down ** 2

assert r_down < root < r_up
assert half_way_down_squared <= x <= half_way_up_squared

--

___
Python tracker 

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



[issue45894] exception lost when loop.stop() in finally

2021-11-24 Thread Amos Anderson


Amos Anderson  added the comment:

Ah, thank you, Serhiy. I didn't know that, but I see that in the documentation:
https://docs.python.org/3/reference/compound_stmts.html#the-try-statement

But what about the 2nd case I presented where a `RuntimeError` was raised? 
That's the actual case I'm working on. Based on this:

> If the finally clause raises another exception, the saved exception is set as 
> the context of the new exception.


My expectation is that the two exceptions would be chained.

--

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +28006
pull_request: https://github.com/python/cpython/pull/29769

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +28005
pull_request: https://github.com/python/cpython/pull/29768

___
Python tracker 

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



[issue45892] Improve REPL with the underscore separators for int/float

2021-11-24 Thread Eric V. Smith


Eric V. Smith  added the comment:

And you can probably use sitecustomize.py to import this.

Since I don't see any action item here, I'm going to close this issue.

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



[issue44724] multiprocessing: the Resource Tracker process is never reaped

2021-11-24 Thread Alex Willmer


Change by Alex Willmer :


--
nosy: +Alex.Willmer

___
Python tracker 

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



[issue45727] Parse error when missing commas is inconsistent

2021-11-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 24c10d2943c482c4d3ecc71d45df2d8c10fa5bb1 by Pablo Galindo Salgado 
in branch 'main':
bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside 
parentheses (GH-29757)
https://github.com/python/cpython/commit/24c10d2943c482c4d3ecc71d45df2d8c10fa5bb1


--

___
Python tracker 

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



[issue45896] Conflicting statements in docs about default support for asyncio subprocesses on Windows

2021-11-24 Thread Rob


New submission from Rob :

Hi,

In the docs for the asyncio event loop, it has a note on page:
https://docs.python.org/3/library/asyncio-eventloop.html#running-subprocesses

"Note The default asyncio event loop on Windows does not support subprocesses. 
See Subprocess Support on Windows for details."

Then following the link in that note to:
https://docs.python.org/3/library/asyncio-platforms.html#subprocess-support-on-windows
Says:
"On Windows, the default event loop ProactorEventLoop supports subprocesses, 
whereas SelectorEventLoop does not."

So the issue is, there are conflicting statements about default support for 
asyncio subprocesses on Windows. It seems the first statement listed above, is 
wrong or outdated since the default event loop on Windows is the 
ProactorEventLoop which does support subprocesses.

Thank you!

--
assignee: docs@python
components: Documentation
messages: 406967
nosy: Rob4226, docs@python
priority: normal
severity: normal
status: open
title: Conflicting statements in docs about default support for asyncio 
subprocesses on Windows
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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Christian Heimes


Christian Heimes  added the comment:

You are welcome!

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread miss-islington


miss-islington  added the comment:


New changeset cd85d91bc66a587ce2ba668c897a5ecf118733cc by Miss Islington (bot) 
in branch '3.10':
bpo-45893: Add missing extern C to initconfig.h (GH-29761)
https://github.com/python/cpython/commit/cd85d91bc66a587ce2ba668c897a5ecf118733cc


--

___
Python tracker 

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



[issue45895] _Py_Sigset_Converter used without #ifdef HAVE_SIGSET_T check

2021-11-24 Thread Christian Heimes


New submission from Christian Heimes :

posixmodule.c defines _Py_Sigset_Converter() only when feature macro 
HAVE_SIGSET_T is set. Several use of the function miss the feature macro check 
and fail on platforms without sigset_t (e.g. wasm).

Modules/posixmodule.c:5939:14: error: implicit declaration of function 
'_Py_Sigset_Converter' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
Modules/posixmodule.c:5952:14: error: implicit declaration of function 
'_Py_Sigset_Converter' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
Modules/clinic/signalmodule.c.h:385:10: error: implicit declaration of function 
'_Py_Sigset_Converter' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]

--
components: Build, Cross-Build
messages: 406964
nosy: Alex.Willmer, brett.cannon, christian.heimes
priority: normal
severity: normal
stage: needs patch
status: open
title: _Py_Sigset_Converter used without #ifdef HAVE_SIGSET_T check
type: compile error
versions: Python 3.10, 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



[issue10552] Tools/unicode/gencodec.py error

2021-11-24 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread STINNER Victor


STINNER Victor  added the comment:

> Seems we lost the C++ handling in Include/cpython/initconfig.h

I was never in initconfig.h since the PEP 587 (PyConfig C API) was implemented. 
I'm not sure why the build *started* to fail on Windows.

Thanks for fixing the issue ;-)

--

___
Python tracker 

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



[issue45894] exception lost when loop.stop() in finally

2021-11-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is not related to loop.stop() and asyncio in general. It is the return 
statement which eats the exception. Simpler example:

>>> def f():
... try:
... 1/0
... finally:
... return 42
... 
>>> f()
42

Return (and also break and continue) in the finally block cancel an exception 
if it was raised.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45894] exception lost when loop.stop() in finally

2021-11-24 Thread Amos Anderson


Amos Anderson  added the comment:

If I do this instead:
```
try:
logger.info("raising exception")
raise ValueError("my exception1")
finally:
logger.info("stopped")
loop.stop()
await asyncio.sleep(0.5)
```

i.e., do an `await` instead of a `return`, then the original exception is also 
lost:

```
INFO:root:start
DEBUG:asyncio:Using selector: EpollSelector
INFO:root:raising exception
INFO:root:stopped
ERROR:root:Event loop stopped before Future completed.
Traceback (most recent call last):
  File "test.py", line 37, in 
asyncio.run(another_level())
  File "/home/amos/miniconda3/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
  File "/home/amos/miniconda3/lib/python3.8/asyncio/base_events.py", line 614, 
in run_until_complete
raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.
INFO:root:done
```

it's also a bit surprising that my handler in `another_level` didn't see either 
exception, but I'm not really sure what I'd expect in that case.

--

___
Python tracker 

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



[issue45727] Parse error when missing commas is inconsistent

2021-11-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +28004
pull_request: https://github.com/python/cpython/pull/29767

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks for the PR, @jcristharif.

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 151c9bf649a049f52df388a8f2390988949abf59 by Miss Islington (bot) 
in branch '3.9':
bpo-45693: Document `port` parameter to `loop.create_server` (GH-29760) 
(GH-29763)
https://github.com/python/cpython/commit/151c9bf649a049f52df388a8f2390988949abf59


--

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 8cabcde8d66bfd8abc98b862c93c66946f8514a1 by Miss Islington (bot) 
in branch '3.10':
bpo-45693: Document `port` parameter to `loop.create_server` (GH-29760) 
(GH-29762)
https://github.com/python/cpython/commit/8cabcde8d66bfd8abc98b862c93c66946f8514a1


--

___
Python tracker 

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



[issue45894] exception lost when loop.stop() in finally

2021-11-24 Thread Amos Anderson


New submission from Amos Anderson :

I found a case where an exception is lost if the loop is stopped in a `finally`.


```
import asyncio
import logging


logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()


async def method_that_raises():
loop = asyncio.get_event_loop()
try:
logger.info("raising exception")
raise ValueError("my exception1")
# except Exception as e:
# logger.info("in catcher")
# logger.exception(e)
# raise
finally:
logger.info("stopped")
loop.stop()
# await asyncio.sleep(0.5)

return


async def another_level():
try:
await method_that_raises()
except Exception as e:
logger.info("trapping from another_level")
logger.exception(e)


if __name__ == "__main__":
logger.info("start")
try:
asyncio.run(another_level())
except Exception as e:
logger.exception(e)
logger.info("done")
```

gives this output in python 3.10.0 and 3.8.10 (tested in Ubuntu Windows 
Subsystem Linux) and 3.8.11 in Windows:

```
INFO:root:start
DEBUG:asyncio:Using selector: EpollSelector
INFO:root:raising exception
INFO:root:stopped
INFO:root:done
```
i.e., no evidence an exception was raised (other than the log message included 
to prove one was raised)

If I remove the `return`, then the exception propagates as expected.

I believe the exception should be propagated regardless of whether there's a 
`return` in the `finally` block.

--
components: asyncio
messages: 406957
nosy: Amos.Anderson, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: exception lost when loop.stop() in finally
type: behavior
versions: Python 3.10, Python 3.8

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread miss-islington


Change by miss-islington :


--
keywords: +patch
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +28003
pull_request: https://github.com/python/cpython/pull/29765

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset f4afc53bf68c8ded20b281cd1baa88a679b4a3fd by Christian Heimes in 
branch 'main':
bpo-45893: Add missing extern C to initconfig.h (GH-29761)
https://github.com/python/cpython/commit/f4afc53bf68c8ded20b281cd1baa88a679b4a3fd


--

___
Python tracker 

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



[issue10552] Tools/unicode/gencodec.py error

2021-11-24 Thread Irit Katriel


Irit Katriel  added the comment:

I don't think Martin's patch has been applied. Is it needed?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread miss-islington


miss-islington  added the comment:


New changeset d71c7bc7339eb82de493c66ebbbfa1cad250ac78 by Jim Crist-Harif in 
branch 'main':
bpo-45693: Document `port` parameter to `loop.create_server` (GH-29760)
https://github.com/python/cpython/commit/d71c7bc7339eb82de493c66ebbbfa1cad250ac78


--
nosy: +miss-islington

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28002
pull_request: https://github.com/python/cpython/pull/29764

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28001
pull_request: https://github.com/python/cpython/pull/29763

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28000
pull_request: https://github.com/python/cpython/pull/29762

___
Python tracker 

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



[issue43805] multiprocessing.Queue hangs when process on other side dies

2021-11-24 Thread Thomas Kluyver


Thomas Kluyver  added the comment:

I think this is expected. The queue itself doesn't know that one particular 
process is meant to put data into it. It just knows that there's no data to 
get, so .get() blocks as the docs say it should.

This doesn't apply to issue22393, because the pool knows about its worker 
processes, so if one dies before completing a task, it can know something is 
wrong.

You could add a method to 'half close' a queue, so it can only be used for 
receiving, but not sending. If you called this in the parent process after 
starting the child, then if the child died, the queue would know that nothing 
could ever put data into it, and .get() could error. The channels API in Trio 
allows this, and it's the same idea I've just described at the OS level in 
issue43806.

--
nosy: +takluyver

___
Python tracker 

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



[issue18061] m68k Python 3.3 test results

2021-11-24 Thread Irit Katriel


Irit Katriel  added the comment:

Python 3.3 is no longer maintained, and there was no activity on this for 8 
years, so I am closing. If there are still issues with these tests on a current 
version (>= 3.9), please create a new issue.

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


--
keywords:  -patch
type:  -> compile error
versions: +Python 3.10

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread Jim Crist-Harif


Jim Crist-Harif  added the comment:

Apologies for the delay here. I've pushed a documentation patch at 
https://github.com/python/cpython/pull/29760.

--

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

Christian thinks that a PR by Victor broke this (GH-29488 / bpo-39026)

--
nosy: +vstinner

___
Python tracker 

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



[issue45693] `loop.create_server` with port=0 uses different ports for ipv4 & ipv6

2021-11-24 Thread Jim Crist-Harif


Change by Jim Crist-Harif :


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

___
Python tracker 

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



[issue43806] asyncio.StreamReader hangs when reading from pipe and other process exits unexpectedly

2021-11-24 Thread Thomas Kluyver


Thomas Kluyver  added the comment:

In the example script, I believe you need to close the write end of the pipe in 
the parent after forking:

cpid = os.fork()
if cpid == 0:
# Write to pipe (child)
else:
# Parent
os.close(ctx)
# Read from pipe

This is the same with synchronous code: os.read(prx, 1) also hangs. You only 
get EOF when nothing has the write end open any more. All the asyncio machinery 
doesn't really make any difference to this.

For a similar reason, the code writing (the child, in this case) should close 
the read end of the pipe after forking. If the parent goes away but the child 
still has the read end open, then trying to write to the pipe can hang (if the 
buffer is already full). If the child has closed the read end, trying to write 
will give you a BrokenPipeError.

--
nosy: +takluyver

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-11-24 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 5c4b19ec49a5fbad65a682225f7cfed8b78f2a2f by Christian Heimes in 
branch 'main':
bpo-45020: Fix strict-prototypes warning (GH-29755)
https://github.com/python/cpython/commit/5c4b19ec49a5fbad65a682225f7cfed8b78f2a2f


--

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Steve Dower


Steve Dower  added the comment:

Also, we should define $env:IncludeUWP="true" in the Windows PR tests. That 
will build extra binaries every time (that we ship in the Windows Store) and 
would catch this issue earlier.

--

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Steve Dower


Steve Dower  added the comment:

Seems we lost the C++ handling in Include/cpython/initconfig.h:

#ifdef __cplusplus
extern "C" {
#endif



#ifdef __cplusplus
}
#endif

--
keywords: +easy (C)
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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue45893] Azure Pipelines currently failing

2021-11-24 Thread Guido van Rossum


New submission from Guido van Rossum :

E.g. 
https://dev.azure.com/Python/cpython/_build/results?buildId=92084=results

--
assignee: steve.dower
components: Build
messages: 406945
nosy: gvanrossum, steve.dower
priority: high
severity: normal
status: open
title: Azure Pipelines currently failing

___
Python tracker 

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



[issue45822] Py_CompileString does not respect the coding cookie with the new parser if flags are empty

2021-11-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27997
pull_request: https://github.com/python/cpython/pull/29759

___
Python tracker 

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



[issue45822] Py_CompileString does not respect the coding cookie with the new parser if flags are empty

2021-11-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset abfc794bbf2c6a0939ddd81b6e700c46944ba87a by Pablo Galindo Salgado 
in branch 'main':
bpo-45822: Minor cleanups to the test_Py_CompileString test (GH-29750)
https://github.com/python/cpython/commit/abfc794bbf2c6a0939ddd81b6e700c46944ba87a


--

___
Python tracker 

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



[issue45822] Py_CompileString does not respect the coding cookie with the new parser if flags are empty

2021-11-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27996
pull_request: https://github.com/python/cpython/pull/29758

___
Python tracker 

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



[issue45727] Parse error when missing commas is inconsistent

2021-11-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +27995
pull_request: https://github.com/python/cpython/pull/29757

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes, christian.heimes, christian.heimes
nosy_count: 24.0 -> 25.0
pull_requests: +27992, 27993, 27994
pull_request: https://github.com/python/cpython/pull/29755

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes, christian.heimes
nosy_count: 24.0 -> 25.0
pull_requests: +27992, 27993
pull_request: https://github.com/python/cpython/pull/29755

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 24.0 -> 25.0
pull_requests: +27992
pull_request: https://github.com/python/cpython/pull/29755

___
Python tracker 

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



[issue44391] PC/launcher.c,one more argument than required

2021-11-24 Thread Zachary Ware


Change by Zachary Ware :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware
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



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

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27991
pull_request: https://github.com/python/cpython/pull/29754

___
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-24 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27990
pull_request: https://github.com/python/cpython/pull/29753

___
Python tracker 

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



[issue45616] Python Launcher Matches 3.10 instead of 3.1

2021-11-24 Thread Zachary Ware


Zachary Ware  added the comment:

Thanks for the report, Gabe!  We actually ran into this in the opposite 
direction as well; a system with 3.1 but not 3.10 started up 3.1 for `py -3.10` 
causing unexpected syntax errors.

The fix is now merged and will be available with the release of v3.10.1 and the 
next v3.11 alpha.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



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

2021-11-24 Thread Christian Heimes


Christian Heimes  added the comment:


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


--

___
Python tracker 

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



[issue45299] SMTP.send_message() does from mangling when it should not

2021-11-24 Thread R. David Murray


R. David Murray  added the comment:

Your backward compatibility argument is persuasive.  As you say, that means the 
BytesGenerate docs would need to be updated to note that that parameter is the 
exception to the rule for backward compatibility reasons.  (If it is the only 
exception I have to wonder if I had a backward compatibility reason for doing 
it that way in the first place and just forgot to document it.  It is too long 
ago to remember.  It is even possible that effectively changing the default 
broke mbox and that's why it is an exception :)

As for the send_message change, if mangle_from_ is the only exception then I 
think just passing it does make sense, maybe with a comment referencing the 
BytesGenerator docs for mangle_from_ to explain why it is needed.

--

___
Python tracker 

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



[issue45876] Improve accuracy of stdev functions in statistics

2021-11-24 Thread Mark Dickinson


Mark Dickinson  added the comment:

Here's a reference for this use of round-to-odd: 
https://www.lri.fr/~melquion/doc/05-imacs17_1-expose.pdf

I'm happy to provide any proofs that anyone feels are needed.

--

___
Python tracker 

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



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2021-11-24 Thread Henry Schreiner


Henry Schreiner  added the comment:

We had a call and have a potential path forward. Quick summary:

* Add a patch on top of the current patch to make CPython look for `-gnu` on 
top of `-musl` for Alpine 3.15 and 3.14. Reverting the patch would break every 
Alpine wheel previously locally compiled (like NumPy) and would require 
rebuilding all shipped packages that depend on Python.
* Revert the patch for CPython 3.10 in Alpine 3.16, due mid next year.
* Take the existing patch (PR 24502) targeting upstream CPython 3.11 and change 
search to include `abi3-gnu` on musl after looking for `abi3-musl`. The ability 
to install both binaries into a single folder would be a new "feature" of 
CPython 3.11.
* Optionally this could be checked and normalized by auditwheel (like changing 
`-musl` to `-gnu` on 3.9) if desired. ABI3 wheels targeting <3.11 could be 
normalized to `-gnu`.

How does that sound?

--
nosy: +Henry Schreiner

___
Python tracker 

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



[issue45892] Improve REPL with the underscore separators for int/float

2021-11-24 Thread Eric V. Smith


Eric V. Smith  added the comment:

Oops, the float example should be:

>>> 123123.9
123_123.9

--

___
Python tracker 

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



[issue45892] Improve REPL with the underscore separators for int/float

2021-11-24 Thread Eric V. Smith


Eric V. Smith  added the comment:

We can't change the repr of int/float.

However, you can use sys.displayhook to achieve what you want:

import sys

def displayhook(o):
if o is None:
return
__builtins__._ = None
if isinstance(o, (int, float)):
print(format(o, '_'))
else:
print(repr(o))
__builtins__._ = o

sys.displayhook = displayhook

Then:

>>> 12312312
12_312_312
>>> 123123e123
1.23123e+128
>>> None
>>> 'test'
'test'

--
nosy: +eric.smith

___
Python tracker 

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



[issue17179] Misleading error from type() when passing unknown keyword argument

2021-11-24 Thread Irit Katriel


Irit Katriel  added the comment:

This seems to have been fixed by now. I get this on 3.11:

>>> from types import new_class
>>> from datetime import datetime
>>> new_class('tdatetime', (datetime, ), kwds={'foo':'bar'})
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/iritkatriel/src/cpython-1/Lib/types.py", line 77, in new_class
return meta(name, resolved_bases, ns, **kwds)
   ^^
TypeError: tdatetime.__init_subclass__() takes no keyword arguments

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



[issue3232] Wrong str->bytes conversion in Lib/encodings/idna.py

2021-11-24 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



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

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


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

___
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-24 Thread Christian Heimes


Christian Heimes  added the comment:

bpo-45886 addresses the cross build issue with freeze_module command.

The wrong header files come from the fact that setup.py uses CC variable from 
sysconfig instead of environment. The sysconfig variable contains the C 
compiler of the build interpreter instead of the host interpreter. The correct 
value is in os.environ.

--
dependencies: +Fix Program/_freeze_module for cross compiling Python

___
Python tracker 

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



[issue45892] Improve REPL with the underscore separators for int/float

2021-11-24 Thread Alex


New submission from Alex :

I often use to the Python REPL to perform some simple calculations (typically 
some combinatorial or probabilities computation).
I believe it would be a nice improvement if the number displayed in the REPL 
would be formatted as if f"{result:_}" was given (with the underscore 
separators). For example:

 >>> 36 ** 7
 78_364_164_096

As I understand things:
* the REPL always shows the __repr__
* updating the __repr__ for int/float is a no-no for backward compatibility 
reasons

If these assumptions are correct (please correct me if this is wrong), then I 
guess this cannot be implemented, unless I missed something?

--
components: Interpreter Core
messages: 406934
nosy: alexprengere
priority: normal
severity: normal
status: open
title: Improve REPL with the underscore separators for int/float
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



[issue45760] Remove "PyNumber_InMatrixMultiply"

2021-11-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
keywords: +patch
nosy: +corona10
nosy_count: 3.0 -> 4.0
pull_requests: +27988
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29751

___
Python tracker 

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



[issue45822] Py_CompileString does not respect the coding cookie with the new parser if flags are empty

2021-11-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +27987
pull_request: https://github.com/python/cpython/pull/29750

___
Python tracker 

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



[issue45891] bool variable isinstance of int

2021-11-24 Thread noobie1000


Change by noobie1000 :


--
status: open -> closed

___
Python tracker 

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



[issue45891] bool variable isinstance of int

2021-11-24 Thread noobie1000


noobie1000  added the comment:

Hello Steven,

Sorry, this is my first ever post and was lost in the enormity of 
issues/documentation. Noted your points :)

Thank you.

--
resolution: not a bug -> 
status: closed -> open

___
Python tracker 

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



[issue45891] bool variable isinstance of int

2021-11-24 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Hi noobie1000, 

This is not a general forum for asking questions about Python's design or 
language, this is for reporting bugs.

There are many forums where you can ask "Why" questions and ask for the 
community to "shed some light on this", such as Reddit's r/python, the various 
mailing lists, Discuss, IRC, etc. In future please use them rather than the bug 
tracker.

Regarding bool, you can start by reading this:

https://www.python.org/dev/peps/pep-0285/

If that doesn't answer your questions, please feel free to take them to the 
many different forums here:

https://www.python.org/community/forums/

https://www.python.org/community/lists/

https://www.python.org/community/irc/

--
nosy: +steven.daprano
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



[issue45889] pathlib: Path.match does not work on paths

2021-11-24 Thread Nick Papior


Nick Papior  added the comment:

Thanks for the discussion.

--

___
Python tracker 

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



[issue45885] Specialize COMPARE_OP

2021-11-24 Thread Mark Shannon


Mark Shannon  added the comment:

Is COMPARE_OP worth specializing by itself?

Most comparisons are followed by a jump, and much of the overhead is in the 
branching around the choice of operator as well as pushing and popping (with 
inc/decrefs) a value that has only one bit of information (True/False).

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue45891] bool variable isinstance of int

2021-11-24 Thread Christian Heimes


Christian Heimes  added the comment:

This is the expected behavior. The bool type is a subtype of int. True is int 1 
in disguise and False is int 0.

>>> bool.__mro__
(, , )

>>> True == 1
True
>>> True == 2
False

>>> False == 0
True

--
nosy: +christian.heimes

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-11-24 Thread Christoph Groth


Christoph Groth  added the comment:

> What concrete action would you propose that the Python core devs take at this 
> point?

Nothing for now.

I stumbled across this issue through 
https://gitlab.kwant-project.org/kwant/tinyarray/-/issues/20 and had the 
impression that the aspect that I raised (that, for example, hash values of 
immutable built-in objects now no longer survive pickling) was not examined in 
this otherwise in-depth discussion.  So I added it for reference.

If problems come up that are caused by this change, I would consider reverting 
it a possible solution.

> The result of the change linked to this PR is that the hash now also reflects 
> that containment depends on object identity, not just object value.

This is a nice way to phrase it.  Thanks for the link to the entertaining talk. 
:-)

--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-11-24 Thread Mark Dickinson


Mark Dickinson  added the comment:

Just for fun: I gave a somewhat ranty 10-minute talk on this topic at a 
(virtual) conference a few months ago: 
https://www.youtube.com/watch?v=01oeosRVwgY

--

___
Python tracker 

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



[issue45891] bool variable isinstance of int

2021-11-24 Thread noobie1000


New submission from noobie1000 :

Hello,

Recently I observed that isinstance(x, int) returns True, even when x is 
defined as a bool. While I understand that internally, a bool is treated as an 
int with values 0 and 1; to me, this is a bit misleading that the python 
interpreter returns True when we perform the isinstance() check. May be I'm 
missing some deeper explanation. Could someone please shed some light on this. 
Has this been discussed by the community in the past. Thank you very much for 
reading this ticket.

>>> x = True
>>> isinstance(x, int)
True

--
components: IO
messages: 406926
nosy: noobie1000
priority: normal
severity: normal
status: open
title: bool variable isinstance of int
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-11-24 Thread Mark Dickinson


Mark Dickinson  added the comment:

@cwg: Yep, we're aware of this. There are no good solutions here - only a mass 
of constraints, compromises and trade-offs. I think we're already somewhere on 
the Pareto boundary of the "best we can do" given the constraints. Moving to 
another point on the boundary doesn't seem worth the code churn.

What concrete action would you propose that the Python core devs take at this 
point?

> it was possible to convert a tuple of floats into a numpy array and back into 
> a tuple, and the hash values of both tuples would be equal.  This is no 
> longer the case.

Sure, but the problem isn't really with hash; that's just a detail. It lies 
deeper than that - it's with containment itself:

>>> import numpy as np
>>> import math
>>> x = math.nan
>>> some_list = [1.5, 2.3, x]
>>> x in some_list
True
>>> x in list(np.array(some_list))  # expect True, get False
False

The result of the change linked to this PR is that the hash now also reflects 
that containment depends on object identity, not just object value. Reverting 
the change would solve the superficial hash problem, but not the underlying 
containment problem, and would re-introduce the performance issue that was 
fixed here.

--

___
Python tracker 

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



[issue45889] pathlib: Path.match does not work on paths

2021-11-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I don't think our opinions about this will converge, I'm therefore leaving this 
discussion.

>> would ``Path("dir/some.py").match(Path("*.py"))`` return?
>
> str(Path("*.py")) == "*.py"
>
> So no problems here.

I do think this is a problem, treating a Path like an pattern feels wrong to me.

--

___
Python tracker 

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



[issue45889] pathlib: Path.match does not work on paths

2021-11-24 Thread Nick Papior


Nick Papior  added the comment:

It basically checks that some part of the path is the same as some part of a 
reference path, they need not have the same complete parent which is why the 
resolve command would negate this comparison always.

--

As for your last example, that will be quite easily handled:

> would ``Path("dir/some.py").match(Path("*.py"))`` return?

str(Path("*.py")) == "*.py"

So no problems here.

It would even allow users for easier combination of patterns

suffix_path = Path("*.py")

if path.match("home" / suffix_path):
   
elif path.match("other" / suffix_path):
   


The equivalent code would have been:

suffix_path = "*.py"
if path.match(os.path.join("home", suffix_path):
   
elif path.match(os.path.join("other", suffix_path):
   


I think the former does not infer any confusion, nor does it seem to me to 
introduce anything that contradicts the meaning of match/glob/rglob.

--

___
Python tracker 

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



[issue45889] pathlib: Path.match does not work on paths

2021-11-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I'm not sure what your code tries to accomplish, does it check that 
``f.parent`` refers to the same location as ``ref_file``? A clearer solution 
for that would be ``f.parent.resolve() == ref_file.resolve()``. 



The argument to match, glob and rglob cannot be Paths because the argument is 
not a path but a pattern. Those are conceptually different.

What would ``Path("dir/some.py").match(Path("*.py"))`` return?

--

___
Python tracker 

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



[issue25066] Better repr for multiprocessing.synchronize objects

2021-11-24 Thread Kumar Aditya


Change by Kumar Aditya :


--
keywords: +patch
nosy: +kumaraditya303
nosy_count: 7.0 -> 8.0
pull_requests: +27986
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29749

___
Python tracker 

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



[issue32082] atexit module: allow getting/setting list of handlers directly

2021-11-24 Thread Irit Katriel


Irit Katriel  added the comment:

Yes, I agree this should be closed as a duplicate of issue17186. The shortcut 
for updating the list of handlers is not really necessary because the API 
already allows you to do this.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> no way to introspect registered atexit handlers

___
Python tracker 

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



[issue45878] Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`

2021-11-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27985
pull_request: https://github.com/python/cpython/pull/29748

___
Python tracker 

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



[issue45889] pathlib: Path.match does not work on paths

2021-11-24 Thread Nick Papior


Nick Papior  added the comment:

> Because of this I don't agree with your idea that anything that can match a 
> path is a sub-path. 

Why not? If a match is True, it means that what is matched must be some kind of 
valid path matching a glob specification. Whether it is a regular expression, 
or anything else. If one did $(ls pattern) one would list the paths that 
matches the pattern, and hence a path. Agreed that the pattern itself is not 
necessarily a fixed/single path, but a shell glob path. Yet, matches will 
regardless be a path.

As for the use case I want to assert a files path has a parent that matches 
another directory/filename something like this:


ref_file = Path("hello")
for f in dir.iterdir():
if f.parent.match(ref_file):


in the real application the match is a bit more complex with nested directories 
as well as a recursive iterator.

Lastly, you say:
> That said, I don't understand why it is desirable to use a Path as the match 
> argument.

I am on the other side:
I don't understand why it is undesirable to use a Path as the match argument.

:)

A simple

if isinstance(pattern, PurePath):
   pattern = str(pattern)

would suffice. Or possibly str(pattern.expanduser()) for consistency.

--

___
Python tracker 

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



[issue45889] pathlib: Path.match does not work on paths

2021-11-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Match doesn't match paths, but basically does a regular expression match on the 
textual representation  (using glob syntax instead of normal regular expression 
syntax).

Because of this I don't agree with your idea that anything that can match a 
path is a sub-path. 

What is your use case for this?

--

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-24 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27984
pull_request: https://github.com/python/cpython/pull/29747

___
Python tracker 

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



[issue45890] Add tests for tracing try-except-finally blocks

2021-11-24 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue45890] Add tests for tracing try-except-finally blocks

2021-11-24 Thread Irit Katriel


Change by Irit Katriel :


--
assignee: iritkatriel
components: Interpreter Core, Tests
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Add tests for tracing try-except-finally blocks
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



[issue45509] Gzip header corruption not properly checked.

2021-11-24 Thread Ruben Vorderman


Ruben Vorderman  added the comment:

I have found that using the timeit module provides more precise measurements:

For a simple gzip header. (As returned by gzip.compress or zlib.compress with 
wbits=31)
./python -m timeit -s "import io; data = 
b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00';
 from gzip import _read_gzip_header" '_read_gzip_header(io.BytesIO(data))'


For a gzip header with FNAME. (Returned by gzip itself and by Python's GzipFile)
./python -m timeit -s "import io; data = 
b'\x1f\x8b\x08\x08j\x1a\x9ea\x02\xffcompressable_file\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00';
 from gzip import _read_gzip_header" '_read_gzip_header(io.BytesIO(data))'

For a gzip header with all flags set:
./python -m timeit -s 'import gzip, io; data = 
b"\x1f\x8b\x08\x1f\x00\x00\x00\x00\x00\xff\x05\x00extraname\x00comment\x00\xe9T";
 from gzip import _read_gzip_header' '_read_gzip_header(io.BytesIO(data))'


Since performance is most critical for in-memory compression and decompression, 
I now optimized for no flags.
Before (current main): 50 loops, best of 5: 469 nsec per loop
after (PR): 100 loops, best of 5: 390 nsec per loop

For the most common case of only FNAME set:
before: 20 loops, best of 5: 1.48 usec per loop
after: 20 loops, best of 5: 1.45 usec per loop

For the case where FCHRC is set:
before: 20 loops, best of 5: 1.62 usec per loop
after: 10 loops, best of 5: 2.43 usec per loop


So this PR is now a clear win for decompressing anything that has been 
compressed with gzip.compress. It is neutral for normal file decompression. 
There is a performance cost associated with correctly checking the header, but 
that is expected. It is better than the alternative of not checking it.

--
Added file: https://bugs.python.org/file50459/benchmark_gzip_read_header.py

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-11-24 Thread Christoph Groth


Christoph Groth  added the comment:

Hello.  I would like to point out a possible problem that this change to 
CPython has introduced.

This change looks innocent, but it breaks the unwritten rule that the hash 
value of a number (or actually any built-in immutable type!) in Python depends 
only on its value.

Thus, before this change, it was possible to convert a tuple of floats into a 
numpy array and back into a tuple, and the hash values of both tuples would be 
equal.  This is no longer the case.

Or, more generally, any hashable tuple could be pickled and unpickled, without 
changing its hash value.  I could well imagine that this breaks real code in 
subtle ways.

Likewise, it is now no longer possible to provide a library of sequences of 
numbers that always hashes like built-in tuples.  (As "tinyarray", of which I 
am the author, did.)

--
nosy: +cwg

___
Python tracker 

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



[issue45889] pathlib: Path.match does not work on paths

2021-11-24 Thread Nick Papior


Nick Papior  added the comment:

Ok, I see this a feature. :)

As for why it is desirable.

A part of a path is still a path, and matching for something must mean that you 
are matching a partial path.

Even if you use '*.py' as the pattern this would still make sense as a path:

path = pl.Path("foo/bar")
print(path.match("bar"))
print(path.match(str(pl.Path("bar"
print(path.match(str(pl.Path("*"

The idea is that *anything* that can match a path _is_ a sub-path by 
definition, otherwise it can't be matched. So allowing path is just as natural 
as far as I see it.

As for the above argumentation I think this also holds for Path.glob and 
Path.rglob where pattern could just as well be a Path.

--

___
Python tracker 

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



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2021-11-24 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +27982
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29745

___
Python tracker 

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



[issue22045] Python make issue

2021-11-24 Thread Christian Heimes


Christian Heimes  added the comment:

Python 2 is no longer supported. Can you reproduce the issue with Python 3.9 or 
newer?

--
nosy: +christian.heimes

___
Python tracker 

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



  1   2   >