[issue44352] Native Windows Python builds running on Europe/Moscow TZ report wrong time from datetime.datetime.now when there is TZ environment variable also set to Europe/Moscow

2021-06-10 Thread Mike Kaganski


Mike Kaganski  added the comment:

Thank you Eryk! This is a good workaround for me. I have implemented it: 
https://git.libreoffice.org/core/+/3bcaa4ba79477a21251ddaa06e0ea159196a7ffb

It looks like it's not a Python's problem; I suppose this may be closed. Thanks 
again!

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44388] venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior

2021-06-10 Thread Matthew Clapp


Change by Matthew Clapp :


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

___
Python tracker 

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



[issue24781] Improve UX of IDLE Highlighting configuration tab

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Since uipreferences.py was written, in 2015, configdialog uses ttk widgets, 
including Notebook.  We have factored out a class for each notebook pane plus 
one for help sources and one for traced variables.

I have in mind something like highlight3.png and will look at the Listbox and 
Combobox code while experimenting with a couple of things.

--
nosy:  -kbk

___
Python tracker 

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



[issue44388] venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior

2021-06-10 Thread Matthew Clapp


New submission from Matthew Clapp :

The docs for the venv module, EnvBuilder class, ensure_directories method, 
describe behavior that doesn't match what its actual behavior is, (and what the 
code is).  I propose to update the documentation of the API to match the actual 
behavior.

https://docs.python.org/3.9/library/venv.html#venv.EnvBuilder.ensure_directories

The last sentence for ensure_directories(env_dir) reads:
The directories are allowed to exist already, as long as either clear or 
upgrade were specified to allow operating on an existing environment directory.

After testing and looking at the code (including past commits back over 6 
years), this is not true.  ensure_directories completely disregards the 
`upgrade` attribute.  Also it allows directories to exist already 
unconditionally (always operating without error), whether the `clear` attribute 
is set or not.  In addition, if `clear` is not set, it doesn't make any changes 
to the directories, but helpfully still returns the context of venv paths.

Ref: 
https://github.com/python/cpython/blob/3ce35bfbbe29664942f9a8c50c177a4575a31934/Lib/venv/__init__.py#L95

--
assignee: docs@python
components: Documentation
messages: 395603
nosy: docs@python, itsayellow
priority: normal
severity: normal
status: open
title: venv API Docs for EnvBuilder.ensure_directories incorrectly describe 
behavior
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue31930] IDLE: Pressing "Home" on Windows places cursor before ">>>"

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

IDLE Classic Windows currently works correctly.  A custom keyset with 
<> badly rebound does not.  So maybe I was using the latter 
when I open this.  Anyway, this is moot in 3.10 with prompt removed, and I 
intend to backpart the change.

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



[issue18444] IDLE: Revise macOS key bindings, make new one.

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I also closed #21359, which has more comment from Ned about bindings not 
working.

--

___
Python tracker 

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



[issue21359] IDLE macOS: Some Command shortcuts do not work correctly

2021-06-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> duplicate
stage: test needed -> resolved
status: open -> closed
superseder:  -> IDLE: Revise macOS key bindings, make new one.

___
Python tracker 

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



[issue18444] IDLE: Revise macOS key bindings, make new one.

2021-06-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
components: +macOS

___
Python tracker 

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



[issue18444] IDLE: Revise macOS key bindings, make new one.

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I closed #32761 about new macOS keyset, in favor of this one.  There is a bit 
more discussion there to consider.  I agree that a chart of <> down 
side and keyset across top would be a good start.

--
nosy:  -Todd.Rovito
title: IDLE: Revise Mac OS X key bindings. -> IDLE: Revise macOS key bindings, 
make new one.
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue32761] Create IDLE Modern Mac keyset

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

#18444 is about revising macOS keysets and/or making a new one.  This is about 
the latter.  So closing as duplicate.

--
resolution:  -> duplicate
stage:  -> needs patch
status: open -> closed
superseder:  -> IDLE: Revise Mac OS X key bindings.
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



[issue19094] urljoin should raise a TypeError if URL is not a string

2021-06-10 Thread Jacob Walls


Jacob Walls  added the comment:

Hi vajrasky, do you have any interest in converting your patch to a GitHub PR? 
If not I can see about doing so myself. Cheers.

--
nosy: +jacobtylerwalls

___
Python tracker 

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



[issue44376] Improve performance of integer exponentiation

2021-06-10 Thread Tim Peters


Tim Peters  added the comment:

This is a stab at reducing overhead for small exponents, along the lines I 
sketched:

https://github.com/python/cpython/pull/26662

Unfortunately, I've been unable to convince BPO and GitHub to recognize that 
the PR is related to this report. Did something basic change?

Incidentally, at first this change triggered rare shutdown deaths due to 
negative refcounts, in the collection of small integer objects. That was a 
head-scratcher! Turns that was, I believe, due to a "temp = NULL" line missing 
from earlier code introduced to implement powers of modular inverses.

--

___
Python tracker 

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



[issue44376] Improve performance of integer exponentiation

2021-06-10 Thread Tim Peters


Change by Tim Peters :


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

___
Python tracker 

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



[issue44365] Bad dataclass post-init example

2021-06-10 Thread Micael Jarniac


Micael Jarniac  added the comment:

Well, at least for this example, to call `super().__init__()`, I'd need to 
provide it the two arguments it expects, `x` and `y`, otherwise it'd give an 
error:

> TypeError: __init__() missing 2 required positional arguments: 'x' and 'y'

If I try calling it as `super().__init__(self.x, self.y)`, I get an infinite 
recursion error:

> RecursionError: maximum recursion depth exceeded while calling a Python object

That's mostly why I've chosen to call `__post_init__` instead.

And if we're dealing with `InitVar`s, they can nicely be chained like so:

>>> from dataclasses import dataclass, field, InitVar
>>>
>>> @dataclass
... class A:
... x: int
... y: InitVar[int]
... xy: int = field(init=False)
...
... def __post_init__(self, y: int) -> None:
... self.xy = self.x * y
...
>>> @dataclass
... class B(A):
... m: int
... n: InitVar[int]
... mn: int = field(init=False)
...
... def __post_init__(self, y: int, n: int) -> None:
... super().__post_init__(y)
... self.mn = self.m * n
...
>>> b = B(x=2, y=4, m=3, n=6)
>>> b
B(x=2, xy=8, m=3, mn=18)

--

___
Python tracker 

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



[issue44382] Python 3.9+ on Windows 8.0

2021-06-10 Thread Hypo Turtle


Hypo Turtle  added the comment:

Will do; that is where I presumed the issue was/comment needed added, just 
hadn't located that repo.

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



[issue44386] importlib and math.pi interact strangely

2021-06-10 Thread Jack DeVries


Jack DeVries  added the comment:

That is because pi, along with other constants in the math module are defined 
during module execution, not module creation:

https://github.com/python/cpython/blob/62f1d2b3d7dda99598d053e10b785c463fdcf591/Modules/cmathmodule.c#L1257-L1262

Taking the example right here 
(https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported)
 from the docs, you can see how they call exec_module() after module_from_spec.

If you change your code to do that as well, you will find that pi is now 
defined:



from importlib import util

mathmodule = util.find_spec("math")
math1 = util.module_from_spec(mathmodule)
mathmodule.loader.exec_module(math1)
print(math1.pi)



--
nosy: +jack__d

___
Python tracker 

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



[issue14322] More test coverage for hmac

2021-06-10 Thread Arjun


Arjun  added the comment:

would the update invalid test belong in the TestVectorsTestCase class or should 
I make a new one?

--

___
Python tracker 

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



[issue44382] Python 3.9+ on Windows 8.0

2021-06-10 Thread Jack DeVries


Jack DeVries  added the comment:

https://buildbot.python.org/all/#/waterfall?tags=win64

Buildbot is only running against 8.1, not 8.0. I'm guessing that means that the 
docs are correct and python.org main page is wrong. I'd open an issue over 
there:

https://github.com/python/pythondotorg/issues

--
nosy: +jack__d

___
Python tracker 

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



[issue44387] Not obvious that locale.LC_MESSAGES may not exist sometimes (e.g. on Windows)

2021-06-10 Thread Jack DeVries


Jack DeVries  added the comment:

Follow-up: nope! My hypothesis was incorrect. This is all that _localemodule.c 
has to say about LC_MESSAGES:

#ifdef LC_MESSAGES
ADD_INT(module, LC_MESSAGES);
#endif /* LC_MESSAGES */

--

___
Python tracker 

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



[issue44387] Not obvious that locale.LC_MESSAGES may not exist sometimes (e.g. on Windows)

2021-06-10 Thread Jack DeVries


Jack DeVries  added the comment:

Could it be that _locale throws an ImportError whenever LC_MESSAGES doesn't 
exist? Then, there are fall-backs defined here:

https://github.com/python/cpython/blob/62f1d2b3d7dda99598d053e10b785c463fdcf591/Lib/locale.py#L45-L85

--
nosy: +jack__d

___
Python tracker 

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset b613132861839b6d05b67138842b579e1af29f9c by Miss Islington (bot) 
in branch '3.10':
bpo-44342: [Enum] changed pickling from by-value to by-name (GH-26658) 
(GH-26660)
https://github.com/python/cpython/commit/b613132861839b6d05b67138842b579e1af29f9c


--

___
Python tracker 

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



[issue44387] Not obvious that locale.LC_MESSAGES may not exist sometimes (e.g. on Windows)

2021-06-10 Thread Richard Mines


New submission from Richard Mines :

Documentation page:
https://docs.python.org/3/library/locale.html#locale.LC_MESSAGES

Code comment saying that locale.LC_MESSAGES doesn't exist sometimes:
https://github.com/python/cpython/blob/62f1d2b3d7dda99598d053e10b785c463fdcf591/Lib/locale.py#L25-L26

Code fragment showing that locale.LC_MESSAGES can be non-existent:
https://github.com/python/cpython/blob/62f1d2b3d7dda99598d053e10b785c463fdcf591/Lib/locale.py#L1747-L1752

Reading documentation it's not obvious that locale.LC_MESSAGES may not exist 
(e.g. Windows - Microsoft Store - Python 3.8)

--
assignee: docs@python
components: Documentation
messages: 395588
nosy: docs@python, richardmines91
priority: normal
severity: normal
status: open
title: Not obvious that locale.LC_MESSAGES may not exist sometimes (e.g. on 
Windows)
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue44379] Pickling recursion error, did not import pickle

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The 'while pickling' part of the message is specific to running in IDLE, as 
Serhiy explained, but the recursion error itself is due to writing a program 
with infinite recursion.  The program switches the last two items back and 
forth indefinitely.  When run directly in Python, it gives the same error, with 
a different 'while' part.

Violet, this tracker is for patching Python docs and the CPython interpreter.  
Please ask questions about program behavior elsewhere, such as python-list.

--
assignee: terry.reedy -> 
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2021-06-10 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +25247
pull_request: https://github.com/python/cpython/pull/26632

___
Python tracker 

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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 3ce35bfbbe29664942f9a8c50c177a4575a31934 by Lysandros Nikolaou in 
branch '3.9':
[3.9] bpo-44385: Remove unused grammar rules (GH-26655) (GH-26659)
https://github.com/python/cpython/commit/3ce35bfbbe29664942f9a8c50c177a4575a31934


--

___
Python tracker 

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +25246
pull_request: https://github.com/python/cpython/pull/26660

___
Python tracker 

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 62f1d2b3d7dda99598d053e10b785c463fdcf591 by Ethan Furman in 
branch 'main':
bpo-44342: [Enum] changed pickling from by-value to by-name (GH-26658)
https://github.com/python/cpython/commit/62f1d2b3d7dda99598d053e10b785c463fdcf591


--

___
Python tracker 

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



[issue44368] Invalid mapping patterns give confusing SyntaxErrors

2021-06-10 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 05073036dcecefc00b0c3e7397601809da41e2f1 by Pablo Galindo in 
branch 'main':
bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632)
https://github.com/python/cpython/commit/05073036dcecefc00b0c3e7397601809da41e2f1


--

___
Python tracker 

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



[issue44386] importlib and math.pi interact strangely

2021-06-10 Thread Paul Prescod


New submission from Paul Prescod :

from importlib import util

mathmodule = util.find_spec("math")
math1 = util.module_from_spec(mathmodule)
print(math1.pi)

=

$ python3.8 /tmp/foo.py 
3.141592653589793

$ python3.9 /tmp/foo.py 
Traceback (most recent call last):
  File "/tmp/foo.py", line 5, in 
print(math1.pi)
AttributeError: module 'math' has no attribute 'pi'

--
components: Extension Modules
files: foo.py
messages: 395583
nosy: prescod2
priority: normal
severity: normal
status: open
title: importlib and math.pi interact strangely
versions: Python 3.10, Python 3.11
Added file: https://bugs.python.org/file50101/foo.py

___
Python tracker 

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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 3e137426de3e6a37622b2ca61207b1323fdea11f by Miss Islington (bot) 
in branch '3.10':
bpo-44385: Remove unused grammar rules (GH-26655)
https://github.com/python/cpython/commit/3e137426de3e6a37622b2ca61207b1323fdea11f


--

___
Python tracker 

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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +25245
pull_request: https://github.com/python/cpython/pull/26659

___
Python tracker 

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset e7b4644607789848f9752a3bd20ff216e25b4156 by Lysandros Nikolaou in 
branch 'main':
bpo-44385: Remove unused grammar rules (GH-26655)
https://github.com/python/cpython/commit/e7b4644607789848f9752a3bd20ff216e25b4156


--
nosy: +miss-islington

___
Python tracker 

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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25243
pull_request: https://github.com/python/cpython/pull/26657

___
Python tracker 

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 304ec53b53021ceddf62a38e66a06aed37e2ac41 by Miss Islington (bot) 
in branch '3.9':
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same 
(GH-26649) (GH-26652)
https://github.com/python/cpython/commit/304ec53b53021ceddf62a38e66a06aed37e2ac41


--

___
Python tracker 

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 01286017c3345e2b8a0af2bd48f6eb2087693a82 by Miss Islington (bot) 
in branch '3.10':
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same 
(GH-26649) (GH-26653)
https://github.com/python/cpython/commit/01286017c3345e2b8a0af2bd48f6eb2087693a82


--

___
Python tracker 

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:

Looking into this I think the root of the problem is the way `reduce` is 
handled -- currently, Enum's `__reduce_ex__` works by returning the class, and 
the value to use to lookup the member.  Because that lookup can fail with 
complex enums, EnumType will sabotage `reduce` if it can't find support in the 
new enum class.

However, if `__reduce_ex__` working by returning

`getattr, (self.__class, self._name_)`

then we should be fine, as that should never fail.

--

___
Python tracker 

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



[issue34266] Bad behavior with "restart \" or "restart "" in pdb

2021-06-10 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 2.0 -> 3.0
pull_requests: +25242
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26656

___
Python tracker 

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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


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

___
Python tracker 

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



[issue44385] Some target-related rules are unreachable in the grammar

2021-06-10 Thread Lysandros Nikolaou


New submission from Lysandros Nikolaou :

Three rules (targets, target and t_atom) in the grammar are unreachable. We 
were using them at some point in the past, but we never removed them when we 
replaced them with other rules.

--
assignee: lys.nikolaou
components: Parser
messages: 395577
nosy: gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Some target-related rules are unreachable in the grammar
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



[issue44370] Inconsistent results for min() and max() with math.nan as argument

2021-06-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

We should consider biting the bullet and revising the default NaN sort order.  
It has been a perpetual irritant.

1) Have NaNs always compare to less than any other float value.
2) When comparing two distinct NaNs, use the NaN payload
   and fall back to object id if necessary.
3) When comparing two identical NaNs, always return False.

That preserves the IEEE-754 guarantee that NaNs never compare equal to one 
another -- which is one of the few properties that people rely on.

IEEE-754 doesn't concern itself at all with the notion of object identity, so 
giving two NaNs a deterministic but unequal ordering isn't at odds with the 
standard.

IMHO, making min(), max(), and sorted() both deterministic and commutative is a 
big enough win to warrant foregoing one of the less important properties of 
NaN.  User care about determinism and commutativity more than they care that 
float('NaN') > 10 and float('NaN') < 10 both return False.

“Logic clearly dictates that the needs of the many outweigh the needs of the 
few.” -- Spock, The Wrath of Khan ;-)

Python is practical language, so we should consider making a choice based on 
pragmatism rather than strict standard compliance.  Bug reports like this are 
the tip of the iceberg.  Given the prevalence of NaNs being used as a 
placeholder for missing data, it is likely that people struggle with this every 
day.

The original design of NaNs was to let invalid intermediate results flow 
through a calculation and not require error testing at every step.  But in 
practice, NaNs are not commonly used this way.  Mainly, they are used as the 
float equivalent of None in an array of floats.  We should support this 
reality.  IMO it is a small disaster that NaNs completely wreck sorting and do 
so silently.  From user POV, an arcane property of NaNs is an inadequate 
justification for the misbehavior.

--
nosy: +rhettinger

___
Python tracker 

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



[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__

2021-06-10 Thread Irit Katriel


Change by Irit Katriel :


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



[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__

2021-06-10 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 175ebc60d52f2e88cf5cba5224c15074d2623c10 by Miss Islington (bot) 
in branch '3.9':
bpo-37022: Fix bug where pdb's do_p/do_pp commands swallow exceptions from repr 
(GH-18180) (GH-26651)
https://github.com/python/cpython/commit/175ebc60d52f2e88cf5cba5224c15074d2623c10


--

___
Python tracker 

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



[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__

2021-06-10 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset e3bc32fc1ad5537b476b34062b07a040533c913a by Miss Islington (bot) 
in branch '3.10':
bpo-37022: Fix bug where pdb's do_p/do_pp commands swallow exceptions from repr 
(GH-18180) (GH-26650)
https://github.com/python/cpython/commit/e3bc32fc1ad5537b476b34062b07a040533c913a


--

___
Python tracker 

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



[issue44365] Bad dataclass post-init example

2021-06-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not sure directly calling __post_init__ is a good pattern. Why would not 
calling __init__, like you would with any other class, not be the preferred 
thing to do?

--

___
Python tracker 

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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you everyone for your help.

--
priority: release blocker -> 
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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25239
pull_request: https://github.com/python/cpython/pull/26653

___
Python tracker 

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25240
pull_request: https://github.com/python/cpython/pull/26654

___
Python tracker 

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +25238
pull_request: https://github.com/python/cpython/pull/26652

___
Python tracker 

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



[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__

2021-06-10 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 6544b2532df82d137b71323445a07a6e29bcdec0 by Daniel Hahler in 
branch 'main':
bpo-37022: Fix bug where pdb's do_p/do_pp commands swallow exceptions from repr 
(GH-18180)
https://github.com/python/cpython/commit/6544b2532df82d137b71323445a07a6e29bcdec0


--
nosy: +iritkatriel

___
Python tracker 

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



[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__

2021-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25237
pull_request: https://github.com/python/cpython/pull/26651

___
Python tracker 

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



[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__

2021-06-10 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 8a4f0850d75747af8c96ca0e7eef1f5c1abfba25 by Ethan Furman in 
branch 'main':
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same 
(GH-26649)
https://github.com/python/cpython/commit/8a4f0850d75747af8c96ca0e7eef1f5c1abfba25


--

___
Python tracker 

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



[issue33962] IDLE: use ttk.spinbox with configdialog

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Mark, I am not sure what last comment meant, but we generally only test IDLE 
with 3.x with the 8.6.y that comes with 3.x.  Ned Deily sometimes runs gui 
tests with various tcl/tk versions and builds to select one for the installer, 
but he knows about whatever you said ;-).

Thank you for the patch.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue33962] IDLE: use ttk.spinbox with configdialog

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 540ebc4a8874f94152980be7778f3f793b65f111 by Miss Islington (bot) 
in branch '3.10':
bpo-33962: Use ttk spinbox for IDLE indent space config (GH-22954)
https://github.com/python/cpython/commit/540ebc4a8874f94152980be7778f3f793b65f111


--

___
Python tracker 

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



[issue44384] test_ttk_guionly: 2 tests fail once each on Pipelines Ubuntu

2021-06-10 Thread Terry J. Reedy


New submission from Terry J. Reedy :

3.10 Pipelines Ubuntu CI (like #42370) Each passed on 3.11 and 3.9 and all 
other CI tests and my machine.

FIRST RUN - FAIL: test_heading_callback 
(tkinter.test.test_ttk.test_widgets.TreeviewTest)
--
Traceback (most recent call last):
  File "/home/vsts/work/1/s/Lib/tkinter/test/test_ttk/test_widgets.py", line 
1548, in test_heading_callback
simulate_heading_click(5, 5)
  File "/home/vsts/work/1/s/Lib/tkinter/test/test_ttk/test_widgets.py", line 
1536, in simulate_heading_click
self.assertEqual(self.tv.identify_region(x, y), 'heading')
AssertionError: 'nothing' != 'heading'
- nothing
+ heading


RETEST RUN - FAIL: test_variable_change 
(tkinter.test.test_ttk.test_extensions.LabeledScaleTest)
--
Traceback (most recent call last):
  File "/home/vsts/work/1/s/Lib/tkinter/test/test_ttk/test_extensions.py", line 
144, in test_variable_change
self.assertGreater(x.scale.coords()[0], curr_xcoord)
AssertionError: 1 not greater than 1

--
components: Tests, Tkinter
messages: 395567
nosy: serhiy.storchaka, terry.reedy, vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: test_ttk_guionly: 2 tests fail once each on Pipelines Ubuntu
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



[issue44364] Add non integral tests for `sqrt()`

2021-06-10 Thread Mark Dickinson


Mark Dickinson  added the comment:

> 2921 is the smallest integers for which math.sqrt(x) > x**0.5

This is platform-dependent. On my machine, for example, `math.sqrt(2921) == 
2921**0.5` returns `True`.

I don't see a lot of value in additional tests here; we're only wrapping the 
libm sqrt, so we only really need enough testing to catch possible 
implementation errors in that wrapping. But testing only integers with an exact 
square root doesn't seem enough.

--

___
Python tracker 

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



[issue33962] IDLE: use ttk.spinbox with configdialog

2021-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 9b889433c7bb3ed7e2b4655f024b49d97fe412fb by Miss Islington (bot) 
in branch '3.9':
bpo-33962: Use ttk spinbox for IDLE indent space config (GH-22954)
https://github.com/python/cpython/commit/9b889433c7bb3ed7e2b4655f024b49d97fe412fb


--

___
Python tracker 

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



[issue44342] enum with inherited type won't pickle

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


--
priority: normal -> high
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



[issue44364] Add non integral tests for `sqrt()`

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

65733 and 262694 are integers in range 1..100 with largest relative errors 
of naive square root (with different signs).

33031 and 524557 are integers in range 1..100 with largest relative errors 
of naive cube root (with different signs).

--

___
Python tracker 

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


--
title: Abstract enum mixins not allowed -> Multiple enum mixins not allowed 
even when they have the same datatype

___
Python tracker 

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



[issue44356] Multiple enum mixins not allowed even when they have the same datatype

2021-06-10 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



[issue44364] Add non integral tests for `sqrt()`

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

>>> math.sqrt(2.5) == 2.5**0.5
True
>>> math.sqrt(25.25) == 25.25**0.5
True

If we test the precision of math.sqrt(), would not be better to test it with 
data for which naive way of calculating the root returns different result? For 
example 2921 is the smallest integers for which math.sqrt(x) > x**0.5, and 3541 
is the smallest integers for which math.sqrt(x) < x**0.5.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33962] IDLE: use ttk.spinbox with configdialog

2021-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25234
pull_request: https://github.com/python/cpython/pull/26648

___
Python tracker 

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



[issue33962] IDLE: use ttk.spinbox with configdialog

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 42d5a4fc3b35e45cdd237d56a04e98894d0a31f5 by Mark Roseman in 
branch 'main':
bpo-33962: Use ttk spinbox for IDLE indent space config (GH-22954)
https://github.com/python/cpython/commit/42d5a4fc3b35e45cdd237d56a04e98894d0a31f5


--

___
Python tracker 

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



[issue33962] IDLE: use ttk.spinbox with configdialog

2021-06-10 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +25233
pull_request: https://github.com/python/cpython/pull/26647

___
Python tracker 

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



[issue44362] improve documentation of SSL deprecations

2021-06-10 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch
nosy: +christian.heimes
nosy_count: 6.0 -> 7.0
pull_requests: +25232
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26646

___
Python tracker 

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



[issue44370] Inconsistent results for min() and max() with math.nan as argument

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The idea of math.ieee754_total_order looks interesting, but how would it work 
with min/max?

In 
https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/minNum_maxNum_Removal_Demotion_v3.pdf
 there is a comparison of several standards and implementations of symmetric 
and associative min/max. There are two options: propagate NaN and ignore it 
(treat it as missing data). It differs between different standards and 
implementations but in particular standard or implementation the same rule is 
used for min and max.

* If ieee754_total_order(NAN) < ieee754_total_order(1), then min(1, NAN) -> NAN 
("propagate") and max(1, NAN) -> 1 ("missing data").
* If ieee754_total_order(NAN) > ieee754_total_order(1), then min(1, NAN) -> 1 
("missing data") and max(1, NAN) -> NAN ("propagate").

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44376] Improve performance of integer exponentiation

2021-06-10 Thread Tim Peters


Tim Peters  added the comment:

Under the released 3.9.5 for 64-bit Win10, raising to the power 2 is clearly 
much slower than multiplying directly:

C:\Windows\System32>py -3 -m timeit -s "x=151" "x*x"
1000 loops, best of 5: 30 nsec per loop

C:\Windows\System32>py -3 -m timeit -s "x=151" "x**2"
100 loops, best of 5: 194 nsec per loop

Since the multiplication itself is cheap, overheads must account for it. 
Offhand, looks to me like the `x**2` spelling is actually doing 31 
multiplications under the covers, although most of them are as cheap as 
Python-int multiplies get.

for (i = Py_SIZE(b) - 1; i >= 0; --i) {
digit bi = b->ob_digit[i];

for (j = (digit)1 << (PyLong_SHIFT-1); j != 0; j >>= 1) {
MULT(z, z, z);
if (bi & j)
MULT(z, a, z);
}
}

Python ints on a 64-bit box are stored internally in base 2**30 (PyLong_SHIFT 
is 30). z starts life at 1. The first 28 trips through the loop are chewing up 
the 28 leading zero bits in exponent 2, so MULT(z, z, z) multiplies 1 by 1 to 
get 1, 28 times. Then again on the 29th iteration, but now "bi & j" is finally 
true (we finally found the leading one bit in exponent 2), so z is replaced by 
1 times the base = the base. On the final, 30th, iteration, MULT(z, z, z) 
replaces z with its square, and we're done.

It would probably be worthwhile to add code special-casing the leading Python 
"digit" of the exponent, fast-forwarding without any multiplies to the leading 
one bit, and setting z directly to the base then.

--
nosy: +tim.peters

___
Python tracker 

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



[issue44383] argparse.BooleanOptionalAction interacts poorly with ArgumentDefaultsHelpFormatter

2021-06-10 Thread Julian Gilbey


New submission from Julian Gilbey :

With code like the following:



import argparse

parser = argparse.ArgumentParser(
description="Test program",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
"--foo",
help="Use the foo component.",
action=argparse.BooleanOptionalAction,
default=True,
)

args = parser.parse_args()



a call "python prog.py --help" then gives:


usage: prog.py [-h] [--foo | --no-foo]

Test program

optional arguments:
  -h, --help   show this help message and exit
  --foo, --no-foo  Use the foo component. (default: True) (default: True)


Note the repeated "(default: True)", one produced by the BooleanOptionalAction 
class and the other by the ArgumentDefaultsHelpFormatter.  It would be good if 
they didn't both add this helpful information.

My suggestion would be that BooleanOptionalAction should not include this 
information; it is unique in doing so.

--
components: Library (Lib)
messages: 395559
nosy: juliangilbey
priority: normal
severity: normal
status: open
title: argparse.BooleanOptionalAction interacts poorly with 
ArgumentDefaultsHelpFormatter
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue44382] Python 3.9+ on Windows 8.0

2021-06-10 Thread Hypo Turtle


New submission from Hypo Turtle :

As per https://docs.python.org/3/using/windows.html:
"This means that Python 3.9 supports Windows 8.1 and newer."

Isn't reflected on python.org main page which has:
"Note that Python 3.9+ cannot be used on Windows 7 or earlier."

Leaving 8.0 unaddressed.

--
assignee: docs@python
components: Documentation
messages: 395558
nosy: docs@python, hypoturtle
priority: normal
severity: normal
status: open
title: Python 3.9+ on Windows 8.0
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue44381] Allow enabling control flow guard in Windows build

2021-06-10 Thread Steve Dower


Steve Dower  added the comment:

FWIW, I don't actually know what the performance impact is. I'm not set up for 
running the perf benchmarks, and I don't know if anyone else is (on Windows), 
but if someone would like to then it'll be easier once the environment option 
to enable it is in there.

--

___
Python tracker 

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



[issue44381] Allow enabling control flow guard in Windows build

2021-06-10 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue44381] Allow enabling control flow guard in Windows build

2021-06-10 Thread Steve Dower


New submission from Steve Dower :

Currently we don't enable CFG (which is runtime protection against code 
injection into tables), because it likely has a performance impact and the kind 
of attack is outside our scope.

However, we should make it easier to build CPython with CFG enabled, so that 
third-parties who do want to include it in their scope can do so.

--
assignee: steve.dower
components: Build, Windows
messages: 395556
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Allow enabling control flow guard in Windows build
type: security
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 

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



[issue44376] Improve performance of integer exponentiation

2021-06-10 Thread Mark Dickinson


Mark Dickinson  added the comment:

I can't reproduce this on my Mac laptop (using Python builds from MacPorts). 
Numbers for both x**2 and x*x are fairly stable across Python 3.2 to Python 
3.10. There's some variation, but nothing close to the same extent that Steven 
is seeing.

Here are my raw numbers:

lovelace:cpython mdickinson$ /opt/local/bin/python3.2 -m timeit -s "x=115" "x*x"
1000 loops, best of 3: 0.031 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.3 -m timeit -s "x=115" "x*x"
1000 loops, best of 3: 0.0297 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.4 -m timeit -s "x=115" "x*x"
1000 loops, best of 3: 0.0286 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.5 -m timeit -s "x=115" "x*x"
1000 loops, best of 3: 0.03 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.6 -m timeit -s "x=115" "x*x"
1000 loops, best of 3: 0.0312 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.7 -m timeit -s "x=115" "x*x"
1000 loops, best of 5: 28.7 nsec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.8 -m timeit -s "x=115" "x*x"
1000 loops, best of 5: 32 nsec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.9 -m timeit -s "x=115" "x*x"
1000 loops, best of 5: 33.5 nsec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.10 -m timeit -s "x=115" 
"x*x"
1000 loops, best of 5: 32.3 nsec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.2 -m timeit -s "x=115" 
"x**2"
100 loops, best of 3: 0.249 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.3 -m timeit -s "x=115" 
"x**2"
100 loops, best of 3: 0.224 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.4 -m timeit -s "x=115" 
"x**2"
100 loops, best of 3: 0.221 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.5 -m timeit -s "x=115" 
"x**2"
100 loops, best of 3: 0.213 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.6 -m timeit -s "x=115" 
"x**2"
100 loops, best of 3: 0.235 usec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.7 -m timeit -s "x=115" 
"x**2"
100 loops, best of 5: 204 nsec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.8 -m timeit -s "x=115" 
"x**2"
100 loops, best of 5: 217 nsec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.9 -m timeit -s "x=115" 
"x**2"
100 loops, best of 5: 245 nsec per loop
lovelace:cpython mdickinson$ /opt/local/bin/python3.10 -m timeit -s "x=115" 
"x**2"
100 loops, best of 5: 230 nsec per loop

--

___
Python tracker 

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



[issue44357] Add math.cbrt() function: Cube Root

2021-06-10 Thread Mark Dickinson


Mark Dickinson  added the comment:

All done; closing. Thank you for the contribution!

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



[issue44357] Add math.cbrt() function: Cube Root

2021-06-10 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset ac867f10b49322e25f34d2d8abd8e63c86834750 by Ajith Ramachandran in 
branch 'main':
bpo-44357:Add `math.cbrt()` function: Cube Root (GH-26622)
https://github.com/python/cpython/commit/ac867f10b49322e25f34d2d8abd8e63c86834750


--

___
Python tracker 

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



[issue44379] Pickling recursion error, did not import pickle

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is because you run the code in IDLE.

print(tempList) converts argument to string and write it to sys.stdout. In IDLE 
sys.stdout is a proxy object which uses RPC to communicate with the IDLE 
process which should insert the written text in the console text widget. Pickle 
is used for encoding command and arguments. Here you get a recursion error in 
pickle because when print(tempList) is executed the recursion depth almost 
reached the limit.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


Maxim Egorushkin  added the comment:

> glob.glob does not provide something equivalent to a DOTALL flag 

I see now, said a blind man.

--

___
Python tracker 

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



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Isaac Muse


Isaac Muse  added the comment:

Sadly, this because pathlib glob and glob.glob use different implementations. 
And glob.glob does not provide something equivalent to a DOTALL flag allowing a 
user to glob hidden files without explicitly defining the leading dot in the 
pattern.

--
nosy: +Isaac Muse

___
Python tracker 

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



[issue44364] Add non integral tests for `sqrt()`

2021-06-10 Thread Mark Dickinson


Change by Mark Dickinson :


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



[issue44364] Add non integral tests for `sqrt()`

2021-06-10 Thread Mark Dickinson


New submission from Mark Dickinson :


New changeset 90cd4330329a99e52f7141db5e0a469d30088e66 by Ajith Ramachandran in 
branch 'main':
bpo-44364:Add non integral tests for `sqrt()` (#26625)
https://github.com/python/cpython/commit/90cd4330329a99e52f7141db5e0a469d30088e66


--

___
Python tracker 

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



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


Maxim Egorushkin  added the comment:

I may be naive, but why then:

$ python3 -c 'from pathlib import Path; 
print(list(Path(".").glob("*.bash_profile")))'

Outputs:

[PosixPath('.bash_profile')]


?

--

___
Python tracker 

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



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +nailor, petri.lehtinen

___
Python tracker 

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



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Only pattern beginning with a dot can match filename beginning with a dot.

>From https://docs.python.org/3/library/glob.html

   Note that unlike fnmatch.fnmatch(), glob treats filenames beginning with a 
dot (.) as special cases.

This phrase was added in issue16695 in attempt to improve documentation, but it 
is still not clear.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, serhiy.storchaka
type: behavior -> enhancement
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

___
Python tracker 

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



[issue44376] Improve performance of integer exponentiation

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is it because exponentiation becomes slower or because multiplication becomes 
faster? What are absolute numbers?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


Change by Maxim Egorushkin :


--
type:  -> behavior

___
Python tracker 

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



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


New submission from Maxim Egorushkin :

Problem:

`glob.glob` documentation states that "pathname ... can contain shell-style 
wildcards." 

However, it stops short of saying that shell-style wildcards are handled the 
same way as in a POSIX-compliant/friendly shell.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_02
 POSIX requires that "`*` (asterisk) is a pattern that shall match any string, 
including the null string."

However, `glob.glob` pattern `*` (asterisk) doesn't match an empty/null string. 

Reproduction:

$ ls *.bash_profile
.bash_profile
$ python3 -c 'import glob; print(glob.glob("*.bash_profile"))'
[]
$ python3 -c 'import glob; print(glob.glob(".bash_profile"))'
['.bash_profile']

--
components: Library (Lib)
messages: 395545
nosy: max0x7ba
priority: normal
severity: normal
status: open
title: glob.glob handling of * (asterisk) wildcard is broken
versions: Python 3.8

___
Python tracker 

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



[issue43498] "dictionary changed size during iteration" error in _ExecutorManagerThread

2021-06-10 Thread Matt Whitlock


Matt Whitlock  added the comment:

Observed this same failure mode on a Raspberry Pi 1 while running 'make 
install' on Python 3.9.5 with 9 concurrent workers.

Exception in thread Thread-1:
Traceback (most recent call last):
  File 
"/var/tmp/portage/dev-lang/python-3.9.5_p2/image/usr/lib/python3.9/threading.py",
 line 954, in _bootstrap_inner
self.run()
  File 
"/var/tmp/portage/dev-lang/python-3.9.5_p2/image/usr/lib/python3.9/concurrent/futures/process.py",
 line 317, in run
result_item, is_broken, cause = self.wait_result_broken_or_wakeup()
  File 
"/var/tmp/portage/dev-lang/python-3.9.5_p2/image/usr/lib/python3.9/concurrent/futures/process.py",
 line 376, in wait_result_broken_or_wakeup
worker_sentinels = [p.sentinel for p in self.processes.values()]
  File 
"/var/tmp/portage/dev-lang/python-3.9.5_p2/image/usr/lib/python3.9/concurrent/futures/process.py",
 line 376, in 
worker_sentinels = [p.sentinel for p in self.processes.values()]
RuntimeError: dictionary changed size during iteration

--
nosy: +whitslack

___
Python tracker 

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



[issue44356] Abstract enum mixins not allowed

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:

Since I like puzzles, here is a working LenientStrEnum:

class LenientStrEnum(str, Enum):
#
def __init__(self, *args):
self._valid = True
#
@classmethod
def _missing_(cls, value):
logger.warning(
f"[{cls.__name__}] encountered an unknown value!\n"
f"Luckily I'm a LenientStrEnum, so I won't crash just yet.\n"
f"You might want to add a new case though.\n"
f"Value was: '{value}'"
)
unknown = cls._member_type_.__new__(cls, value)
unknown._valid = False
unknown._name_ = value.upper()
unknown._value_ = value
cls._member_map_[value] = unknown
return unknown
#
@property
def valid(self):
return self._valid

`_member_map_` is not guaranteed, but is unlikely to change.

--

___
Python tracker 

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



[issue44379] Pickling recursion error, did not import pickle

2021-06-10 Thread Violet Godfrey


New submission from Violet Godfrey :

I accidentally created an infinite recursion. The error referenced pickling but 
I did not import pickle. 

To reproduce: 
def permute(inputList):
'''permute(inputList) -> list
returns list of all permutations of inputList
CURRENTLY DOESN'T ACTUALLLY WORK PROPERLY'''
for i in range(len(inputList)-1):
tempList = inputList[:-i-2]
tempList.append(inputList[-1])
for num in inputList[-i-2:-1]:
tempList.append(num)
print(tempList)
permute(tempList)  # runs infinitely (whoops)
print()

permute([1,2,3,4])

Error thrown: 
Traceback (most recent call last):
  File "C:\Users\Violet\Documents\Python Files\test.py", line 14, in 
permute([1,2,3,4])
  File "C:\Users\Violet\Documents\Python Files\test.py", line 11, in permute
permute(tempList)  # runs infinitely (whoops)
  File "C:\Users\Violet\Documents\Python Files\test.py", line 11, in permute
permute(tempList)  # runs infinitely (whoops)
  File "C:\Users\Violet\Documents\Python Files\test.py", line 11, in permute
permute(tempList)  # runs infinitely (whoops)
  [Previous line repeated 1009 more times]
  File "C:\Users\Violet\Documents\Python Files\test.py", line 10, in permute
print(tempList)
RecursionError: maximum recursion depth exceeded while pickling an object

--
assignee: terry.reedy
components: IDLE
messages: 395542
nosy: Octopi, terry.reedy
priority: normal
severity: normal
status: open
title: Pickling recursion error, did not import pickle
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue44376] Improve performance of integer exponentiation

2021-06-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__

2021-06-10 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue44365] Bad dataclass post-init example

2021-06-10 Thread Micael Jarniac


Micael Jarniac  added the comment:

I'm trying to think of an example, and what I've thought of so far is having a 
base dataclass that has a `__post_init__` method, and another dataclass that 
inherits from it and also has a `__post_init__` method.

In that case, the subclass might need to call `super().__post_init__()` inside 
its own `__post_init__` method, because otherwise, that wouldn't get called 
automatically.

Something along those lines:

>>> from dataclasses import dataclass, field
>>>
>>> @dataclass
... class A:
... x: int
... y: int
... xy: int = field(init=False)
...
... def __post_init__(self) -> None:
... self.xy = self.x * self.y
...
>>> @dataclass
... class B(A):
... m: int
... n: int
... mn: int = field(init=False)
...
... def __post_init__(self) -> None:
... super().__post_init__()
... self.mn = self.m * self.n
...
>>> b = B(x=2, y=4, m=3, n=6)
>>> b
B(x=2, y=4, xy=8, m=3, n=6, mn=18)

In this example, if not for the `super().__post_init__()` call inside B's 
`__post_init__`, we'd get an error `AttributeError: 'B' object has no attribute 
'xy'`.

I believe this could be an actual pattern that could be used when dealing with 
dataclasses.

--

___
Python tracker 

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



[issue43318] pdb does not output the prompt message when successfully clear breakpoints by "filename:lineno"

2021-06-10 Thread Irit Katriel


Irit Katriel  added the comment:

Your fix looks correct - the problem is that the list of breakpoints gets 
emptied by the clear_break call, and you copy the list so that it can be echoed 
later if clear_break does not err.

I made some polishing comments on the PR, and it also need to be rebased 
because there is not a merge conflict on test_pdb.

--
title: pdb can't output the prompt message when successfully clear breakpoints 
by "filename:lineno" -> pdb does not output the prompt message when 
successfully clear breakpoints by "filename:lineno"
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



[issue44242] enum.IntFlag regression: missing values cause TypeError

2021-06-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 749648609de89f14581190ea34b9c0968787a701 by Ethan Furman in 
branch '3.10':
[3.10] bpo-44242: [Enum] remove missing bits test from Flag creation (GH-26586) 
(GH-26635)
https://github.com/python/cpython/commit/749648609de89f14581190ea34b9c0968787a701


--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-06-10 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

https://github.com/python/typing/issues/746 has some previous discussion of 
implementing NewType as a class (motivated by __repr__), including benchmarks.

--

___
Python tracker 

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



[issue44353] PEP 604 NewType

2021-06-10 Thread Ken Jin


Change by Ken Jin :


--
nosy: +Jelle Zijlstra, gvanrossum, kj, levkivskyi
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



[issue44365] Bad dataclass post-init example

2021-06-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

The example was added in https://github.com/python/cpython/pull/25967

When reviewing it, I think I missed the fact that the base class is a 
dataclass. The example and text make more sense if Rectangle isn't a dataclass. 
Still, I don't like the example at all. I think deleting it might be the best 
thing to do. Or maybe come up with a case where the base class is some existing 
class in the stdlib that isn't a dataclass.

--

___
Python tracker 

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



  1   2   >