[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2021-12-14 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
status: pending -> closed

___
Python tracker 

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



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

2021-12-14 Thread Felix Fontein


Change by Felix Fontein :


--
type:  -> crash

___
Python tracker 

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



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

2021-12-14 Thread Felix Fontein


Change by Felix Fontein :


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

___
Python tracker 

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



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

2021-12-14 Thread Felix Fontein


New submission from Felix Fontein :

When argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS and 
help is specified, trying to display --help results in a crash.

Reproducer:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--test', action=argparse.BooleanOptionalAction, 
default=argparse.SUPPRESS, help='Foo')
parser.parse_args()

Result when running 'python t.py --help':

Traceback (most recent call last):
  File "/path/to/t.py", line 4, in 
parser.parse_args()
  File "/usr/lib/python3.10/argparse.py", line 1821, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.10/argparse.py", line 1854, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.10/argparse.py", line 2063, in _parse_known_args
start_index = consume_optional(start_index)
  File "/usr/lib/python3.10/argparse.py", line 2003, in consume_optional
take_action(action, args, option_string)
  File "/usr/lib/python3.10/argparse.py", line 1931, in take_action
action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.10/argparse.py", line 1095, in __call__
parser.print_help()
  File "/usr/lib/python3.10/argparse.py", line 2551, in print_help
self._print_message(self.format_help(), file)
  File "/usr/lib/python3.10/argparse.py", line 2535, in format_help
return formatter.format_help()
  File "/usr/lib/python3.10/argparse.py", line 283, in format_help
help = self._root_section.format_help()
  File "/usr/lib/python3.10/argparse.py", line 214, in format_help
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 214, in 
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 214, in format_help
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 214, in 
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.10/argparse.py", line 530, in _format_action
help_text = self._expand_help(action)
  File "/usr/lib/python3.10/argparse.py", line 627, in _expand_help
return self._get_help_string(action) % params
KeyError: 'default'

The problem is that in 
https://github.com/python/cpython/blob/f54fee7f37563fbd569596cf94aad023ac6c3179/Lib/argparse.py#L879,
 default isn't tested for SUPPRESS as well. I've prepared a patch to fix that 
and will push it to GitHub soon.

(I've experienced the crash with Python 3.9 and 3.10; the test I've created 
also crashes for the current main branch, so I guess that means that Python 
3.11 is also affected. I haven't tested older Python versions before 3.9.)

--
components: Library (Lib)
messages: 408586
nosy: felixfontein
priority: normal
severity: normal
status: open
title: argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help 
specified crashes
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



[issue46079] Broken URL in tutorial

2021-12-14 Thread Vivek Vashist


New submission from Vivek Vashist :

URL: http://tycho.usno.navy.mil/cgi-bin/timer.pl is broken in the example 
https://docs.python.org/3/tutorial/stdlib.html#internet-access

> curl -v http://tycho.usno.navy.mil/cgi-bin/timer.pl
* Could not resolve host: tycho.usno.navy.mil
* Closing connection 0
curl: (6) Could not resolve host: tycho.usno.navy.mil

--
assignee: docs@python
components: Documentation
messages: 408585
nosy: docs@python, vivekvashist
priority: normal
severity: normal
status: open
title: Broken URL in tutorial
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



[issue37701] shutil.copyfile raises SpecialFileError for symlink to fifo

2021-12-14 Thread Christopher Hunt


Christopher Hunt  added the comment:

> I expect it to fail if follow_symlinks is True, which is the default value. I 
> expect it to succeed with follow_symlinks=False, which should create a 
> shallow copy of just the symlink, regardless of its target.

I agree, thanks for the correction.

--

___
Python tracker 

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



[issue46078] `ast.unparse` fails on `class C: i: int`… convert broken from `ast.AnnAssign` to `ast.Assign`

2021-12-14 Thread Samuel Marks


Samuel Marks  added the comment:

Just fixed the issue by using this value:
```py
"```(None)```" if sys.version_info[:2] >= (3, 9) else "```None```"
```

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



[issue45959] Teach pprint about dict views

2021-12-14 Thread Joshua Insel


Joshua Insel  added the comment:

According to the documentation for pprint, it is supposed to print objects on a 
single line if possible. See the second paragraph here: 
https://docs.python.org/3/library/pprint.html

--
nosy: +joshinsel

___
Python tracker 

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



[issue46078] `ast.unparse` fails on `class C: i: int`… convert broken from `ast.AnnAssign` to `ast.Assign`

2021-12-14 Thread theeshallnotknowethme


theeshallnotknowethme  added the comment:

This seems like just a problem of your library instead of a problem with 
Python. Are you sure this is the right place you're in?

--
nosy: +February291948

___
Python tracker 

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



[issue46078] `ast.unparse` fails on `class C: i: int`… convert broken from `ast.AnnAssign` to `ast.Assign`

2021-12-14 Thread Samuel Marks

New submission from Samuel Marks :

astor fails with:
```
  File "python3.8/site-packages/astor/code_gen.py", line 63, in to_source
generator.visit(node)
  File "python3.8/site-packages/astor/node_util.py", line 143, in visit
return visitor(node)
  File "python3.8/site-packages/astor/code_gen.py", line 878, in visit_Module
self.write(*node.body)
  File "python3.8/site-packages/astor/code_gen.py", line 178, in write
visit(item)
  File "python3.8/site-packages/astor/node_util.py", line 143, in visit
return visitor(node)
  File "python3.8/site-packages/astor/code_gen.py", line 364, in visit_ClassDef
self.body(node.body)
  File "python3.8/site-packages/astor/code_gen.py", line 226, in body
self.write(*statements)
  File "python3.8/site-packages/astor/code_gen.py", line 178, in write
visit(item)
  File "python3.8/site-packages/astor/node_util.py", line 143, in visit
return visitor(node)
  File "python3.8/site-packages/astor/code_gen.py", line 293, in visit_Assign
self.visit(node.value)
  File "python3.8/site-packages/astor/node_util.py", line 143, in visit
return visitor(node)
  File "python3.8/site-packages/astor/node_util.py", line 137, in abort_visit
raise AttributeError(msg % node.__class__.__name__)
AttributeError: No defined handler for node of type NoneType
```

Whereas the now builtin to Python (3.9+) `ast.unparse` gives:
```
File "3.10/lib/python3.10/ast.py", line 1673, in unparse
return unparser.visit(ast_obj)
  File "3.10/lib/python3.10/ast.py", line 807, in visit
self.traverse(node)
  File "3.10/lib/python3.10/ast.py", line 798, in traverse
super().visit(node)
  File "3.10/lib/python3.10/ast.py", line 410, in visit
return visitor(node)
  File "3.10/lib/python3.10/ast.py", line 822, in visit_Module
self._write_docstring_and_traverse_body(node)
  File "3.10/lib/python3.10/ast.py", line 815, in 
_write_docstring_and_traverse_body
self.traverse(node.body)
  File "3.10/lib/python3.10/ast.py", line 796, in traverse
self.traverse(item)
  File "3.10/lib/python3.10/ast.py", line 798, in traverse
super().visit(node)
  File "3.10/lib/python3.10/ast.py", line 410, in visit
return visitor(node)
  File "3.10/lib/python3.10/ast.py", line 1001, in visit_ClassDef
self._write_docstring_and_traverse_body(node)
  File "3.10/lib/python3.10/ast.py", line 815, in 
_write_docstring_and_traverse_body
self.traverse(node.body)
  File "3.10/lib/python3.10/ast.py", line 796, in traverse
self.traverse(item)
  File "3.10/lib/python3.10/ast.py", line 798, in traverse
super().visit(node)
  File "3.10/lib/python3.10/ast.py", line 410, in visit
return visitor(node)
  File "3.10/lib/python3.10/ast.py", line 863, in visit_Assign
self.traverse(node.value)
  File "3.10/lib/python3.10/ast.py", line 798, in traverse
super().visit(node)
  File "3.10/lib/python3.10/ast.py", line 410, in visit
return visitor(node)
  File "3.10/lib/python3.10/ast.py", line 414, in generic_visit
for field, value in iter_fields(node):
  File "3.10/lib/python3.10/ast.py", line 252, in iter_fields
for field in node._fields:
AttributeError: 'NoneType' object has no attribute '_fields'
```

Found it when I tried to unparse previously parsed:
```py
class C:
i: int
```

Found in reality when trying to parse then emit:
- 
https://github.com/tensorflow/tensorflow/blob/ba146843/tensorflow/compiler/xla/python/xla_client.py#L402-L413


Which is creating this:
```
ast.Assign(targets=[ast.Name(id="interior_padding")],
   type_comment="int",
   value=None)
```

(one thing my library does is convert betwixt `ast.Assign` and `ast.AnnAssign`… 
later I'll be doing more interesting variable type tracing to generate big 
`typing.Union` of all possible types each variable may have… but if it finds 
`None` then it will infer `typing.Optional`.)

Here is my `ast.NodeTransformer` override for `visit_AnnAssign`: 
https://github.com/offscale/cdd-python/blob/968507e/cdd/doctrans_utils.py#L111-L131

Is there some way of rewriting an `ast.AnnAssign` to `ast.Assign` without 
losing type information?

--
messages: 408580
nosy: samuelmarks
priority: normal
severity: normal
status: open
title: `ast.unparse` fails on `class C: i: int`… convert broken from 
`ast.AnnAssign` to `ast.Assign`
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



[issue46077] Include sha256 hashes of release downloads in announcement communications

2021-12-14 Thread Gregory P. Smith


New submission from Gregory P. Smith :

The announcement email list 
(https://mail.python.org/archives/list/python-announce-l...@python.org/) and 
other places we make announcements beyond just the release pages like 
https://www.python.org/downloads/release/python-3101/ should include a list of 
sha256 hashes of the release binaries in the announcement text.

This serves as an alternative confirmation that nothing has changed as such 
announcements are widely distributed and archived by independent parties and 
individuals and can thus convey a level of trust that a hash listed on the 
downloads page cannot (where an attacker would simply modify both).

Yes there is a gpg signature on the downloads. I encourage people to use that.  
But this provides an alternate distributed mechanism to verify that nothing has 
changed at all since the release announcement.  Something a gpg signature 
cannot fully do (consider this protection against the possibility of new signed 
binary being put into its place by a compromised key/signer/builder/RM before 
anyone happens to notice and poke around).

A simple table of:

filename.tar.gz | sha256 hash
filename.msi | sha256 hash
filename.dmg | sha256 hash
...

At the end of the announcement email/post would suffice.

Less of an issue on source packages as those can be verified against the git 
repo. But it's nice for people to know if binaries change without an 
announcement and explanation and is easy for us to provide.

Bonus points if the release announcement email body itself is signed (if that 
is even feasible per our release signing GPG key management).

[context: see recent python-dev subject: Python release announcement format]

--
messages: 408579
nosy: gregory.p.smith
priority: deferred blocker
severity: normal
status: open
title: Include sha256 hashes of release downloads in announcement communications
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



[issue46056] Cannot use virtual environment on Windows 10 in corporate security settings

2021-12-14 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

While the discussion is interesting for some who are trying to work around 
security policy mechanisms, we can't control what policies people enforce upon 
themselves that make their machines useless for software development.  Marking 
as not a bug.

The normal thing to do is to obtain an exemption to policies from the corporate 
security org managing your machine(s) because you have a business need for it.

If you have specific implementation changes that would make life easier, file 
specific issues for those to be addressed.  (ex: PEP 582 is pretty specific - 
and there is a package manager https://pdm.fming.dev/ that supports it)

--
nosy: +gregory.p.smith
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



[issue46059] Typo in match Statement example

2021-12-14 Thread Vivek Vashist


Vivek Vashist  added the comment:

Thanks for sorting this out Alex :)

--

___
Python tracker 

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



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

2021-12-14 Thread Craig Holmquist


Change by Craig Holmquist :


--
nosy: +craigh

___
Python tracker 

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



[issue40059] Provide a toml module in the standard library

2021-12-14 Thread Brett Cannon


Brett Cannon  added the comment:

I opened https://github.com/python/steering-council/issues/92 for the SC to 
discuss stdlib additions in case I am not re-elected.

--

___
Python tracker 

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



[issue31370] Remove support for threads-less builds

2021-12-14 Thread Brett Cannon


Brett Cannon  added the comment:

I am not opening a new discussion; this is just recording this fact here as it 
has come up in other places on the internet.

--

___
Python tracker 

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



[issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

2021-12-14 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

>From the first glance, this seems like a duplicate of bpo-44896.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue44896] AttributeError in ast.unparse

2021-12-14 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
status: open -> closed

___
Python tracker 

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



[issue46076] Document using __slots__ to provide per-attribute docstrings

2021-12-14 Thread Alex Waygood


Change by Alex Waygood :


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

___
Python tracker 

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



[issue46076] Document using __slots__ to provide per-attribute docstrings

2021-12-14 Thread Alex Waygood


New submission from Alex Waygood :

The ability to add docstrings for individual attributes, by using a dictionary 
for __slots__ was added in Issue36326. This is a fantastic feature, and 
deserves better documentation. It appears to currently only be documented in 
the "What's New" entry for Python 3.8: 
https://docs.python.org/3/whatsnew/3.8.html#inspect.

Moreover, the data model documentation currently states the following regarding 
using a mapping to specify __slots__:

"""
Any non-string iterable may be assigned to __slots__. Mappings may also be 
used; however, in the future, special meaning may be assigned to the values 
corresponding to each key.
"""

This is arguably now incorrect. A special meaning has been assigned to the 
values corresponding to each key: the values can be used for per-attribute 
docstrings.

--
assignee: docs@python
components: Documentation
messages: 408573
nosy: AlexWaygood, docs@python, rhettinger
priority: normal
severity: normal
status: open
title: Document using __slots__ to provide per-attribute docstrings
type: enhancement
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



[issue46074] deepfreeze should rehash all strings upon reset

2021-12-14 Thread Guido van Rossum


Guido van Rossum  added the comment:

Never mind, this was based on incorrect information. See subsequent messages in 
the linked thread.

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2021-12-14 Thread Alex Waygood


Alex Waygood  added the comment:

The proposed patch appears to have been implemented in 
https://github.com/python/cpython/commit/97c1adf3935234da716d3289b85f72dcd67e90c2,
 and there has been no discussion for five years. I think this can now be 
closed.

--
nosy: +AlexWaygood
resolution:  -> fixed
stage: patch review -> resolved
status: open -> pending

___
Python tracker 

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



[issue29699] shutil.rmtree should not fail with FileNotFoundError (race condition)

2021-12-14 Thread coroa


coroa  added the comment:

Just realised that the "race condition" is triggered consistently on Mac OSX 
machines working on non-Mac filesystems, where they store extended attributes 
like last access time in meta files with a `._` prefix. These files are listed 
by `os.scandir` after their original files and are removed, as soon as the 
original file is unlinked.

Ie. a test.txt, ._test.txt pair will always raise FileNotFoundError for 
._test.txt since the file system driver itself already removed it when the 
unlink on test.txt was executed.

Refer also to https://stackoverflow.com/a/70355470/2873952.

Current status seems to be:
1. https://bugs.python.org/issue29699 and https://bugs.python.org/issue37260 
are duplicates.
2. https://github.com/python/cpython/pull/13580 linked from here has been 
closed due to lack of unit tests (but with the possibility to re-open after 
providing those)
3. https://github.com/python/cpython/pull/14064 is still open and seems to be 
mostly the same patch, does have unit tests and awaiting a second review.

What is the next step?

--
nosy: +coroa
versions:  -Python 3.5

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-14 Thread Steve Dower


Steve Dower  added the comment:

Does the first venv's 'python' link to python3[.11]? If so, maybe 
_base_executable should be based on real_executable's filename rather than 
executable (that is, *after* resolving symlinks rather than before).

I don't *think* that will cause any issues, and it shouldn't be any more 
expensive to compute. Only has to change for when a pyvenv.cfg is detected I 
think.

--

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

That was a fix for GH-17350, which might need to be reverted as well.

Victor, could you take another look at GH-17350? I must admit I (still) don't 
understand this change; what would break if it was reverted (along with the 
fixup from bpo-44050)?

--

___
Python tracker 

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



[issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

2021-12-14 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Or, maybe this is a correct thing to do. Consider this case. Let's say we now 
check that `node` has `lineno` and exclude ones that don't.

Then, we write this test (in `Lib/test/test_unparse`):

```
def test_unparse_nodes_without_lineno(self):
# https://bugs.python.org/issue46073
def create_module(ignores):
return ast.Module(
body=[
ast.FunctionDef(
name="items_needed",
args=ast.arguments(
posonlyargs=[], args=[],
kwonlyargs=[], kw_defaults=[], defaults=[],
),
body=[ast.Pass()], decorator_list=[],
),
],
type_ignores=ignores,
)

ast1 = create_module([])
self.assertASTEqual(ast1, ast.parse(ast.unparse(ast1)))

ast2 = create_module([ast.TypeIgnore(lineno=1, tag='')])
# This fill fail without `ast2 = ast.fix_missing_locations(ast2)`
self.assertASTEqual(ast2, ast.parse(ast.unparse(ast2), 
type_comments=True))
```

In this case the second `assert` will fail, because the resulting codes would 
be different:

```
# "original"
def items_needed():  # type: ignore
pass

# unparsed
def items_needed():
pass
```

So, basically users will get different code. Which is not a good thing.

So, maybe raising an error that some `node` does not have `lineno` is good 
after all?

--

___
Python tracker 

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



[issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

2021-12-14 Thread Brian Carlson


Brian Carlson  added the comment:

I don't think passing `lineno` and `column` is preferred. It makes code 
generation harder because `lineno` and `column` are hard to know ahead of when 
code is being unparsed.

--

___
Python tracker 

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



[issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

2021-12-14 Thread Brian Carlson


Brian Carlson  added the comment:

The second solution seems more optimal, in my opinion. I monkey patched the 
function like this in my own code:
```
def get_type_comment(self, node):
comment = self._type_ignores.get(node.lineno) if hasattr(node, "lineno") 
else node.type_comment
if comment is not None:
return f" # type: {comment}"
```

Thanks!

--

___
Python tracker 

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



[issue46075] CookieJar.extract_cookies doesn't process cookies form local domains when domain is explicitly set in header

2021-12-14 Thread Nick


Change by Nick :


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

___
Python tracker 

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



[issue46075] CookieJar.extract_cookies doesn't process cookies form local domains when domain is explicitly set in header

2021-12-14 Thread Nick


New submission from Nick :

Apparently, CookieJar.extract_cookies doesn't process cookies form local 
domains which explicitly set domain in Set-Cookie header. That means that 
headers with domain specified, like "Set-Cookie: foo=baz; Domain=localhost;", 
are ignored. As far as I can tell, this might be actually part of the standard: 
https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain/32210291#32210291
 . However, it looks like other HTTP clients, including modern versions of both 
Chrome and Firefox do accept cookies from localhost with explicit 
domain=localhost, and this change doesn't appear to break existing software in 
any way. (simple POC to test behavior in browsers: 
https://gist.github.com/keddad/e2ce034f68b77e59077cdb1e887fa4a1). Maybe it 
would be best to also allow this behavior in Python?

--
components: Library (Lib)
messages: 408564
nosy: keddad
priority: normal
severity: normal
status: open
title: CookieJar.extract_cookies doesn't process cookies form local domains 
when domain is explicitly set in header
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

2021-12-14 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Moreover, there's always an option to pass `lineno` and `column` explicitly:

```
from ast import *

# if we build the module manually and try it directly
value = Module(
body=[
FunctionDef(
name="items_needed",
args=arguments(
posonlyargs=[],
args=[],
kwonlyargs=[],
kw_defaults=[],
defaults=[],
),
body=[Return(value=Constant(value="test"))],
decorator_list=[],
lineno=1,
column=1,
)
],
type_ignores=[],
)

unparse(value)  # ok
```

--

___
Python tracker 

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



[issue45339] concurrent.future.ThreadPoolExecutor should parameterize class used for threads

2021-12-14 Thread Sergei Maertens


Sergei Maertens  added the comment:

I was looking for some way to be able to add a thread finalizer, a piece of 
code to be called when the thread pool shuts down and all threads need cleaning 
up. Glad I came across this issue, since the example of using a Thread subclass 
with a custom run (wrapped in a context manager) would fill my needs completely.

> What are examples of your some_important_context()? Is it important to call 
> some code before destroying the thread?

I currently have a use case with a web-framework that has persistent DB 
connections - i.e. they span multiple HTTP requests. This also applies in the 
context of running a command-line script with said framework where database 
connections are opened.

We are calling external APIs (IO heavy), so using a ThreadPoolExecutor makes 
sense. However, since those "DB connection pools" are thread locals, we need to 
ensure that database connections are closed again to not leak resources.

The current workaround is to submit a job/function to the pool and have it 
close the database connections, which adds overhead since database connections 
are now opened and closed within the same thread that could have been re-used.

Using a context manager, we would be able to wrap the `super().run(...)` and 
close the database connections when the thread exits (succesfully or because of 
an Exception, even). This comes very close to having an `atexit` for individual 
threads.

Furthermore I like the idea of being able to provide the class as a context 
manager kwarg, but would also not be opposed to a class property specifying the 
Thread class to use - both would greatly enhance composability and are a 
cleaner solution than adding a finalizer option (similar to the `initializer` 
kwarg)

--
nosy: +Sergei Maertens

___
Python tracker 

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



[issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

2021-12-14 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Looks like this little patch can solve this problem:

```
   def unparse(ast_obj):
   unparser = _Unparser()
---return unparser.visit(ast_obj)
+++return unparser.visit(fix_missing_locations(ast_obj))
```

But, I am not sure we should call this helper here.

Another approach is to refactor `get_type_comment` function into something like 
this:

```
def get_type_comment(self, node):
comment = None
if hasattr(node, 'lineno'):
comment = self._type_ignores.get(node.lineno)
comment = comment or node.type_comment
if comment is not None:
return f" # type: {comment}"
```

I feel like this is more suitable for this case. Even `ast.pyi` has this line:

```
# TODO: Not all nodes have all of the following attributes
lineno: int
col_offset: int
```

So, I am going to propose a PR with the second option. Please, send your 
feedback!

--
nosy: +sobolevn

___
Python tracker 

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



[issue45292] Implement PEP 654: Exception Groups

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:

The PR adds two new opcodes. Let's start with the simpler of the two - 
JUMP_IF_NOT_EG_MATCH.   This is the exception-group variation on 
JUMP_IF_NOT_EXC_MATCH.

JUMP_IF_NOT_EXC_MATCH checks for a match by checking if the exception is of the 
given type. The result is boolean.

JUMP_IF_NOT_EG_MATCH checks for a matching by calling .split() on the exception 
group. The result is two exception groups (the matching part and the 
non-matching part).

Can we do this without a new opcode?

--

___
Python tracker 

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



[issue45292] Implement PEP 654: Exception Groups

2021-12-14 Thread Mark Shannon


Mark Shannon  added the comment:

PR 29581 resulted in a 1% slowdown, which is not terrible, but code not using 
except* should not be slowed down at all.

IMO, the way to avoid the slowdown is to implement except* using the existing 
instruction set (perhaps with a few minor additions)

We already implement try-finally, named except blocks and with statements 
without any complex bytecodes (except perhaps WITH_EXCEPT_START).

These used to involve a lot of state and more complex bytecodes. So it is 
possible to make these simplifications,
but it does take work.


There are a number of techniques we can use:

If any state is needed, push it to the stack as we do with `ctx.__exit__` in 
the with statement, and when pushing f_lasti in exception handlers.
Duplicate code paths when the semantics differ in different cases, as we do for 
finally blocks.
If anything is too complex to handle on the stack, put it in a temporary 
variable.
Be liberal in your use of virtual try-excepts (SETUP_FINALLY, POP_FINALLY 
pairs), as zero-cost exception handling should keep the cost down.


It may be too late for this advice, but if I were writing the `except*` 
implementation from scratch, I would:

1. Sketch out the pseudo Python that a try-except* would map to. This is a good 
opportunity to discover any design bugs that might result in undesirable 
behavior for corner cases.

2. Implement the translation in the compiler, not worrying about any redundancy 
or inefficiency, just correctness.

3. Look to improve the above, either in the compiler front-end, or by replacing 
inefficient code patterns in the back-end. Handling the optimization in the 
backend has the advantage that other code might benefit as well.

--

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-14 Thread graysky


graysky  added the comment:

While this is being evaluated, can someone give an opinion about the sanity of 
simply reverting https://hg.python.org/lookup/d0d29655ff for now in order to 
use 3.10.1?  Thanks.

--

___
Python tracker 

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



[issue45292] Implement PEP 654: Exception Groups

2021-12-14 Thread Guido van Rossum


Guido van Rossum  added the comment:

We should have a discussion here about improvements that Mark Shannon would 
like to see, in particular to do more work in the compiler instead of the 
interpreter.

--
nosy: +Mark.Shannon, gvanrossum

___
Python tracker 

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



[issue44525] Implement CALL_FUNCTION adaptive interpreter optimizations

2021-12-14 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +28329
pull_request: https://github.com/python/cpython/pull/30107

___
Python tracker 

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



[issue18467] argparse - problematic 'default' behavior

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:

Thanks, I think we can close this then.

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



[issue18467] argparse - problematic 'default' behavior

2021-12-14 Thread Matěj Týč

Matěj Týč  added the comment:

Thanks for reaching out. I have no idea whether it helped me or not, sorry for 
not replying back in a timely manner :-(

I think that the feature request/bugreport originates from bad coding 
practices, when I wanted argparse to perform something more than just plain 
parsing of arguments into a data structure.

Nowadays I would tell myself to solve it by introducing a layer between 
argparse and the rest of the code without putting additional pressure on 
argparse.

--
status: pending -> open

___
Python tracker 

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



[issue44525] Implement CALL_FUNCTION adaptive interpreter optimizations

2021-12-14 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 9f8f45144b6f0ad481e80570538cce89b414f7f9 by Mark Shannon in 
branch 'main':
bpo-44525: Split calls into PRECALL and CALL (GH-30011)
https://github.com/python/cpython/commit/9f8f45144b6f0ad481e80570538cce89b414f7f9


--

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 17260e44b5ed3508e3c15f1b7ded761879e91d3e by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-46063: Add 'delay=True' to file handler initialization. (GH-30103) 
(GH-30105)
https://github.com/python/cpython/commit/17260e44b5ed3508e3c15f1b7ded761879e91d3e


--

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 908fd691f96403a3c30d85c17dd74ed1f26a60fd by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-46063: Add 'delay=True' to file handler initialization. (GH-30103) 
(GH-30104)
https://github.com/python/cpython/commit/908fd691f96403a3c30d85c17dd74ed1f26a60fd


--

___
Python tracker 

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



[issue23522] Misleading note in Statistics module documentation

2021-12-14 Thread Guido van Rossum


Guido van Rossum  added the comment:

Couldn't we just change the first occurrence of "central location" in the note 
to "a central location" and the second to "(different) central locations"? That 
would leave Steven's intention intact but satisfy those who read it as 
referring to *a single* central location.

--
nosy: +gvanrossum
resolution: rejected -> 
status: closed -> open

___
Python tracker 

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



[issue46074] deepfreeze should rehash all strings upon reset

2021-12-14 Thread Guido van Rossum


New submission from Guido van Rossum :

In https://github.com/python/cpython/pull/30096#discussion_r768802144 it is 
pointed out that the hash seed can be changed if the interpreter is reset.

To guard against this we need to force (re)calculation of all hash seeds in the 
generated code when the corresponding code object is retrieved. This can be 
done by adding extra code to the `_Py_get__toplevel()` functions. 
(Strings that are shared between code objects will have to be rehashed 
repeatedly -- no big deal.)

--
components: Build
messages: 408550
nosy: gvanrossum
priority: normal
severity: normal
stage: test needed
status: open
title: deepfreeze should rehash all strings upon reset
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



[issue45292] Implement PEP 654: Exception Groups

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset d60457a6673cf0263213c2f2be02c633ec2e2038 by Irit Katriel in 
branch 'main':
bpo-45292: [PEP-654] add except* (GH-29581)
https://github.com/python/cpython/commit/d60457a6673cf0263213c2f2be02c633ec2e2038


--

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 850aefc2c651110a784cd5478af9774b1f6287a3 by Vinay Sajip in branch 
'main':
bpo-46063: Add 'delay=True' to file handler initialization. (GH-30103)
https://github.com/python/cpython/commit/850aefc2c651110a784cd5478af9774b1f6287a3


--

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28328
pull_request: https://github.com/python/cpython/pull/30105

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28327
pull_request: https://github.com/python/cpython/pull/30104

___
Python tracker 

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



[issue46066] TypedDict alternative definition syntax with keyword args is confusing

2021-12-14 Thread Guido van Rossum


Guido van Rossum  added the comment:

I recommend opening an issue here: 
https://github.com/python/typing/issues/new/choose

--

___
Python tracker 

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



[issue46073] ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for valid module

2021-12-14 Thread Brian Carlson


New submission from Brian Carlson :

Test file linked. When unparsing the output from ast.parse on a simple class, 
unparse throws an error: 'FunctionDef' object has no attribute 'lineno' for a 
valid class and valid AST. It fails when programmatically building the module 
AST as well.

It seems to be from this function: 
https://github.com/python/cpython/blob/1cbb88736c32ac30fd530371adf53fe7554be0a5/Lib/ast.py#L790

--
components: Library (Lib)
files: test.py
messages: 408546
nosy: TheRobotCarlson
priority: normal
severity: normal
status: open
title: ast.unparse produces: 'FunctionDef' object has no attribute 'lineno' for 
valid module
type: crash
versions: Python 3.10, Python 3.11, Python 3.9
Added file: https://bugs.python.org/file50490/test.py

___
Python tracker 

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



[issue39464] Allow translating argparse error messages

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:

Closed issue26726 as duplicate of this.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue26726] Incomplete Internationalization in Argparse Module

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as duplicate of issue39464, which has a GitHub PR.

--
nosy: +iritkatriel
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Allow translating argparse error messages

___
Python tracker 

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



[issue46072] Unify handling of stats in the CPython VM

2021-12-14 Thread Mark Shannon


New submission from Mark Shannon :

By "stats" I mean the internal numbers gathered by the VM for performance and 
debugging. This has nothing to do with any statistics module.

Currently various parts of the VM gather stats: the GC, dicts, the bytecode 
interpreter, type lookup cache, etc.

These stats have various compile time flags to turn them on and off. They have 
differing ways to display the stats, and no unified way to gather stats across 
different runs.

For the specialization stats we dump stats, which we can parse to collate stats 
across runs.

We should:
1. Add a --with-pystats config flag (like with-pydebug) to turn on stat 
gathering at build time.
2. Convert the other stats to the format used by the specialization stats, so 
all stats can be parsed and collated.

--
messages: 408543
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Unify handling of stats in the CPython VM

___
Python tracker 

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



[issue9350] add remove_argument_group to argparse

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:

This is over a decade old and the discussion is mostly that it's not worth 
doing, so I suggest we close.

--
nosy: +iritkatriel
resolution:  -> rejected
status: open -> pending

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread Vinay Sajip


Change by Vinay Sajip :


--
pull_requests: +28326
pull_request: https://github.com/python/cpython/pull/30103

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-14 Thread graysky


graysky  added the comment:

@Eric - I have not seen this on 3.8 or 3.9.  No data before 3.8.

--

___
Python tracker 

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



[issue46071] Graphlib documentation

2021-12-14 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith, rhettinger, tim.peters

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

Interned strings were broken in GH-20058, see bpo-46006. Maybe that's also the 
issue here?

--
nosy: +vstinner

___
Python tracker 

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



[issue26726] Incomplete Internationalization in Argparse Module

2021-12-14 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-14 Thread Eric Snow


Eric Snow  added the comment:

(related: bpo-44059)

Presumably the problem relates to global state used in different interpreters 
leading to an inconsistent state in the crashing extension (or its 
dependencies).

@graysky, do you know if this was a problem before Python 3.8?

--
components: +Subinterpreters
nosy: +eric.snow, petr.viktorin, shihai1991
stage:  -> test needed
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



[issue46069] Spam

2021-12-14 Thread Zachary Ware


Change by Zachary Ware :


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

___
Python tracker 

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



[issue46059] Typo in match Statement example

2021-12-14 Thread Alex Waygood


Alex Waygood  added the comment:

Thanks for the bug report, Vivek! It should be fixed now -- it might take a day 
or two for the online docs to update.

--

___
Python tracker 

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



[issue46069] Spam

2021-12-14 Thread Zachary Ware


Change by Zachary Ware :


--
components:  -Build
nosy:  -havenhaven
title: Super Smash Flash 2 -> Spam
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



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

2021-12-14 Thread Ken Jin


Ken Jin  added the comment:

Hi,

Thank you for your interest in Python, and especially the GIL. David Beazley 
opened an issue for his PyCon 2010 GIL talk at 
https://bugs.python.org/issue7946. You can discuss more on that issue (I 
suggest first reading through it, there's a really long history behind the GIL).

I'm closing this issue as a duplicate, as discussion should be redirected to 
the abovementioned issue7946 instead.

--
nosy: +kj
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46059] Typo in match Statement example

2021-12-14 Thread Ken Jin


Change by Ken Jin :


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



[issue46059] Typo in match Statement example

2021-12-14 Thread miss-islington


miss-islington  added the comment:


New changeset 503803d8c19be91becc09ca59f3febcbc324d6d2 by Miss Islington (bot) 
in branch '3.10':
bpo-46059: Clarify pattern-matching example in "control flow" docs (GH-30079)
https://github.com/python/cpython/commit/503803d8c19be91becc09ca59f3febcbc324d6d2


--

___
Python tracker 

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



[issue46071] Graphlib documentation

2021-12-14 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +28324
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30102

___
Python tracker 

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



[issue46071] Graphlib documentation

2021-12-14 Thread David Mc Dougall


New submission from David Mc Dougall :

The documentation for graphlib encourages users to represent their graphs in a 
awkward format.

Graphs are currently represented using dictionaries of nodes, for example:
graph["end_node"] = ["start_node"]

And this is unintuitive because you can't use the graph traverse edges in their 
forward direction.
If you look up a node in the graph, you get all of the nodes that point to the 
key,
as opposed to all of the nodes that the key points to.

The solution is to rewrite the documentation such that all of the edge 
directions are reversed.
The final topologically sorted list will be in the "opposite" direction as a 
consequence.

This will cause no functional changes.

--
assignee: docs@python
components: Documentation
messages: 408535
nosy: dam1784, docs@python
priority: normal
severity: normal
status: open
title: Graphlib documentation
type: enhancement
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



[issue46059] Typo in match Statement example

2021-12-14 Thread Ken Jin


Ken Jin  added the comment:


New changeset 1cbb88736c32ac30fd530371adf53fe7554be0a5 by Alex Waygood in 
branch 'main':
bpo-46059: Clarify pattern-matching example in "control flow" docs (GH-30079)
https://github.com/python/cpython/commit/1cbb88736c32ac30fd530371adf53fe7554be0a5


--
nosy: +kj

___
Python tracker 

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



[issue46059] Typo in match Statement example

2021-12-14 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46056] Cannot use virtual environment on Windows 10 in corporate security settings

2021-12-14 Thread wolfgang kuehn


wolfgang kuehn  added the comment:

I can confirm that setting __PYVENV_LAUNCHER__ to ANY path with prefix  
./venv/Scripts/ does indeed mark the python session as being a virtual 
environment, no special permissions needed.

However, you will have no tooling support whatsoever (e.g. PyCharms Package 
Mngt) because __PYVENV_LAUNCHER__ is, after all, non-standard.

--

___
Python tracker 

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



[issue45383] PyType_FromSpec API fails to use metaclass of bases

2021-12-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

I haven't forgotten this issue, but when I get to it it always leads to a 
rabbit hole. Sometimes just chasing refleaks, but there are deeper issues as 
well.

AFAICS, there's no way to call metatype.tp_new for such a class. I guess the 
safest option is to fail when the metaclass has a custom tp_new -- because that 
means the metaclass is requesting that it wants to allocate/initialize its 
types itself.

We can call metatype.tp_init, and probably should. And __init_subclass__ too, I 
suppose.

But at that point, this is duplicating a lot of existing functionality, and I'm 
starting to wonder if this wouldn't all be better with calling the metaclass 
instead.
What's missing?
- basicsize/itemsize could be allowed with __basicsize__/__itemsize__ in the 
dict.
- flags: we could add mechanisms to set individual flags after the type is 
created, as needed.
- slots can usually be applied after the class is created; maybe there should 
be a public function for this.
- members could theoretically be copied to individual descriptors; there 
doesn't seem much need for keeping tp_members around.

Does that seem like a more reasonable direction to explore?

--

___
Python tracker 

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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2021-12-14 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 74821b30539bba3cf0ac4148923ec0e9b826508e by Christian Heimes in 
branch 'main':
bpo-46023: Skip build if module is marked as DISABLED (GH-30100)
https://github.com/python/cpython/commit/74821b30539bba3cf0ac4148923ec0e9b826508e


--

___
Python tracker 

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



[issue18467] argparse - problematic 'default' behavior

2021-12-14 Thread Irit Katriel

Irit Katriel  added the comment:

Matěj, did Paul's suggestion solve your use case?

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2021-12-14 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +28322
pull_request: https://github.com/python/cpython/pull/30100

___
Python tracker 

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



[issue45995] string formatting: normalize negative zero

2021-12-14 Thread John Belmonte


John Belmonte  added the comment:

implemented float and Decimal-- PR is ready for review

--

___
Python tracker 

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



[issue26952] argparse help formatter raises IndexError

2021-12-14 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 6.0 -> 7.0
pull_requests: +28321
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30099

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-14 Thread Ned Batchelder


Ned Batchelder  added the comment:

> I assume /private/tmp/bpo-46028/311-nested/bin/python3.11 exists though? 

Yes, that file exists, but it's a symlink to a non-existent file:

$ ls -al 311-nested/bin
total 0
drwxr-xr-x  5 nedbatchelder  wheel  160 Dec 13 18:04 ./
drwxr-xr-x  6 nedbatchelder  wheel  192 Dec 13 18:04 ../
lrwxr-xr-x  1 nedbatchelder  wheel   21 Dec 13 18:04 python@ -> 
/usr/local/bin/python
lrwxr-xr-x  1 nedbatchelder  wheel6 Dec 13 18:04 python3@ -> python
lrwxr-xr-x  1 nedbatchelder  wheel6 Dec 13 18:04 python3.11@ -> python
$ ls -al /usr/local/bin/python
ls: /usr/local/bin/python: No such file or directory

--

___
Python tracker 

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



[issue23469] Delete Misc/*.wpr files

2021-12-14 Thread Berker Peksag


Change by Berker Peksag :


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



[issue23469] Delete Misc/*.wpr files

2021-12-14 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset d46d08d9474cb00b697dbdbb12cc7ce8f8ddfcec by Kumar Aditya in 
branch 'main':
bpo-23469: Delete Wing IDE configuration files (GH-30067)
https://github.com/python/cpython/commit/d46d08d9474cb00b697dbdbb12cc7ce8f8ddfcec


--

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-14 Thread Steve Dower


Steve Dower  added the comment:

Or possibly that error is coming from the attempt to copy it? And since 
both executable and base_executable don't have the 3/3.x suffix, the 
copy is failing because the "real" binary does have the suffix.

This could be corrected in getpath.py with a platform-specific quirk 
that searches for suffixed binaries for base_executable, but for 
performance reasons I think we'd prefer to have that check in venv so 
that it doesn't impact every single launch of CPython.

The actual binary could also be added to pyvenv.cfg as another value - 
parsing that out in getpath.py is now considerably easier for someone to 
add than it used to be.

--

___
Python tracker 

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



[issue46028] 3.11.0a3: under tox, sys._base_executable is wrong

2021-12-14 Thread Steve Dower


Steve Dower  added the comment:

> $ v311/bin/python -m venv 311-nested
> Error: [Errno 2] No such file or directory: 
> '/private/tmp/bpo-46028/311-nested/bin/python'

I assume /private/tmp/bpo-46028/311-nested/bin/python3.11 exists though? 
Probably that's the issue here - I don't know how else to get the real 
executable *name* other than copying from argv[0], and it isn't supposed 
to be necessary.

You also have v311/bin/python3.11, right? If you use that one, does it 
work? I'm trying to narrow down where the base executable is actually 
being launched and why.

--
title: 3.11.0a3: sys._base_executable is wrong, breaks venv - it wasn't under 
3.11.0a2 -> 3.11.0a3: under tox, sys._base_executable is wrong

___
Python tracker 

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



[issue46066] TypedDict alternative definition syntax with keyword args is confusing

2021-12-14 Thread 97littleleaf11


Change by 97littleleaf11 <97littlelea...@gmail.com>:


--
title: [doc] TypedDict alternative definition syntax with keyword args is 
confusing -> TypedDict alternative definition syntax with keyword args is 
confusing

___
Python tracker 

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



[issue22047] Deprecate unsupported nesting of argparse groups

2021-12-14 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +28320
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30098

___
Python tracker 

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



[issue22047] Deprecate unsupported nesting of argparse groups

2021-12-14 Thread Irit Katriel


Irit Katriel  added the comment:

I am repurposing this issue for the deprecation of nesting. It is pretty clear 
that the functions exist by accident through inheritance. They are not 
documented and from the number of open issues about them they clearly are not 
working as people expect them to.

--
title: argparse improperly prints mutually exclusive options when they are in a 
group -> Deprecate unsupported nesting of argparse groups
versions: +Python 3.11 -Python 2.7, Python 3.5

___
Python tracker 

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



[issue46023] Modules/makesetup generated rules ignore *disabled*

2021-12-14 Thread Christian Heimes


Christian Heimes  added the comment:

GH-30001 may have introduced a regression. makesetup is dropping too many 
modules. Back to the drawing board!

--

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread Vinay Sajip


Vinay Sajip  added the comment:

Ah ... forgot to set delay=True for the handlers. Will look at this soon.

--

___
Python tracker 

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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread Irit Katriel

Irit Katriel  added the comment:

% ./python.exe -We -m test -v test_logging -m test_compute_files_to_delete 
Raised RLIMIT_NOFILE: 256 -> 1024
== CPython 3.11.0a3+ (heads/main:9130a4d620, Dec 14 2021, 11:12:05) [Clang 
13.0.0 (clang-1300.0.29.3)]
== macOS-11.6-x86_64-i386-64bit little-endian
== cwd: /Users/iritkatriel/src/cpython/build/test_python_86072æ
== CPU count: 12
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 5.20 Run tests sequentially
0:00:00 load avg: 5.20 [1/1] test_logging
test_compute_files_to_delete (test.test_logging.TimedRotatingFileHandlerTest) 
... Warning -- Unraisable exception
Exception ignored in: <_io.FileIO 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/d.e.log'
 mode='ab' closefd=True>
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in 
test_compute_files_to_delete
for i, prefix in enumerate(prefixes):
^
ResourceWarning: unclosed file <_io.TextIOWrapper 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/d.e.log'
 mode='a' encoding='UTF-8'>
Warning -- Unraisable exception
Exception ignored in: <_io.FileIO 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/a.b.c.log'
 mode='ab' closefd=True>
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in 
test_compute_files_to_delete
for i, prefix in enumerate(prefixes):
^
ResourceWarning: unclosed file <_io.TextIOWrapper 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/a.b.c.log'
 mode='a' encoding='UTF-8'>
Warning -- Unraisable exception
Exception ignored in: <_io.FileIO 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/a.b.log'
 mode='ab' closefd=True>
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in 
test_compute_files_to_delete
for i, prefix in enumerate(prefixes):
^
ResourceWarning: unclosed file <_io.TextIOWrapper 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/a.b.log'
 mode='a' encoding='UTF-8'>
Warning -- Unraisable exception
Exception ignored in: <_io.FileIO 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/d.e.f.log'
 mode='ab' closefd=True>
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/Lib/test/test_logging.py", line 5469, in 
test_compute_files_to_delete
for i, prefix in enumerate(prefixes):
^
ResourceWarning: unclosed file <_io.TextIOWrapper 
name='/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn/T/test_logging_w3nn9vsi/d.e.f.log'
 mode='a' encoding='UTF-8'>
ok

--
Ran 1 test in 0.016s

OK
test_logging failed (env changed)

== Tests result: SUCCESS ==

1 test altered the execution environment:
test_logging

--
nosy: +iritkatriel

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-14 Thread graysky


New submission from graysky :

Seems as though cpython is broken when working with subinterpreters. The 
problematic change could be (d0d29655ff) affecting import.c.[1] Reverting this 
commit and rebuilding python fixes the issues on my system with some scripts 
that import sqlite, for example, the Kodi plugin YouTube[2] and the IMDB 
Trailers plugin. Others have reported similar breakage with other python 
code[3].

Example output when the bug manifests:

ERROR : Traceback (most recent call last):
ERROR :   File "/usr/lib/python3.10/sqlite3/dbapi2.py", line 83, in 
register_adapters_and_converters
ERROR : 
ERROR : register_converter("timestamp", convert_timestamp)
ERROR : 
ERROR : KeyError
ERROR : : 
ERROR : 'timepart_full'
ERROR :  
ERROR : Exception ignored deletion of interned string failed
ERROR : :


References:
1. 
https://github.com/python/cpython/commit/d0d29655ffc43d426ad68542d8de8304f7f1346a
2. https://github.com/anxdpanic/plugin.video.youtube/issues/255
3. https://bbs.archlinux.org/viewtopic.php?id=272121

--
components: Interpreter Core
messages: 408520
nosy: graysky
priority: normal
severity: normal
status: open
title: broken subinterpreters
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



[issue46028] 3.11.0a3: sys._base_executable is wrong, breaks venv - it wasn't under 3.11.0a2

2021-12-14 Thread Vinay Sajip


Change by Vinay Sajip :


--
title: 3.11.0a3: under tox, sys._base_executable is wrong -> 3.11.0a3: 
sys._base_executable is wrong, breaks venv - it wasn't under 3.11.0a2

___
Python tracker 

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



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

2021-12-14 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue46063] TimedRotatingFileHandler deletes wrong files

2021-12-14 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue46069] Super Smash Flash 2

2021-12-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue46069] Super Smash Flash 2

2021-12-14 Thread haven david


New submission from haven david :

Opportunity for you to transform into interesting characters like Mario, 
Sonic...
Online game with exciting battles
https://super-smashflash2.com

--
components: Build
messages: 408519
nosy: havenhaven
priority: normal
severity: normal
status: open
title: Super Smash Flash 2
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



[issue31370] Remove support for threads-less builds

2021-12-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Concur with Victor. It is fine to add a link to other discussion in a closed 
issue, but an issue closed many years ago is not a good place for a new 
discussion at all.

--

___
Python tracker 

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



[issue23148] Missing the charset parameter in as_encoded_word()

2021-12-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The code was completely rewritten in issue27240. No tests are needed.

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



[issue46062] tkinter.filedialog.SaveAs: create new folder on Ubuntu?

2021-12-14 Thread Aivar Annamaa


Aivar Annamaa  added the comment:

You may want to use zenity in a subprocess instead of this dialog in Linux, but 
this has its own problems (appearing behind other windows occasionally)

--
nosy: +aivarannamaa

___
Python tracker 

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