[issue45579] [list.append(i) for i in list] causes high resources usage

2021-10-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue45586] Use starred expressions in subscripts

2021-10-23 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Jacob wrote:
a[[0, *[0, 0], 0]]
which passes the *list* [0, 0, 0, 0] into __getitem__. In numpy, passing lists 
into __getitem__ does things like array([1, 10, 100])[[2, 1]] --> array([100, 
10]).

But I think Peter is requesting that the following work:
a[0, *[0, 0], 0]
(this is currently a SyntaxError)
and the proposal is that it would pass the *tuple* (0, 0, 0, 0) into 
__getitem__, indexing into each dimension of the array.

A workaround is to use a[(0, *[0, 0], 0)] -- just one extra pair of parentheses.

This is a duplicate of https://bugs.python.org/issue43812 , where it was 
pointed out that this is currently being proposed as part of 
https://www.python.org/dev/peps/pep-0646/#implications , which it appears is in 
the queue of things for the steering council to rule on. I'll close this as a 
duplicate for now, but feel free to re-open if you feel something is missing 
from that PEP.

--
nosy: +Dennis Sweeney
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Tuple unpacking in getitem
title: Use starred expressions in list indices -> Use starred expressions in 
subscripts

___
Python tracker 

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



[issue45593] SpooledTemporaryFile.truncate returns None

2021-10-23 Thread Maciej Urbański

Change by Maciej Urbański :


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

___
Python tracker 

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



[issue45593] SpooledTemporaryFile.truncate returns None

2021-10-23 Thread Maciej Urbański

New submission from Maciej Urbański :

Related:
https://bugs.python.org/issue40287
https://bugs.python.org/msg319145

--
components: Library (Lib)
messages: 404914
nosy: rooter
priority: normal
severity: normal
status: open
title: SpooledTemporaryFile.truncate returns None
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



[issue45592] NamespaceLoader does not implement create_module or exec_module

2021-10-23 Thread Filipe Laíns

New submission from Filipe Laíns :

NamespaceLoader currently does not implement create_module or exec_module, 
which is problematic since load_module is deprecated.

The create_module docstring is the same as _LoaderBasics:

```
def create_module(self, spec):
"""Use default semantics for module creation."""
```

Is it intended to be empty, or is NamespaceLoader unfinished?

If this is intended, how should we create the module instead? If there is other 
part of the code dealing this, via a fallback in case the loader does not 
implement this method, wouldn't it make sense to put that in in the loader 
itself for standalone use?

--
messages: 404913
nosy: FFY00, brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
status: open
title: NamespaceLoader does not implement create_module or exec_module

___
Python tracker 

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



[issue45591] PathFinder does not find namespace packages children

2021-10-23 Thread Filipe Laíns

New submission from Filipe Laíns :

```
$ tree namespace
namespace/
└── a.py

0 directories, 1 file
```

```
$ ./python
Python 3.9.7 (default, Oct 10 2021, 15:13:22)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.machinery import PathFinder
>>> PathFinder.find_
PathFinder.find_distributions(  PathFinder.find_module( 
PathFinder.find_spec(
>>> PathFinder.find_spec('namespace')
ModuleSpec(name='namespace', loader=None, 
submodule_search_locations=_NamespacePath(['/home/anubis/git/cpython/namespace']))
>>> PathFinder.find_spec('namespace.a')
```

Currently, it is unable to find namespace.a, but it should:

```
Python 3.11.0a1+ (heads/main:9e05da6224, Oct 23 2021, 20:36:14) [GCC 11.1.0] on 
linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.machinery import PathFinder
>>> spec = PathFinder.find_spec('namespace')
>>> spec.loader.load_module('namespace.a')
:283: DeprecationWarning: the load_module() method 
is deprecated and slated for removal in Python 3.12; use exec_module() instead
)>
```

I can make a PR, but just wanted to make sure the current behavior is not 
intended.

--
messages: 404912
nosy: FFY00, brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
status: open
title: PathFinder does not find namespace packages children

___
Python tracker 

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



[issue3445] Ignore missing attributes in functools.update_wrapper

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue6785] IncompleteRead / BadStatus when parsing http://peakoil.mobi

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue22097] Linked list API for ordereddict

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue22086] Tab indent no longer works in interpreter

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue22090] Decimal and float formatting treat '%' differently for infinities and nans.

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue40350] modulefinder chokes on numpy - dereferencing None in spec.loader

2021-10-23 Thread Filipe Laíns

Filipe Laíns  added the comment:

I opened up a new PR that should fix this properly. The root issue was that 
PathFinder was not setting the loader attribute for namespace packages in the 
spec, which it should. After fixing that, _find_module just needed to be 
updated to deal with NamespaceLoader.

```
$ tree namespace
namespace/
└── a.py

0 directories, 1 file
$ cat test-bpo-40350.py
import namespace.a
```

```
$ ./python
Python 3.11.0a1+ (heads/main:9e05da6224, Oct 23 2021, 20:36:14) [GCC 11.1.0] on 
linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import modulefinder
>>> modulefinder.ModuleFinder('test-bpo-40350.py')

>>> f = modulefinder.ModuleFinder('test-bpo-40350.py')
>>> f.
KeyboardInterrupt
>>> m = modulefinder.ModuleFinder()
>>> f = modulefinder.ModuleFinder()
>>> f.run_script('test-bpo-40350.py')
>>> f.modules.items()
dict_items([('__main__', Module('__main__', 'test-bpo-40350.py')), 
('namespace', Module('namespace', 
_NamespacePath(['/home/anubis/git/cpython/namespace'])))])
```

Previously:
```
$ python
Python 3.9.7 (default, Oct 10 2021, 15:13:22)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import modulefinder
>>> f = modulefinder.ModuleFinder()
>>> f.run_script('test-bpo-40350.py')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.9/modulefinder.py", line 161, in run_script
self.load_module('__main__', fp, pathname, stuff)
  File "/usr/lib/python3.9/modulefinder.py", line 357, in load_module
self.scan_code(co, m)
  File "/usr/lib/python3.9/modulefinder.py", line 430, in scan_code
self._safe_import_hook(name, m, fromlist, level=0)
  File "/usr/lib/python3.9/modulefinder.py", line 375, in _safe_import_hook
self.import_hook(name, caller, level=level)
  File "/usr/lib/python3.9/modulefinder.py", line 173, in import_hook
q, tail = self.find_head_package(parent, name)
  File "/usr/lib/python3.9/modulefinder.py", line 229, in find_head_package
q = self.import_module(head, qname, parent)
  File "/usr/lib/python3.9/modulefinder.py", line 316, in import_module
fp, pathname, stuff = self.find_module(partname,
  File "/usr/lib/python3.9/modulefinder.py", line 508, in find_module
return _find_module(name, path)
  File "/usr/lib/python3.9/modulefinder.py", line 77, in _find_module
if spec.loader.is_package(name):
AttributeError: 'NoneType' object has no attribute 'is_package'
```

--

___
Python tracker 

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



[issue21740] doctest doesn't allow duck-typing callables

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue21710] --install-base option ignored?

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue22098] Behavior of Structure inconsistent with BigEndianStructure when using __slots__

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue40350] modulefinder chokes on numpy - dereferencing None in spec.loader

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
pull_requests: +27465
pull_request: https://github.com/python/cpython/pull/29196

___
Python tracker 

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



[issue21724] resetwarnings doesn't reset warnings registry

2021-10-23 Thread Yoann Aubineau


Change by Yoann Aubineau :


--
nosy:  -yaubi

___
Python tracker 

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



[issue45511] Batch-mode input() limited to 4095 characters on *NIX

2021-10-23 Thread Grégory Starck

Grégory Starck  added the comment:

reproduced and also seen in my_fgets.

but strange. it's fgets that seems to return/insert a \n after 4096 chars read 
from stdin :O I dont quite get. at all haha.

now just straced that.. we see 4 read of 1024 bytes/chars. 

and with strace -s 1025 I can see the last one : 

read(0, 
"AAA\n",
 1024) = 1024

so it's a prob in copy/paste of OS or something ?

--
nosy: +g.sta...@gmail.com
versions: +Python 3.10, 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



[issue45586] Use starred expressions in list indices

2021-10-23 Thread Jacob Nilsson


Jacob Nilsson  added the comment:

Oh yeah, the reason lists don't allow the starred expression has nothing to do 
with the starred expression itself, it's syntactically correct and in your case 
a[1, *[2, 3], 4] is equivalent to a[1, 2, 3, 4]. The "problem" is that lists do 
not allow indexing by tuples.

Perhaps the title of this issue should be changed to reflect that: "Allow lists 
to be indexed by tuples"

--

___
Python tracker 

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



[issue45586] Use starred expressions in list indices

2021-10-23 Thread Jacob Nilsson


Jacob Nilsson  added the comment:

I don't understand, do you mean that lists should work like in your example? Or 
that your example code doesn't run?

If you mean the first issue, that is ok I guess but I've never used indexing 
like that outside of numpy, pandas and the like.

If you mean the second issue, it doesn't run because you are indexing a 0-dim 
array with 4 indices, if you instead try with a 1-dim array:

>>> import numpy as np
>>> a = np.array([0]) # 1-dim array instead of 0-dim
>>> print(a[[0, *[0, 0], 0]])
[0, 0, 0, 0]

You get the expected output.

--
nosy: +ajoino

___
Python tracker 

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



[issue45524] Cross-module dataclass inheritance breaks get_type_hints

2021-10-23 Thread Sergei Lebedev


Sergei Lebedev  added the comment:

Is it worth filing a separate issue for locals()? 

In my experience local classes are less common than cross-module inheritance, 
so I suspect that the chances of someone accidentally hitting lack of locals() 
forwarding are quite low. However, given how confusing the error message is, it 
might be worth having an issue for that. Wdyt?

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-23 Thread Christian Heimes


Christian Heimes  added the comment:

The trick would move the math function back into the core. Mark moved the math 
functions out of the core on purpose, see bpo-7518.

--

___
Python tracker 

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



[issue45590] distutils: Upload failed (400): Invalid value for blake2_256_digest

2021-10-23 Thread Christian Heimes


Christian Heimes  added the comment:

Distutils is deprecated and should no longer be used. Please use twine to 
upload software to PyPI, 
https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html

--

___
Python tracker 

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



[issue45590] distutils: Upload failed (400): Invalid value for blake2_256_digest

2021-10-23 Thread Jakub Wilk


New submission from Jakub Wilk :

My "python3 setup.py sdist upload" failed with:

  Upload failed (400): Invalid value for blake2_256_digest. Error: Use a valid, 
hex-encoded, BLAKE2 message digest.

Apparently this is because distutils uses wrong digest size for Blake2:
https://github.com/pypa/distutils/issues/25

--
components: Distutils
messages: 404904
nosy: christian.heimes, dstufft, eric.araujo, jwilk
priority: normal
severity: normal
status: open
title: distutils: Upload failed (400): Invalid value for blake2_256_digest
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



[issue11602] python-config code should be in sysconfig

2021-10-23 Thread Filipe Laíns

Filipe Laíns  added the comment:

I can help out, but would like to wait until we get a resolution in GH-25718 as 
it will likely conflict.

--

___
Python tracker 

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



[issue11602] python-config code should be in sysconfig

2021-10-23 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t have specific expertise in this, so please take it!

--
assignee: eric.araujo -> nanjekyejoannah
components: +Build -Distutils2, Library (Lib)
nosy:  -alexis, tarek
versions: +Python 3.11 -Python 3.3

___
Python tracker 

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



[issue33439] python-config.py should be part of the stdlib

2021-10-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

It seems it could be moved to sysconfig itself -- the CLI options from 
python-config would fit there nicely.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-23 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 23.10.2021 20:04, Christian Heimes wrote:
> 
> PR GH-29179 or GH-29181 address the issue with _math.o

I think those patches are both taking things a bit too far.

This is a build problem, not a code problem. It's perfectly
good style to link a single file to multiple other object files
instead of copying the code into those object files.

The catch is that the makesetup logic is not smart enough to only
include the necessary Makefile line once.

The entry in Makefile.pre.in should not be needed, since the logic
for building math and cmath modules already exists in setup.py.

BTW: There's a simple trick to avoid the makesetup issue: simply
add the _math.c entry to some other module which is always linked
statically, e.g. _stat, and remove it from both math and cmath
entries in Setup, as well as the Makefile.pre.in.

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-23 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

I'm using a very simple conditional logic in Setup, which is based
on sed, mostly to add platform specific variables:

In Setup:

# @if macosx: TIME_DEFS=
# @if not macosx: TIME_DEFS=-lrt
time -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal timemodule.c
$(TIME_DEFS) # -lm # time operations and variables

In Makefile:

# Install the custom Modules/Setup file
if test "$(MACOSX_PLATFORM)"; then \
sed -e 's/# @if macosx: *//' \
$(PYRUNDIR)/$(MODULESSETUP) > 
$(PYTHONDIR)/Modules/Setup; \
elif test "$(FREEBSD_PLATFORM)"; then \
sed -e 's/# @if freebsd: *//' \
$(PYRUNDIR)/$(MODULESSETUP) > 
$(PYTHONDIR)/Modules/Setup; \
else \
sed -e 's/# @if not macosx: *//' \
-e 's/# @if not freebsd: *//' \
$(PYRUNDIR)/$(MODULESSETUP) > 
$(PYTHONDIR)/Modules/Setup; \
fi;

Setup used to be templated as well in the past, but that logic was removed
at some point. Perhaps it's time to reintroduce it.

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-23 Thread Christian Heimes


Christian Heimes  added the comment:

PR GH-29179 or GH-29181 address the issue with _math.o

PR GH-29164 adds the missing modules and also introduces pkg-config lookups for 
dependencies.

Brett and I discussed that we have to introduce conditionals to Modules/Setup 
to make use of the AM_CONDITIONALs from PR GH-29164. We also have to figure out 
how to deal with system-libmpdec and system-cffi.

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-23 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

FYI: I've been working with a fixed Setup file in PyRun for a long while. There 
are indeed a number of modules missing from Setup, since the whole logic was 
left behind a bit after things moved to setup.py.

The issue with _math.o is actually in the main Makefile.pre.in. The version 
listed there does not match the Makefile lines added via Setup. For PyRun, I 
had to comment out the one in Makefile.pre.in and then only add one instance to 
the math module and not the cmath one. This avoids a (harmless) warning during 
the build.

I'm not sure what the _math.o entry exists in Makefile.pre.in. It's only needed 
by those two modules, AFAIK.

Here's the list of modules I had to add in the past (taken from the 3.10 port):

"""
### Built-in extensions for which there are no entries in Setup.dist/Setup:

# _decimal needs more complex setup, punting on this for now
#DECIMAL_DEFS=-DCONFIG_64=1 -DASM=1
#_decimal \
#   _decimal/_decimal.c \
#   _decimal/libmpdec/basearith.c \
#   _decimal/libmpdec/constants.c \
#   _decimal/libmpdec/context.c \
#   _decimal/libmpdec/convolute.c \
#   _decimal/libmpdec/crt.c \
#   _decimal/libmpdec/difradix2.c \
#   _decimal/libmpdec/fnt.c \
#   _decimal/libmpdec/fourstep.c \
#   _decimal/libmpdec/io.c \
#   _decimal/libmpdec/memory.c \
#   _decimal/libmpdec/mpdecimal.c \
#   _decimal/libmpdec/numbertheory.c \
#   _decimal/libmpdec/sixstep.c \
#   _decimal/libmpdec/transpose.c \
#   $(DECIMAL_DEFS) \
#   -I$(srcdir)/Modules/_decimal \
#   -I$(srcdir)/Modules/_decimal/libmpdec \
#   -I$(prefix)/include -L$(exec_prefix)/lib

# _opcode
_opcode _opcode.c

# _ctypes needs to build libffi first - punting on this

# _lsprof
_lsprof _lsprof.c rotatingtree.c

# _sqlite3
SQLITE_DEFS=-DMODULE_NAME='"sqlite3"' -DSQLITE_OMIT_LOAD_EXTENSION
# @if freebsd: SQLITE_LIBS=-I/usr/local/include -L/usr/local/lib
# @if not freebsd: SQLITE_LIBS=
_sqlite3 \
_sqlite/module.c \
_sqlite/cache.c \
_sqlite/connection.c \
_sqlite/cursor.c \
_sqlite/microprotocols.c \
_sqlite/prepare_protocol.c \
_sqlite/row.c \
_sqlite/statement.c \
_sqlite/util.c \
$(SQLITE_DEFS) -I$(srcdir)/Modules/_sqlite \
$(SQLITE_LIBS) \
-I$(prefix)/include -L$(exec_prefix)/lib \
-lsqlite3

# bz2
_bz2 _bz2module.c -lbz2

# lzma
#
# Note: Adding this can cause serious issues, since the needed lib isn't
# universally installed everywhere. See #1793 and #1794.
#
#_lzma _lzmamodule.c -llzma

# multiprocessing
_multiprocessing \
_multiprocessing/semaphore.c \
_multiprocessing/multiprocessing.c \
-I$(srcdir)/Modules/_multiprocessing

# Optional add-on for multiprocessing to use shared memory
#POSIXSHMEM_LIBS=rt
POSIXSHMEM_LIBS=
_posixshmem \
_multiprocessing/posixshmem.c \
-I$(srcdir)/Modules/_multiprocessing \
$(POSIXSHMEM_LIBS)

# queue
_queue _queuemodule.c
"""

Not all modules are included, since I did not need all missing ones.

--
nosy: +lemburg

___
Python tracker 

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



[issue45589] webbrowser does not handle opens under Windows WSL properly

2021-10-23 Thread Guido F


New submission from Guido F :

The 'webbrowser' module throws warnings and bad RC codes when running under 
Windows Subsystem for Linux (WSL).

This causes libraries that depend on the 'webbrowser' module to mistakenly 
assume there's been an error opening a URL. An example of this behaviour can be 
observed running `jupyter-lab` under WSL.

Steps to reproduce:
1. Run Ubuntu (for example) under Windows WSL.
2. `python -m webbrowser https://www.python.org`

Expected result:

The wesite opens.

Actual result:

The website opens but produces a `No valid TTY` message, which also yields a 
non-zero return code.

I have a patch for this bug that inspects the kernel version (platform.uname) 
and detects WSL. This is a similar solution that other projects have 
implemented to tackle this problem. For example, the fish shell project: 
https://github.com/fish-shell/fish-shell/blob/0e06a53dff5e198c4fcefb6419a53cf1267231a1/share/functions/help.fish#L83.

--
components: Windows
messages: 404896
nosy: guido.fioravantti, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: webbrowser does not handle opens under Windows WSL properly
type: enhancement

___
Python tracker 

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



[issue40899] Document exceptions raised by importlib.import

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue45364] Add more documentation for ModuleSpec.loader_state.

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue45272] 'os.path' should not be a frozen module

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue45020] Freeze all modules imported during startup.

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue22789] Compress the marshalled data in PYC files

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue1353344] python.desktop

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue11602] python-config code should be in sysconfig

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

See also:  
https://docs.python.org/3/faq/programming.html#how-do-i-cache-method-calls

--

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

AFAICT, the only capability added by the PR is keeping a weak reference to the 
instance.

This doesn't improve the hit rate and will make the hit rate worse for 
instances that define __hash__.  In the PR's example, two vector instances with 
equal coordinates would not be recognized as being equivalent.  Note, 
dataclasses make it trivially easy to add custom __eq__ and __hash__ support.

Users also lose the ability to limit maximum memory utilization.  Managing the 
combined size of many caches, one per instance, is much more difficult that 
setting an automatic maxsize limit on a single lru_cache.

Users further lose the ability to clear the entire cache all at once.  This can 
be important in testing.

AFAICT, the only benefit is that short-lived instances will be freed earlier 
than if they waited to age out of an lru_cache.  This would only ever matter if 
the instances were large, short-lived, and would never have other equivalent 
instances that could create a cache hit.

Lastly, I don't like the example given in the docs for the PR.  We really want 
the class to define __hash__ and __eq__ methods.  This doesn't just improve the 
hit rate, it is also necessary for avoiding bugs.  If the coordinates gets 
mutate, the cache has no way of knowing that its entry is invalid:
   
v = Vector(10, 20, 30)
print(v.norm())
v.coordinates = (11, 22, 33)
print(v.norm())

--
nosy: +rhettinger

___
Python tracker 

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



[issue45580] argparse.ArgumentParser.add_mutually_exclusive_group : metavar create parenthesis undefined behavior

2021-10-23 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Maybe instead we can show users something like:

```
usage: ex.py [-h] (-p '/var/www/html' | -r 'http)s(://Host:Port') [--last-args 
LAST_ARGS]
```

?

--
components: +Library (Lib) -Parser
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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Hai Shi


Hai Shi  added the comment:

> PEP 3121 is not withdrawn; PEP 630 is not withdrawn. What is then expected of 
> a new PEP? Or the other way around: what is missing from those two PEPs?

Thanks Erlend for the relative information you provided. AFAIK, the stdlib is 
not the extension module strictly :)

--

___
Python tracker 

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



[issue45580] argparse.ArgumentParser.add_mutually_exclusive_group : metavar create parenthesis undefined behavior

2021-10-23 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

I confirm this happens on all recent Python versions.

The source of this problem is that `argparse` uses `regex` module to replace 
some substrings. Direct link: 
https://github.com/python/cpython/blame/8ce20bbdd6d2b1277a5e74154fcdcef2cb0fee49/Lib/argparse.py#L487

Quick debug showed that without this line these tests fail:

```
==
FAIL: test_help_when_required 
(test.test_argparse.TestMutuallyExclusiveFirstSuppressed)
--
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_argparse.py", line 2649, 
in test_help_when_required
self.assertEqual(format_help(), textwrap.dedent(help))
^^
AssertionError: 'usage: PROG [-h] (-y)\n\noptions:\n  -h, --help  show this[42 
chars]lp\n' != 'usage: PROG [-h] -y\n\noptions:\n  -h, --help  show this h[40 
chars]lp\n'
- usage: PROG [-h] (-y)
?  -  -
+ usage: PROG [-h] -y
  
  options:
-h, --help  show this help message and exit
-y  y help


==
FAIL: test_usage_when_required 
(test.test_argparse.TestMutuallyExclusiveFirstSuppressed)
--
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_argparse.py", line 2639, 
in test_usage_when_required
self.assertEqual(format_usage(), textwrap.dedent(expected_usage))
^
AssertionError: 'usage: PROG [-h] (-y)\n' != 'usage: PROG [-h] -y\n'
- usage: PROG [-h] (-y)
?  -  -
+ usage: PROG [-h] -y


==
FAIL: test_help_when_required 
(test.test_argparse.TestMutuallyExclusiveFirstSuppressedParent)
--
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_argparse.py", line 2649, 
in test_help_when_required
self.assertEqual(format_help(), textwrap.dedent(help))
^^
AssertionError: 'usage: PROG [-h] (-y)\n\noptions:\n  -h, --help  show this[42 
chars]lp\n' != 'usage: PROG [-h] -y\n\noptions:\n  -h, --help  show this h[40 
chars]lp\n'
- usage: PROG [-h] (-y)
?  -  -
+ usage: PROG [-h] -y
  
  options:
-h, --help  show this help message and exit
-y  y help


==
FAIL: test_usage_when_required 
(test.test_argparse.TestMutuallyExclusiveFirstSuppressedParent)
--
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_argparse.py", line 2639, 
in test_usage_when_required
self.assertEqual(format_usage(), textwrap.dedent(expected_usage))
^
AssertionError: 'usage: PROG [-h] (-y)\n' != 'usage: PROG [-h] -y\n'
- usage: PROG [-h] (-y)
?  -  -
+ usage: PROG [-h] -y


--
Ran 1672 tests in 23.258s

FAILED (failures=4)
test test_argparse failed
test_argparse failed (4 failures)

== Tests result: FAILURE ==

1 test failed:
test_argparse

Total duration: 25.6 sec
Tests result: FAILURE
```

--
nosy: +sobolevn

___
Python tracker 

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



[issue45516] Add protocol description to the Traversable and TraversableResources documentation

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
pull_requests: +27464
pull_request: https://github.com/python/cpython/pull/29194

___
Python tracker 

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



[issue21724] resetwarnings doesn't reset warnings registry

2021-10-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@Julian Am leaning more into us applying a relevant fix, than adjusting the 
documentation.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Marten Lienen


Marten Lienen  added the comment:

However, then the user gets error messages mentioning cached_property when they 
are actually using cached_method.

--

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Marten Lienen


Marten Lienen  added the comment:

An implementation based on cached_property (that therefore also inherits its 
locking problem) that does not create a circular reference and copies 
attributes (docs etc.) from the decorated function would be as follows (based 
on the WeaklyBoundMethod from this PR).

def cached_method_inner(func, lru_args):
lru_args.setdefault("maxsize", None)
def binder(self):
method = WeaklyBoundMethod(func.__get__(self))
cache = lru_cache(**lru_args)
cached = cache(method)
update_wrapper(cached, func)
return cached
prop = cached_property(binder)
update_wrapper(prop, func)
return prop

def cached_method(func=None, /, **lru_args):
if func is not None:
return cached_method_inner(func, lru_args)
else:
def decorator(late_func):
return cached_method_inner(late_func, lru_args)
return decorator

--

___
Python tracker 

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



[issue45516] Add protocol description to the Traversable and TraversableResources documentation

2021-10-23 Thread Jason R. Coombs

Jason R. Coombs  added the comment:


New changeset 8ce20bbdd6d2b1277a5e74154fcdcef2cb0fee49 by Filipe Laíns in 
branch 'main':
bpo-45516: add protocol description to the TraversableResources documentation 
(#29173)
https://github.com/python/cpython/commit/8ce20bbdd6d2b1277a5e74154fcdcef2cb0fee49


--

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Marten Lienen


Marten Lienen  added the comment:

@serhiy.storchaka The simple implementation is very simple but does not allow 
overwriting the arguments to `lru_cache` and, probably more importantly, 
creates a circular reference on `self`, I believe.

--

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Marten Lienen


Marten Lienen  added the comment:

@AlexWaygood No, I was not aware of the problems. I have updated the PR by 
removing the lock entirely. Since the function has to be cacheable, it should 
be idempotent anyway, so that executing it multiple times in parallel does not 
make a program incorrect. This was also suggested as the a-priori best approach 
in the linked issue.

--

___
Python tracker 

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



[issue33439] python-config.py should be part of the stdlib

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue11602] python-config code should be in sysconfig

2021-10-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@eric.araujo curious if you still have the interest to work on this. If not, I 
can help open a PR.

--

___
Python tracker 

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



[issue33439] python-config.py should be part of the stdlib

2021-10-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I posted on Python-dev (not sure if it will help), I wanted to do this in 2019 
but looks like there is still no consensus yet.

--

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The simple implementation is:

def cached_method(func):
return cached_property(lambda self: lru_cache()(partial(func, self)))

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19867] pickletools.OpcodeInfo.code is a string

2021-10-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I changed to won't fix due to the note on incompatibility, until we resolve on 
a way forward.

--
nosy: +nanjekyejoannah
resolution:  -> wont fix

___
Python tracker 

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



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-10-23 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

For me it works as well, tested on 3.7, 3.9 and 3.11 .

--
nosy: +andrei.avk

___
Python tracker 

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



[issue14067] Avoid more stat() calls in importlib

2021-10-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Related : https://bugs.python.org/issue14067

--

___
Python tracker 

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



[issue14067] Avoid more stat() calls in importlib

2021-10-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I wonder if the circumstances changed since this is an old issue? the method 
looks to have a deprecation warning and changed a bit too, I stand to be 
corrected.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue15795] Zipfile.extractall does not preserve file permissions

2021-10-23 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I left a review on the PR requesting for some tests, if it makes sense.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue2733] mmap resize fails on anonymous memory

2021-10-23 Thread Tim Golden


Change by Tim Golden :


--
resolution: later -> duplicate
superseder:  -> multiple problems with mmap.resize()  in Windows

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Alex Waygood


Alex Waygood  added the comment:

Are you aware of the previously reported problems with `cached_property`? 
https://bugs.python.org/issue43468

--
nosy: +AlexWaygood

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Oh, I found PEP 3121 (Extension Module Initialization and Finalization). It is 
a Standards Track PEP and it is accepted.

The abstract is pretty short. Let me just repost it here, for convenience:

  Extension module initialization currently has a few deficiencies. There is
  no cleanup for modules, the entry point name might give naming conflicts,
  the entry functions don't follow the usual calling convention, and multiple
  interpreters are not supported well. This PEP addresses these issues.


Quoting from the Specification section of that PEP:

  The initialization routine will be invoked once per interpreter, when the
  module is imported. It should return a new module object each time.

  In order to store per-module state in C variables, each module object will
  contain a block of memory that is interpreted only by the module. The amount
  of memory used for the module is specified at the point of creation of the
  module.

  [...]

  As all Python objects should be controlled through the Python memory
  management, usage of "static" type objects is discouraged, unless the type
  object itself has no memory-managed state.


PEP 3121 is not withdrawn; PEP 630 is not withdrawn. What is then expected of a 
new PEP? Or the other way around: what is missing from those two PEPs? AFAICT, 
PEP wise, everything is arranged and ready. Perhaps the SC can chime in and 
explain why another PEP is required? :)


BTW, the SC has actually asked for another _Informational_ PEP, not a Standards 
Track PEP, so I guess a new PEP will be very similar to PEP 630?

--

___
Python tracker 

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



[issue2733] mmap resize fails on anonymous memory

2021-10-23 Thread Tim Golden


Tim Golden  added the comment:

Superseded by issue40915

--

___
Python tracker 

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



[issue2733] mmap resize fails on anonymous memory

2021-10-23 Thread Tim Golden


Change by Tim Golden :


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



[issue45574] Warning: ‘print_escape’ defined but not used

2021-10-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue45574] Warning: ‘print_escape’ defined but not used

2021-10-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset cadf06eab75c887dfc753ca80ef35cd2a7871135 by Miss Islington (bot) 
in branch '3.10':
bpo-45574: fix warning about `print_escape` being unused (GH-29172) (#29176)
https://github.com/python/cpython/commit/cadf06eab75c887dfc753ca80ef35cd2a7871135


--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Petr:
> Hmm, the best I can find is 
> https://github.com/python/steering-council/blob/main/updates/2021-02-steering-council-update.md#february-08

Perfect, thanks!


Christian: Thanks for your input. If this was a discussion on Discourse, I'd 
press the L key on your message :)

--

___
Python tracker 

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



[issue45587] argparse add_argument_group: distinguish title and description from **kwargs

2021-10-23 Thread SelfAdjointOperator


Change by SelfAdjointOperator :


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

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Marten Lienen


Change by Marten Lienen :


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

___
Python tracker 

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



[issue35957] Indentation explanation is unclear

2021-10-23 Thread Quang Lê Duy

Quang Lê Duy  added the comment:

Reading from the source code (Parser/tokenizer.c from line 1364 as in Python 
3.10), I derive these as the actual indentation rules:
– Tab makes the indentation amount the next multiple of 8.
– Among lines with the same indentation amount in the same parent line, the 
total number of tabs and spaces must match, in other words, the tabs' total 
padded width must be equal.
– If it's an indent, the total number of spaces and tabs must exceed that of 
the parent line.

--
nosy: +leduyquang753

___
Python tracker 

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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Marten Lienen


New submission from Marten Lienen :

There should be a `cached_method` equivalent to `cached_property` so that 
methods of long-lived objects can be cached easily.

--
components: Library (Lib)
messages: 404870
nosy: martenlienen
priority: normal
severity: normal
status: open
title: cached_method similar to cached_property to cache with classes
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



[issue45379] Improve errors related to frozen modules.

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
pull_requests: +27461
pull_request: https://github.com/python/cpython/pull/29190

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Christian Heimes


Christian Heimes  added the comment:

> Given that some essential third party modules are not going down this path, 
> it is unlikely that general users would ever see any benefit.

I disagree with your statement. It does not reflect my experience, too.

Heap types are a prerequisite for abi3 wheels. In order to get abi3 binary 
wheels, extensions must use the limited API, which means they must use heap 
types. Stable ABI wheels are a great benefit for extension authors, because it 
reduces their build matrix substantially. For instance cryptography's stable 
abi3 wheels work with any Python version >=3.6,<4.

Heap types and stable abi3 are also a major benefit for general users. Once 
Cython and the NumPy stack supports limited API and stable ABI, users no longer 
have to wait on builds for a new Python release. Every new minor release we get 
several bug reports on BPO about NumPy not working on latest release. This will 
go away.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue45587] argparse add_argument_group: distinguish title and description from **kwargs

2021-10-23 Thread SelfAdjointOperator


Change by SelfAdjointOperator :


--
assignee: docs@python
components: Documentation, Library (Lib)
nosy: SelfAdjointOperator, docs@python
priority: normal
severity: normal
status: open
title: argparse add_argument_group: distinguish title and description from 
**kwargs
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



[issue45429] [Windows] time.sleep() should use CREATE_WAITABLE_TIMER_HIGH_RESOLUTION

2021-10-23 Thread Benjamin Szőke

Benjamin Szőke  added the comment:

A similar solution was introduced in VirtualBox some months ago. Soon, i could 
get back my Windows 10 developing PC and i can try this things.

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Runtime/r3/win/timer-win.cpp#L312

--

___
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-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue45379] Improve errors related to frozen modules.

2021-10-23 Thread Filipe Laíns

Change by Filipe Laíns :


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

___
Python tracker 

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



[issue45379] Improve errors related to frozen modules.

2021-10-23 Thread Filipe Laíns

Filipe Laíns  added the comment:

FROZEN_EXCLUDED is set when frozen modules have no code associated with them, 
and the _freeze_module tool doesn't seem to be able to produce such output.

We could remove it and replace it with an assert, but that does not give us 
much benefit, so we should probably leave it be and just document it a little 
bit better.

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue45429] [Windows] time.sleep() should use CREATE_WAITABLE_TIMER_HIGH_RESOLUTION

2021-10-23 Thread Benjamin Szőke

Change by Benjamin Szőke :


--
nosy: +Livius

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-23 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27459
pull_request: https://github.com/python/cpython/pull/29188

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Quoting PEP 630 (active PEP):
>
>   Whenever this PEP mentions extension modules, the advice also applies to
>   built-in modules, such as the C parts of the standard library. The standard
>  library is expected to switch to per-module state early.

Maybe I should remove that part, I didn't expect applying this to stdlib would 
be so fast/rushed.

> Can you please point me to the official SC statement regarding this? I cannot 
> find it.

Hmm, the best I can find is 
https://github.com/python/steering-council/blob/main/updates/2021-02-steering-council-update.md#february-08
It asks for no changes in 3.10 beta (no longer relevant) and a PEP -- 
presumably one specifically for the stdlib; PEP 630 already existed.

PEP 630 works best for new code; applying it to stdlib needs additional 
considerations, e.g. performance impact analysis, and preserving immutability 
or (un)pickleability, which certainly wasn't always tested well and caused much 
trouble late tn the release cycle.

> Please get explicit approval from the SC before continuing to sweep through 
> the code base, creating heap types everywhere.

That would be nice (but myself, I won't be championing that effort any time 
soon).

> Given that some essential third party modules are not going down this path

OTOH, others (like cryptography & Qt) are going down this path, so I'll 
continue improving the support.

--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks, Petr. Yes, that is correct. PEP 630 (I assume you meant 630, not 640) 
still describes the _rationale_ very well. I guess what's needed is a Standards 
Track PEP based on PEP 630 (IIUC).

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-23 Thread Christian Heimes


Christian Heimes  added the comment:

I ran into another problem. In shared mode, Modules/Setup places the shared 
modules in ./Modules/ instead of the build directory ./build/lib.something/. 
The ./Modules/ directory is not on sys.path. getpath.c only adds the build dir 
to sys.path. It takes the value from ./pybuilddir.txt. The file is generated by 
sysconfig.py.

$ make
...
*** WARNING: renaming "_asyncio" since importing it failed: No module named 
'math'

The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc  cmath math   
pwd   time

$ find -name 'math*.so'
./Modules/math.cpython-311-x86_64-linux-gnu.so

--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

Pep 640 is Informational, and per PEP 1:

Informational PEPs do not necessarily represent a Python community consensus or 
recommendation, so users and implementers are free to ignore Informational PEPs 
or follow their advice.

(Will reply more tomorrow, I'm on my phone now)
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

--

___
Python tracker 

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-10-23 Thread E. Paine


E. Paine  added the comment:

It turns out the `test_configure_compound` change was intentional 
(https://core.tcl-lang.org/tk/tktview/46c2f088) and an empty string will use 
the value given by the style ("If set to the empty string (the default)..." 
https://www.tcl.tk/man/tcl/TkCmd/ttk_widget.html#M-compound).

--

___
Python tracker 

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



[issue45563] inspect.getframeinfo() doesn't handle frames without lineno

2021-10-23 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

Hmm, perhaps I should reopen the ticket, even though I now found the cause.

After all, it is possible that lineno is None and inspect.getframeinfo() cannot 
handle it :-)

And it may be worthwhile investigating why recreation of a code object using:

return types.CodeType(co.co_argcount,
  co.co_posonlyargcount,
  co.co_kwonlyargcount,
  co.co_nlocals, co.co_stacksize,
  co.co_flags, co.co_code, co.co_consts,
  co.co_names, co.co_varnames,
  co.co_filename, co.co_name,
  co.co_firstlineno, co.co_lnotab,
  co.co_freevars, co.co_cellvars)

does not necessarily create a valid copy of a code object co.

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

___
Python tracker 

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



[issue45586] Use starred expressions in list indices

2021-10-23 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> enhancement
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue45586] Use starred expressions in list indices

2021-10-23 Thread Peter Tillema


New submission from Peter Tillema :

It would be nice if you could starred expressions in list indices, for example 
this piece of code:

```
import numpy as np

a = np.array(0)
print(a[1, *[2, 3], 4])
```

--
components: Interpreter Core
messages: 404860
nosy: PeterTillema
priority: normal
severity: normal
status: open
title: Use starred expressions in list indices
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



[issue45579] [list.append(i) for i in list] causes high resources usage

2021-10-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is expected behavior. Your code is equivalent to:

_result = []
for i in your_list:
_result.append(your_list.append(i))

which is equivalent to:

_result = []
_j = 0
while _j < len(your_list):
i = your_list[_j]
_result.append(your_list.append(i))
_j += 1

It is an infinite loop (because len(your_list) is increased after 
your_list.append(i)), and two lists grow with every iteration.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45585] Gzipping subprocess output produces invalid .gz file

2021-10-23 Thread Martin Panter


Martin Panter  added the comment:

The subprocess module only uses the file object to get a file handle by calling 
the "fileno" method. See Issue 19992 about documenting this. For Python to 
compress the output of the child process, you would need a pipe.

Gzip file objects provide the "fileno" method, but it just returns the 
underlying file descriptor. Data written to that file descriptor would normally 
already be compressed by Python and goes straight to the OS. There is also 
Issue 24358 opened about whether "fileno" should be implemented.

--
nosy: +martin.panter

___
Python tracker 

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



[issue45531] field "mro" behaves strangely in dataclass

2021-10-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Would not be more correct to look at cls.__dict__[fieldname]?

BTW, mro() cannot be builtin, because you should be able to override it in some 
classes.

--

___
Python tracker 

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



[issue40915] multiple problems with mmap.resize() in Windows

2021-10-23 Thread Tim Golden


Change by Tim Golden :


--
assignee:  -> tim.golden

___
Python tracker 

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



[issue12562] calling mmap twice fails on Windows

2021-10-23 Thread Tim Golden


Tim Golden  added the comment:

(switching stage to resolved because it's closed/rejected; sorry for the noise)

--
stage:  -> resolved

___
Python tracker 

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



[issue2733] mmap resize fails on anonymous memory

2021-10-23 Thread Tim Golden


Tim Golden  added the comment:

https://bugs.python.org/issue40915 is related
Retargetting for 3.10+

--
assignee:  -> tim.golden
versions: +Python 3.10, Python 3.11 -Python 2.7, Python 3.2

___
Python tracker 

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



[issue45391] 3.10 objects.inv classifies UnionType as data

2021-10-23 Thread Dominic Davis-Foster


Change by Dominic Davis-Foster :


--
nosy: +dom1310df

___
Python tracker 

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



[issue40885] Cannot pipe GzipFile into subprocess

2021-10-23 Thread Michael Herrmann


Michael Herrmann  added the comment:

I just encountered what seems to be the inverse problem of this issue: #45585

--
nosy: +mherrmann.at

___
Python tracker 

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



[issue45585] Gzipping subprocess output produces invalid .gz file

2021-10-23 Thread Michael Herrmann


New submission from Michael Herrmann :

Consider the following:

import gzip
import subprocess

with gzip.open('test.gz', 'wb') as f:
subprocess.run(['echo', 'hi'], stdout=f)

with gzip.open('test.gz', 'rb') as f:
print(f.read())

I'd expect "hi" to appear in my console. Instead, I'm getting "OSError: Not a 
gzipped file (b'hi')". I am attaching test.gz.

This appears for me on Debian 10 / Python 3.7 and Debian 11 / Python 3.9. I 
have not yet tested on other OSs and Python versions.

The reason why I expect the above to work is that the subprocess documentation 
states that the stdout parameter may be "an existing file object" and that on 
the other hand the documentation for gzip.open(...) states that it returns a 
file object.

Maybe this is related to #40885?

--
files: test.gz
messages: 404853
nosy: mherrmann.at
priority: normal
severity: normal
status: open
title: Gzipping subprocess output produces invalid .gz file
type: behavior
versions: Python 3.7, Python 3.9
Added file: https://bugs.python.org/file50391/test.gz

___
Python tracker 

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