[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-12-10 Thread Alex Waygood


Alex Waygood  added the comment:

Another option for code using Python <3.11, that will work without the `from 
__future__ import annotations` import, is to do something like this:

```
from graphlib import TopologicalSorter
x: 'TopologicalSorter[str]' = TopologicalSorter({"a": {}, "b": {"a"}})
```

By using a string as the annotation, we give mypy the specificity it needs, but 
the expression will never need to be resolved at runtime.

--
nosy: +AlexWaygood
type: behavior -> enhancement

___
Python tracker 

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



[issue46031] add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE

2021-12-10 Thread penguin_wwy


New submission from penguin_wwy <940375...@qq.com>:

https://github.com/faster-cpython/ideas/discussions/154

--
components: Interpreter Core
messages: 408178
nosy: penguin_wwy
priority: normal
severity: normal
status: open
title: add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE
type: performance
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



[issue46031] add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE

2021-12-10 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


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

___
Python tracker 

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-10 Thread Kumar Aditya


New submission from Kumar Aditya :

functools' singledispatch does not support GenericAlias

```py
from functools import singledispatch

@singledispatch
def func(x):
print("any")

@func.register
def _(x: list[str]):
print("list[str]")


func(["a", "b"])

```

--
components: Library (Lib)
messages: 408179
nosy: kumaraditya303, rhettinger
priority: normal
severity: normal
status: open
title: functools' singledispatch does not support GenericAlias
type: enhancement
versions: Python 3.11

___
Python tracker 

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



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

2021-12-10 Thread Christian Heimes


Christian Heimes  added the comment:

Commit 9f2f7e42269db74a89fc8cd74d82a875787f01d7 has correct _base_executable

$ venv/bin/python
Python 3.11.0a2+ (heads/bpo-45847-simple-115-g9f2f7e42269:9f2f7e42269, Dec 10 
2021, 10:09:54) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys._base_executable
'/home/heimes/dev/python/cpython/venv/bin/python'

_base_executable in commit 99fcf1505218464c489d419d4500f126b6d6dc28 is wrong

$ venv/bin/python
Python 3.11.0a2+ (heads/bpo-45847-simple-116-g99fcf150521:99fcf150521, Dec 10 
2021, 10:12:35) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys._base_executable
'/home/heimes/dev/python/cpython/python'

--
nosy: +christian.heimes

___
Python tracker 

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-10 Thread Alex Waygood


Alex Waygood  added the comment:

My opinion is that supporting `GenericAlias` here would be a bad idea. 
Associating an implementation of the function with the argument type 
`list[str]` is ambiguous. Would this implementation be called if any argument 
of type `list` was supplied, or would it only be called if all elements in the 
list were of type `str`?

The first option would be efficient, simple, and similar to the way 
singledispatch treats most other argument-types. However, it would be 
unintuitive.

The second option would be more intuitive, but could be extremely inefficient 
if a very long list was passed in. It would also make the code more complicated.

--
nosy: +AlexWaygood, lukasz.langa

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
status: pending -> closed

___
Python tracker 

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



[issue42182] 3.10 Documentation Not Hyperlinking Some Methods

2021-12-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 8c74713d0e349c27518080945d5f040dfd52a56e by andrei kulakov in 
branch 'main':
bpo-42182: stdtypes doc - update and fix links to several dunder methods  
(GH-27384)
https://github.com/python/cpython/commit/8c74713d0e349c27518080945d5f040dfd52a56e


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42182] 3.10 Documentation Not Hyperlinking Some Methods

2021-12-10 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue42182] 3.10 Documentation Not Hyperlinking Some Methods

2021-12-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28245
pull_request: https://github.com/python/cpython/pull/30021

___
Python tracker 

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



[issue45779] multiprocessing initializer error with CPython 3.9.6 on Apple Silicon

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
status: pending -> closed

___
Python tracker 

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



[issue46000] NetBSD curses compatibility

2021-12-10 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46000] NetBSD curses compatibility

2021-12-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2fb797e93c6bbd44dfcbe23f63acfa240a87e48a by Thomas Klausner in 
branch 'main':
bpo-46000: Improve NetBSD curses compatibility (GH-29947)
https://github.com/python/cpython/commit/2fb797e93c6bbd44dfcbe23f63acfa240a87e48a


--

___
Python tracker 

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



[issue46000] NetBSD curses compatibility

2021-12-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28247
pull_request: https://github.com/python/cpython/pull/30023

___
Python tracker 

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



[issue15757] ./configure --with-pydebug on FreeBSD results in -O2 -pipe eventually ending up in CFLAGS.

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue45662] Incorrect repr of InitVar of a type alias

2021-12-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset fb8aad16401e081a6a9059c7b428f7e8aae85d58 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-45662: Fix the repr of InitVar with a type alias to the built-in 
class (GH-29291) (GH-29924)
https://github.com/python/cpython/commit/fb8aad16401e081a6a9059c7b428f7e8aae85d58


--

___
Python tracker 

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



[issue13473] Add tests for files byte-compiled by distutils

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue45662] Incorrect repr of InitVar of a type alias

2021-12-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue14336] Difference between pickle implementations for function objects

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue28559] Unclear error message when raising wrong type of exceptions

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> rejected
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

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



[issue41702] Inconsistent behaviour in strftime

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue22293] unittest.mock: use slots in MagicMock to reduce memory footprint

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
stage: needs patch -> resolved
status: pending -> closed

___
Python tracker 

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



[issue42182] 3.10 Documentation Not Hyperlinking Some Methods

2021-12-10 Thread miss-islington


miss-islington  added the comment:


New changeset 64c2788f42c49c7094d3b6e5404fe8386a2b4779 by Miss Islington (bot) 
in branch '3.10':
bpo-42182: stdtypes doc - update and fix links to several dunder methods  
(GH-27384)
https://github.com/python/cpython/commit/64c2788f42c49c7094d3b6e5404fe8386a2b4779


--

___
Python tracker 

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



[issue42182] 3.10 Documentation Not Hyperlinking Some Methods

2021-12-10 Thread miss-islington


miss-islington  added the comment:


New changeset 40d765260ae08d152ee89ed9c1c621f4a0024fa6 by Miss Islington (bot) 
in branch '3.9':
bpo-42182: stdtypes doc - update and fix links to several dunder methods  
(GH-27384)
https://github.com/python/cpython/commit/40d765260ae08d152ee89ed9c1c621f4a0024fa6


--

___
Python tracker 

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



[issue46000] NetBSD curses compatibility

2021-12-10 Thread miss-islington


miss-islington  added the comment:


New changeset bb76410824e526ee075eac22812a577cca7583cf by Miss Islington (bot) 
in branch '3.10':
bpo-46000: Improve NetBSD curses compatibility (GH-29947)
https://github.com/python/cpython/commit/bb76410824e526ee075eac22812a577cca7583cf


--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-10 Thread Gabriele N Tornetta


Gabriele N Tornetta  added the comment:

@rhettinger
Apologies. You're totally right but I wasn't expecting this to become a lengthy 
conversation.

So, to get closer to the initial issue, I believe that this ticket could be 
closed provided that the documentation is improved by making developers aware 
of the potential side effects of isinstance. I was doing some more experiments 
and it looks like

def _isinstance(obj, classinfo):
return issubclass(type(obj), classinfo)

might be considered a "side-effects-free" version of isinstance. So perhaps one 
thing to mention in the documentation is that `isinstance(obj, classinfo) != 
issubclass(type(obj), classinfo)` in general.

--

___
Python tracker 

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



[issue46033] Duplicated sentence in for statement documentation

2021-12-10 Thread Michał D

New submission from Michał D :

In for statement description, there seem to be two sentences meant to mean the 
same:

> The suite is then executed once for each item provided by the iterator, in 
> the order returned by the iterator. Each item in turn is assigned to the 
> target list using the standard rules for assignments (see Assignment 
> statements), and then the suite is executed.

(from https://docs.python.org/3/reference/compound_stmts.html#the-for-statement)

I believe only one of these sentences should be kept (probably the second one).

If I am wrong, and the current version is actually correct, then it is unclear 
- to me it sounds like the iterator is iterated through twice, and suite is 
executed twice for each item.

--
assignee: docs@python
components: Documentation
messages: 408189
nosy: docs@python, michcio1234
priority: normal
severity: normal
status: open
title: Duplicated sentence in for statement documentation
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



[issue45723] Improve and simplify configure.ac checks

2021-12-10 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +28248
pull_request: https://github.com/python/cpython/pull/30024

___
Python tracker 

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



[issue46033] Duplicated sentence in for statement documentation

2021-12-10 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue46030] socket module add couple of FreeBSD constants

2021-12-10 Thread David CARLIER


Change by David CARLIER :


--
nosy: +devnexen -dcarlier

___
Python tracker 

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



[issue46000] NetBSD curses compatibility

2021-12-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 040f9f9c48f4e74e851d850275aa9e050a04d0c6 by Miss Islington (bot) 
in branch '3.9':
bpo-46000: Improve NetBSD curses compatibility (GH-29947) (GH-30023)
https://github.com/python/cpython/commit/040f9f9c48f4e74e851d850275aa9e050a04d0c6


--

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-12-10 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 74b23c97cd5e178970a199066795cf0561f46b72 by Erlend Egeberg 
Aasland in branch 'main':
bpo-45723: Normalise configure user communication (GH-30024)
https://github.com/python/cpython/commit/74b23c97cd5e178970a199066795cf0561f46b72


--

___
Python tracker 

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



[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2021-12-10 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The plot thickens.

I was wrong to say that type() always and only looks at the "real" underlying 
type of the instance. type() does look at __class__ as well. But only sometimes.

>>> class A:
... __class__ = int
... 
>>> type(A())

>>> a = A()
>>> a.__class__ = int
>>> type(a)


So from A, we might think that type() ignores __class__

>>> class B:
... pass
... 
>>> type(B())  # no __class__ to inspect

>>> b = B()
>>> b.__class__ = int
Traceback (most recent call last):
  File "", line 1, in 
TypeError: __class__ assignment only supported for mutable types or ModuleType 
subclasses

How very odd. But okay, let's try something else:

>>> b.__class__ = A  # lie that this is an A not a B
>>> type(b)


So now type() *does* inspect __class__, and believes it.

If we generate the __class__ attribute dynamically with __getattr__, the method 
doesn't even get called. But if we use __getattribute__:

>>> class C:
... def __getattribute__(self, name):
... print('C getattribute:', name)
... if name == '__class__':
... return int
... raise AttributeError
... 
>>> C().__class__
C getattribute: __class__

>>> type(C())


type() ignores the dynamically generated __class__. But isinstance does not:

>>> isinstance(C(), int)
C getattribute: __class__
True


The same applies if we use property:

>>> class D:
... @property
... def __class__(self):
... return int
... 
>>> type(D())

>>> isinstance(D(), int)
True


So the rules appear to be:

- you can set __class__, but only sometimes;
- type() will believe __class__, but only sometimes;
- you can generate __class__ dynamically, but not with __getattr__;
- isinstance() will believe __class__ (always?);
- and there is no indication of how much of this is deliberate language feature 
and how much is an accident of implementation.

--

___
Python tracker 

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



[issue46033] Duplicated sentence in for statement documentation

2021-12-10 Thread Vedran Čačić

Vedran Čačić  added the comment:

How about adding the words "More precisely," at the beginning of the second 
sentence?

--
nosy: +veky

___
Python tracker 

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



[issue46000] NetBSD curses compatibility

2021-12-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Thomas for your contribution.

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



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

2021-12-10 Thread Ned Batchelder


Ned Batchelder  added the comment:

git bisect also identifies that commit as the first bad:


99fcf1505218464c489d419d4500f126b6d6dc28 is the first bad commit
commit 99fcf1505218464c489d419d4500f126b6d6dc28
Author: Steve Dower 
Date:   Fri Dec 3 00:08:42 2021 +

bpo-45582: Port getpath[p].c to Python (GH-29041)

The getpath.py file is frozen at build time and executed as code over a 
namespace. It is never imported, nor is it meant to be importable or reusable. 
However, it should be easier to read, modify, and patch than the previous code.

This commit attempts to preserve every previously tested quirk, but these 
may be changed in the future to better align platforms.

--

___
Python tracker 

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



[issue40821] os.getlogin() not working

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue46034] Patch-adding __init__ in a class takes no effect when called from a subinterpreter

2021-12-10 Thread Miro Hrončok

New submission from Miro Hrončok :

Hello,

based on some bug reports reported in:

- https://github.com/GrahamDumpleton/mod_wsgi/issues/729
- https://github.com/poljar/weechat-matrix/issues/293
- https://bugzilla.redhat.com/show_bug.cgi?id=2030621

I have isolated the following reproducer that shows a regression in Python 
3.10+. It happens at least with 3.10.0, 3.10.1 and 3.11.0a2. It works as 
expected in Python 3.9.

The following code is valid and works on 3.9, 3.10, 3.11:

=
class Greeting():
pass

def new_init(inst, name):
inst.text = f"Hello, {name}\n"

Greeting.__init__ = new_init

Greeting("Miro")
=


But if we run it via a subinterpreter, it breaks on 3.10+:

=
import _testcapi

code = r"""class Greeting():
pass

def new_init(inst, name):
inst.text = f"Hello, {name}\n"

Greeting.__init__ = new_init

Greeting("Miro")"""

_testcapi.run_in_subinterp(code)
=


$ python3.9 reproducer.py
(exits cleanly)

$ python3.10 reproducer.py 
Traceback (most recent call last):
  File "", line 9, in 
TypeError: Greeting() takes no arguments

$ python3.11 reproducer.py 
Traceback (most recent call last):
  File "", line 9, in 
TypeError: Greeting() takes no arguments


My observation also shows that if the Greeting class already had (any) __init__:

=
class Greeting():
__init__ = ...
=

It works as expected on 3.9, 3.10, 3.11.



In reality, this is most likely to affect classes with decorators, like:

=
import attr

@attr.s
class TestClass:
foo = attr.ib()

TestClass("Miro")
=

This works standalone, but fails in a subinterpreter:

$ python3.10 reproducer.py 
Traceback (most recent call last):
  File "", line 7, in 
TypeError: TestClass() takes no arguments

--
components: Subinterpreters
messages: 408196
nosy: eric.snow, hroncok, vstinner
priority: normal
severity: normal
status: open
title: Patch-adding __init__ in a class takes no effect when called from a 
subinterpreter
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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2021-12-10 Thread milahu


New submission from milahu :

deprecated mimetype?
per rfc4329, the technical term is "unregistered media type"

https://datatracker.ietf.org/doc/html/rfc4329#section-3

related

https://stackoverflow.com/a/9664327/10440128

https://github.com/danny0838/PyWebScrapBook/issues/53

quick fix

```py
# python/Lib/mimetypes.py

class MimeTypes:
# ...
def guess_type(self, url, strict=True):
# ...

if ext in _types_map_default:
# prefer the python-internal values over /etc/mime.types
return _types_map_default[ext], encoding

if ext in types_map:
return types_map[ext], encoding
```

why is `application/x-javascript` returned?

on linux, mimetypes.init() loads /etc/mime.types
source:
https://mirrors.kernel.org/gentoo/distfiles/mime-types-9.tar.bz2

/etc/mime.types is sorted by alphabet, so

```
cat /etc/mime.types | grep javascript
application/javascript  
js
application/x-javascript
js
```

apparently, the last entry application/x-javascript
will overwrite the previous entry application/javascript

--
components: Library (Lib)
messages: 408197
nosy: milahu
priority: normal
severity: normal
status: open
title: mimetypes.guess_type returns deprecated mimetype application/x-javascript
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



[issue45723] Improve and simplify configure.ac checks

2021-12-10 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +28251
pull_request: https://github.com/python/cpython/pull/30026

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2021-12-10 Thread milahu


milahu  added the comment:

patch

https://github.com/milahu/cpython/commit/8a50633bb1b0c3e39fbe2cd467bb34a839ad068f

--

___
Python tracker 

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



[issue46034] Patch-adding __init__ in a class takes no effect when called from a subinterpreter

2021-12-10 Thread Miro Hrončok

Miro Hrončok  added the comment:

git bisect gives:

https://github.com/python/cpython/commit/ea251806b8d11b30d2182af1e589caf88acf

--

___
Python tracker 

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



[issue46034] Patch-adding __init__ in a class takes no effect when called from a subinterpreter

2021-12-10 Thread STINNER Victor


STINNER Victor  added the comment:

I mark this issue as a duplicate of bpo-46006. It's not exactly the same issue, 
but the root cause is the same: in some functions, Python use fast pointer 
comparisons when two strings are interned, but this now fails if two interned 
strings belong to two different interpreters.

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



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

2021-12-10 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-46034 as a duplicate: setting a class "__init__" attribute doesn't 
update properly its tp_init slot. update_slot() of Objects/typeobject.c only 
uses a fast pointer comparison since both strings are interned, but the test 
fails if the two strings are part of two different Python interpreters.

In bpo-46034 case, the problem is that the "slotdefs" array uses interned 
strings created in the main interpreter, whereas the update_slot() name 
parameter (Python string) was created in a sub-interpreter.

Reproducer:
=
import _testcapi

code = r"""class Greeting():
pass

def new_init(inst, name):
inst.text = f"Hello, {name}\n"

Greeting.__init__ = new_init

Greeting("Miro")"""

_testcapi.run_in_subinterp(code)
=

--

___
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-10 Thread STINNER Victor


STINNER Victor  added the comment:

Attachd cmp_interned_strings.patch fix _PyUnicode_EqualToASCIIId() and 
update_slot() for subinterpreters. I will create a PR once we agree if it's 
required to support subinterpreters there, and if there is no better (faster) 
option.

For update_slot(), one option to avoid adding a "slow" _PyUnicode_EQ() call 
would be to have per-interpreter interned strings for the slotdefs array.

--
keywords: +patch
Added file: https://bugs.python.org/file50485/cmp_interned_strings.patch

___
Python tracker 

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



[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2021-12-10 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

I ran into this problem in PyPy today, preparing a patch for CPython too 
(without looking at the old one).

--
nosy: +Carl.Friedrich.Bolz

___
Python tracker 

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



[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2021-12-10 Thread Carl Friedrich Bolz-Tereick


Change by Carl Friedrich Bolz-Tereick :


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

___
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-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +3.10regression
nosy: +pablogsal
priority: normal -> release blocker

___
Python tracker 

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-10 Thread Alex Waygood


Alex Waygood  added the comment:

It would be well worth it to improve the error message, however:

```
>>> from functools import singledispatch
>>> @singledispatch
... def func(arg):
... raise NotImplementedError
... 
>>> @func.register
... def _(arg: list[str]):
... print('Got a list of strings')
... 
>>> func(1)
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/functools.py", line 830, in dispatch
impl = dispatch_cache[cls]
  File "/usr/local/lib/python3.9/weakref.py", line 405, in __getitem__
return self.data[ref(key)]
KeyError: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/functools.py", line 833, in dispatch
impl = registry[cls]
KeyError: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.9/functools.py", line 877, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
return dispatch(args[0].__class__)(*args, **kw)
  File "/usr/local/lib/python3.9/functools.py", line 835, in dispatch
impl = _find_impl(cls, registry)
  File "/usr/local/lib/python3.9/functools.py", line 782, in _find_impl
mro = _compose_mro(cls, registry.keys())
  File "/usr/local/lib/python3.9/functools.py", line 743, in _compose_mro
types = [n for n in types if is_related(n)]
  File "/usr/local/lib/python3.9/functools.py", line 743, in 
types = [n for n in types if is_related(n)]
  File "/usr/local/lib/python3.9/functools.py", line 742, in is_related
and issubclass(cls, typ))
TypeError: issubclass() argument 2 cannot be a parameterized generic
```

--

___
Python tracker 

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-10 Thread Alex Waygood


Alex Waygood  added the comment:

The above traceback is because the `isinstance(list[str], type)` check at 
Lib/functools.py:848 evaluates to `True`. Related: #45665.

--

___
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-10 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Indeed, seems my original hunch is correct. Steve, could you take a look when 
you have some time?

--

___
Python tracker 

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2021-12-10 Thread Alex Waygood


Alex Waygood  added the comment:

#46032 is related to this issue.

--
nosy: +AlexWaygood

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


Christian Heimes  added the comment:


New changeset 036bbb1d1b6156a1a72c40e9f907f302505085bc by Christian Heimes in 
branch 'main':
bpo-46023: Fix makesetup handling of disabled rule (GH-30001)
https://github.com/python/cpython/commit/036bbb1d1b6156a1a72c40e9f907f302505085bc


--

___
Python tracker 

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



[issue46036] Single-phase initialized modules gets initialized multiple times in 3.10.0

2021-12-10 Thread Daniel

New submission from Daniel :

The documentation 
(https://docs.python.org/3/c-api/init.html#c.Py_NewInterpreter) states:


For modules using single-phase initialization, e.g. PyModule_Create(), the 
first time a particular extension is imported, it is initialized normally, and 
a (shallow) copy of its module’s dictionary is squirreled away. When the same 
extension is imported by another (sub-)interpreter, a new module is initialized 
and filled with the contents of this copy; the extension’s init function is not 
called. Objects in the module’s dictionary thus end up shared across 
(sub-)interpreters, which might cause unwanted behavior (see Bugs and caveats 
below).


This does however seem to have changed (sometime between 3.6.9 and 3.10.0). 
Consider the following code:


#include 

/*
 * Create a module "my_spam" that uses single-phase initialization
 */
static PyModuleDef EmbModule = {
  PyModuleDef_HEAD_INIT, "my_spam", NULL, -1,
  NULL,
  NULL, NULL, NULL, NULL
};

/*
 * According to the docs this function is only called once when dealing with
 * subinterpreters, the next time a shallow copy of the initial state is
 * returned. This does however not seem to be the case in Python 3.10.0..
 */
static PyObject* PyInit_emb(void) {
  PyObject *module = PyModule_Create(&EmbModule);
  PyModule_AddObject(module, "test", PyDict_New());

  printf("Init my_spam module %p\n", module);
  return module;
}

/*
 * Main program
 */

int main(int argc, char *argv[]) {
  PyImport_AppendInittab("my_spam", &PyInit_emb);
  Py_Initialize();

  // Save the main state
  PyThreadState *mainstate = PyThreadState_Get();

  // Create two new interpreters
  PyThreadState *inter1 = Py_NewInterpreter();
  PyThreadState *inter2 = Py_NewInterpreter();

  // Import the my_spam module into the first subinterpreter
  // and change the global variable of it
  PyThreadState_Swap(inter1);
  PyRun_SimpleString("import sys; print(sys.version_info)");
  PyRun_SimpleString("import my_spam; print('my_spam.test: ', my_spam.test)");
  PyRun_SimpleString("my_spam.test[1]=1; print('my_spam.test: ', 
my_spam.test)");

  // Import the my_spam module into the second subinterpreter
  // and change the global variable of it
  PyThreadState_Swap(inter2);
  PyRun_SimpleString("import sys; print(sys.version_info)");
  PyRun_SimpleString("import my_spam; print('my_spam.test: ', my_spam.test)");
  PyRun_SimpleString("my_spam.test[2]=2; print('my_spam.test: ', 
my_spam.test)");

  // Close the subinterpreters
  Py_EndInterpreter(inter2);
  PyThreadState_Swap(inter1);
  Py_EndInterpreter(inter1);

  // Swap back to the main state and finalize python
  PyThreadState_Swap(mainstate);
  if (Py_FinalizeEx() < 0) {
  exit(120);
  }

  return 0;
}



Compiled with python 3.6.9 this does act according to the documentation:


$ gcc test_subinterpreters.c 
-I/home/daniel/.pyenv/versions/3.6.9/include/python3.6m 
-L/home/daniel/.pyenv/versions/3.6.9/lib -lpython3.6m && 
LD_LIBRARY_PATH=/home/daniel/.pyenv/versions/3.6.9/lib ./a.out
sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)
Init my_spam module 0x7ff7a63d1ef8
my_spam.test:  {}
my_spam.test:  {1: 1}
sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)
my_spam.test:  {1: 1}
my_spam.test:  {1: 1, 2: 2}


But compiled with 3.10.0 the module is reinitialized and thus objects in the 
module are not shared between the subinterpreters:


$ gcc test_subinterpreters.c 
-I/home/daniel/.pyenv/versions/3.10.0/include/python3.10 
-L/home/daniel/.pyenv/versions/3.10.0/lib -lpython3.10 && 
LD_LIBRARY_PATH=/home/daniel/.pyenv/versions/3.10.0/lib ./a.out
sys.version_info(major=3, minor=10, micro=0, releaselevel='final', serial=0)
Init my_spam module 0x7f338a9a9530
my_spam.test:  {}
my_spam.test:  {1: 1}
sys.version_info(major=3, minor=10, micro=0, releaselevel='final', serial=0)
Init my_spam module 0x7f338a9a96c0
my_spam.test:  {}
my_spam.test:  {2: 2}


To me the new behavior seems nicer, but at the very least the documentation 
should be updated. It also seems like if this could break integrations, albeit 
it is an unlikely "feature" to rely on.

--
components: C API
messages: 408209
nosy: daniel-falk
priority: normal
severity: normal
status: open
title: Single-phase initialized modules gets initialized multiple times in 
3.10.0
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue45654] Freeze the runpy module.

2021-12-10 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 4.0 -> 5.0
pull_requests: +28253
pull_request: https://github.com/python/cpython/pull/30028

___
Python tracker 

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



[issue45654] Freeze the runpy module.

2021-12-10 Thread Christian Heimes


Christian Heimes  added the comment:

I noticed that the types module is only used for ModuleType. PR GH-30028 gets 
rid of 205 kB object code:

   205K  Python/deepfreeze/types.o

--

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-12-10 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +28254
pull_request: https://github.com/python/cpython/pull/30029

___
Python tracker 

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2021-12-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +functools' singledispatch does not support GenericAlias

___
Python tracker 

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2021-12-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies:  -functools' singledispatch does not support GenericAlias

___
Python tracker 

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



[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-12-10 Thread Jacob Hayes


Jacob Hayes  added the comment:

Thanks for the tips! I've been using this patch in my own code in a early 
imported `__init__.py`:

```
from graphlib import TopologicalSorter
from types import GenericAlias

if not hasattr(TopologicalSorter, "__class_getitem__"):  # pragma: no cover
TopologicalSorter.__class_getitem__ = classmethod(GenericAlias)  # type: 
ignore
```

Certainly a bit hacky, but aside from no-op on >=3.11 and satisfying mypy, it 
supports runtime type inspection via `get_type_hints` before 3.11 (which 
otherwise still errors for stringized versions). The stringized versions are 
probably a bit simpler/safer for most folks though :)

--

___
Python tracker 

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



[issue46029] "ValueError: Invalid isoformat string" from a valid string

2021-12-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

fromisoformat() is only designed to parse the output of isformat().

See issue 35829 for further discussion. I'm going to close this issue as a 
duplicate.

--
nosy: +eric.smith
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> datetime: parse "Z" timezone suffix in fromisoformat()

___
Python tracker 

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



[issue46024] Different behaviour with zipfile

2021-12-10 Thread Eric V. Smith


Change by Eric V. Smith :


--
status: open -> pending

___
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-10 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +hroncok

___
Python tracker 

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



[issue30718] [doc] open builtin function: specifying the size of buffer has no effect for text files

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
assignee:  -> docs@python
components: +Documentation -Interpreter Core
keywords: +easy
nosy: +docs@python
title: open builtin function: specifying the size of buffer has no effect for 
text files -> [doc] open builtin function: specifying the size of buffer has no 
effect for text files
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue46032] functools' singledispatch does not support GenericAlias

2021-12-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue45653] Freeze the encodings module.

2021-12-10 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 5.0 -> 6.0
pull_requests: +28255
pull_request: https://github.com/python/cpython/pull/30030

___
Python tracker 

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



[issue16977] argparse: mismatch between choices parsing and usage/error message

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

We could make the error message less wrong:

>>> p.parse_args(['d'])
usage: [-h] {a,b,c}
: error: argument a: invalid choice: 'd' (choose a value in 'abc')



% git diff
diff --git a/Lib/argparse.py b/Lib/argparse.py
index b44fa4f0f6..f03cc1f110 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -2499,8 +2499,8 @@ def _check_value(self, action, value):
 # converted value must be one of the choices (if specified)
 if action.choices is not None and value not in action.choices:
 args = {'value': value,
-'choices': ', '.join(map(repr, action.choices))}
-msg = _('invalid choice: %(value)r (choose from %(choices)s)')
+'choices': repr(action.choices)}
+msg = _('invalid choice: %(value)r (choose a value in 
%(choices)s)')
 raise ArgumentError(action, msg % args)
 
 # ===

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.2, Python 
3.3, Python 3.4

___
Python tracker 

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



[issue18349] argparse usage should preserve () in metavars such as range(20)

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11:

>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foo', type=int, choices=range(20), 
>>> metavar='range(0,20)')
_StoreAction(option_strings=[], dest='foo', nargs=None, const=None, 
default=None, type=, choices=range(0, 20), help=None, 
metavar='range(0,20)')
>>> parser.format_usage()
'usage: [-h] range0,20\n'

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

___
Python tracker 

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



[issue11708] argparse: suggestion for formatting optional positional args

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue23994] argparse fails to detect program name when there is a slash at the end of the program's path

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

I am unable to reproduce this problem on 3.11 on a Mac.

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



[issue46037] logging.config.dictConfig with disable_existing_loggers set, also disables loggers in configuration

2021-12-10 Thread vladmihaisima


New submission from vladmihaisima :

When invoking logging.config.dictConfig - if a logger was previously disabled 
(for example by a call to "logging.config.dictConfig({'version': 1})") - the 
loggers specified in the dictionary will not be enabled.

Documentation at https://docs.python.org/3/library/logging.config.html 
specifies for disable_existing_loggers that "... behaviour is to disable any 
existing non-root loggers unless they or their ancestors are explicitly named 
in the logging configuration.". There is no explicit mention for what happens 
when a logger exists and is already disabled. I would have assumed that if 
present it will be enabled, but that does not seem to be the case.

So I think that if a logger is disabled invoking dictConfig cannot re-enable it.

See attached code for a reproducible case.

--
files: bug.py
messages: 408216
nosy: vladmihaisima
priority: normal
severity: normal
status: open
title: logging.config.dictConfig with disable_existing_loggers set, also 
disables loggers in configuration
versions: Python 3.10, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file50486/bug.py

___
Python tracker 

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



[issue17890] argparse: mutually exclusive groups full of help-suppressed args can cause AssertionErrors

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

I'm unable to reproduce this problem on 3.11:

>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> group = parser.add_mutually_exclusive_group()
>>> group.add_argument('--spam', help=argparse.SUPPRESS)
_StoreAction(option_strings=['--spam'], dest='spam', nargs=None, const=None, 
default=None, type=None, choices=None, help='==SUPPRESS==', metavar=None)
>>> parser.add_argument('--' + 'eggs' * 20, dest='eggs')
_StoreAction(option_strings=['--eggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggs'],
 dest='eggs', nargs=None, const=None, default=None, type=None, choices=None, 
help=None, metavar=None)
>>> parser.print_usage()
usage: [-h]  
[--eggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggseggs
 EGGS]
>>>

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

___
Python tracker 

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



[issue46038] Mark /configure file as generated in .gitattributes

2021-12-10 Thread Oleg Iarygin


New submission from Oleg Iarygin :

configure is regenerated from configure.ac using a custom container with 
appropriate version of tools (quay.io/tiran/cpython_autoconf by Christian 
Heimes). As a result, configure falls into the same category as files generated 
by Argument Clinic, Freeze and Parser/asdl_c.py. Due to size and churn of these 
artifacts, they are marked in .gitattributes as generated so GitHub Pull 
Request Diff Viewer collapses them into a short notification. The pull request 
associated with this issue does the same for configure.

Actually, configure diff is so large that sometimes it crosses a threshold and 
GitHub collapses it by force with "Large diffs are not rendered by default" or 
even "xxx additions, yyy deletions not shown because the diff is too large. 
Please use a local Git client to view these changes". See GH-29756 as an 
extreme example (15,430 insertions and deletions) and 
 for an average.

--
components: Build
messages: 408218
nosy: arhadthedev
priority: normal
severity: normal
status: open
title: Mark /configure file as generated in .gitattributes
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue46038] Mark /configure file as generated in .gitattributes

2021-12-10 Thread Oleg Iarygin


Change by Oleg Iarygin :


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

___
Python tracker 

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



[issue28841] urlparse.urlparse() parses invalid URI without generating an error (examples provided)

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11:

>>> urllib.parse.urlparse('http://www.google.com:/abc')
ParseResult(scheme='http', netloc='www.google.com:', path='/abc', params='', 
query='', fragment='')


The discussion above was mostly leaning towards won't fix, except for the 
suggestion to

> Based on the RFC, one could argue that urlunsplit should omit the colon.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5, Python 
3.6, Python 3.7

___
Python tracker 

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



[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

I am unable to reproduce this on 3.11:

% ./python.exe tt.py -h
usage: tt.py [-h] [[-hello]]

options:
  -h, --help  show this help message and exit
  -hello  A flag

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



[issue31768] argparse drops '|'s when the arguments are too long

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

In 3.11 the problem is still there, but the cutoff to make Eric's script show 
it is now 26 rather than 8:

% ./python.exe tt.py 25
usage: tt.py [-h] [-v | -q | -x [X] | -y [Y] | Z | Z | Z | Z | Z | Z | Z | Z | 
Z | Z | Z | Z | Z | Z | Z | Z | Z | Z | Z | Z | Z | Z | Z | Z | Z]

% ./python.exe tt.py 26
usage: tt.py [-h] [-v] [-q] [-x [X]] [-y [Y]]
 [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] 
[Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z] [Z]

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5, Python 
3.6, Python 3.7

___
Python tracker 

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



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue16807] argparse group nesting lost on inheritance

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11: 

>>> argparse.ArgumentParser(add_help=False, parents=[parent]).print_help()
usage: [--foo FOO] [-a | -b]

options:
  -a
  -b

the group:
  --foo FOO

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

Adding a space as Paul suggests works. I'll close this soon if nobody objects.

--
nosy: +iritkatriel
resolution:  -> wont fix
status: open -> pending

___
Python tracker 

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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Mitchell Hentges


Mitchell Hentges  added the comment:

Hey, can I request a backport of this change? For my use case, 3.9+ would be 
great, but going back to 3.7 should be viable? I trust your judgement :)

I'll happily create the PRs for the backport, but it looks like the bug has to 
be indicated as "needs backport to X.Y" by Python maintainers first 
(https://devguide.python.org/gitbootcamp/?highlight=backport#backporting-merged-changes)

--
nosy: +mitchhentges

___
Python tracker 

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



[issue21461] Recognize -pthread

2021-12-10 Thread Thomas Klausner


Change by Thomas Klausner :


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

___
Python tracker 

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



[issue28609] argparse claims '*' positional argument is required in error output

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

>>> parser.parse_args([])
usage: [-h] [-V] COMMAND [ARGUMENT ...]
: error: the following arguments are required: COMMAND, ARGUMENT

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

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-12-10 Thread Steve Dower


Steve Dower  added the comment:


New changeset 3f398a77d37b5dfd51dabbc362d482a482fa885a by neonene in branch 
'main':
bpo-45582: Fix test_embed failure during a PGO build on Windows (GH-30014)
https://github.com/python/cpython/commit/3f398a77d37b5dfd51dabbc362d482a482fa885a


--

___
Python tracker 

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



[issue15125] argparse: positional arguments containing - in name not handled well

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.2, Python 
3.3, Python 3.4

___
Python tracker 

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



[issue24338] In argparse adding wrong arguments makes malformed namespace

2021-12-10 Thread Irit Katriel


Irit Katriel  added the comment:

>From the discussion and "rejected" resolution it looks like the intention was 
>to close this issue. I will do that soon if nobody objects.

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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28259
pull_request: https://github.com/python/cpython/pull/30034

___
Python tracker 

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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Vinay Sajip


Vinay Sajip  added the comment:

3.10 and 3.9 - OK, but 3. is security fixes only, I'm afraid.

--

___
Python tracker 

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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Vinay Sajip


Vinay Sajip  added the comment:

*3.8, I meant.

--

___
Python tracker 

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



[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2021-12-10 Thread Roy Smith


Roy Smith  added the comment:

It's nice to see this is still being worked on after all these years :-)

I'm not actually convinced the proposed fix makes sense.  It swaps out one 
incorrect behavior for a different incorrect behavior.  If it really is more 
effort than it's worth to fix this (and given msg223371, I agree it probably 
is), then at least the original behavior makes more sense, as it's got years of 
history behind it and dropping an extra blank line is less arbitrary than 
adding an extra space.  

I've long since forgotten what real-world issue led me to open this, but it 
seems like it be easier to just document that extra trailing whitespace may not 
be honored.

--
status: pending -> open

___
Python tracker 

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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Mitchell Hentges


Mitchell Hentges  added the comment:

That's great, thanks!

--

___
Python tracker 

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



[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2021-12-10 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue46039] Break up the YIELD_FROM instruction.

2021-12-10 Thread Mark Shannon


New submission from Mark Shannon :

The YIELD_FROM instruction does three things:

* It sends a value to the sub-iterator
* It yields the value from the sub-iterator back up to its caller
* Loops back on itself

So we should implement this as:

SEND<--+
YIELD_VALUE|
JUMP_ABSOLUTE -+

Doing so would allow us to simplify gen.send and gen.throw as they wouldn't 
need all the special cases for 'yield from'.

Zero cost exception handling allows us to handle throw in the bytecode with no 
runtime overhead:

while True:
SEND -> exit
try:
YIELD_VALUE
except BaseException as ex:
sub_iterator.throw(ex)
exit:

--
assignee: Mark.Shannon
components: Interpreter Core
messages: 408232
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Break up the YIELD_FROM instruction.
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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset bb8d645f3a09645686cf8f66bd46dcfa4efac713 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-43749: Ensure current exe is copied when using venv on windows 
(GH-25216) (GH-30034)
https://github.com/python/cpython/commit/bb8d645f3a09645686cf8f66bd46dcfa4efac713


--

___
Python tracker 

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



[issue46039] Break up the YIELD_FROM instruction.

2021-12-10 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2021-12-10 Thread Irit Katriel


Change by Irit Katriel :


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



[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset bad16f0cf71a6b11ef62f86be6b3d3567cd70a16 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-43749: Ensure current exe is copied when using venv on windows 
(GH-25216) (GH-30033)
https://github.com/python/cpython/commit/bad16f0cf71a6b11ef62f86be6b3d3567cd70a16


--

___
Python tracker 

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



[issue45654] Freeze the runpy module.

2021-12-10 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 16638a4bdb802ae52d386a39d2dbef14de3fbc92 by Christian Heimes in 
branch 'main':
bpo-45654: No need to freeze types (GH-30028)
https://github.com/python/cpython/commit/16638a4bdb802ae52d386a39d2dbef14de3fbc92


--

___
Python tracker 

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



[issue21461] Recognize -pthread

2021-12-10 Thread Christian Heimes


Christian Heimes  added the comment:

Which platforms or compilers use -pthread?

--
components: +Build -Extension Modules
nosy: +christian.heimes
versions: +Python 3.11 -Python 3.5

___
Python tracker 

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



  1   2   >