[issue44150] Add optional weights parameter to statistics.fmean()

2021-05-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue44197] [request feature] Itertools extended combinations to limited number of repetition

2021-05-20 Thread Tim Peters


Change by Tim Peters :


--
nosy: +rhettinger

___
Python tracker 

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



[issue44197] [request feature] Itertools extended combinations to limited number of repetition

2021-05-20 Thread Tim Peters


Tim Peters  added the comment:

Dennis, combinations("aaabbbcccddd") isn't a valid call - the function requires 
a "how many?" argument too. If, e.g., we were asking for groups of 4, then 
combinations("aaabbbcccddd", 4) generates the 4-tuple ('a', 'b', 'c', 'd') 81 
(3**4) times, while the OP presumably only wants to get it once.

OTOH, combinations_with_replacement("abcd", 4) can generate tuples with more 
than 3 repetitions of a given element.

The linked StackOverflow entry gives an efficient "real solution", but I agree 
with its author's final comment: "It is much too specialized for itertools". 
Indeed, it seems too obscure and special-purpose to me to even qualify as a 
reasonable candidate for an itertools doc "recipe".

--
nosy: +tim.peters

___
Python tracker 

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



[issue14965] super() and property inheritance behavior

2021-05-20 Thread Will Razen


Will Razen  added the comment:

Fixed superprop.py workaround, now works with multiple inheritance and follows 
mro adequately. Renamed to duper.py as inspired by Torsten. Uploading here and 
also to https://gist.github.com/willrazen/bef3fcb26a83dffb6692e5e10d3e67ac

--
Added file: https://bugs.python.org/file50057/duper.py

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +24883
pull_request: https://github.com/python/cpython/pull/26277

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +24882
pull_request: https://github.com/python/cpython/pull/26276

___
Python tracker 

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



[issue44199] code example index error in tutorial controlflow

2021-05-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

The example is correct. The result is sorted by the second item (index=1) of 
each tuple:

four
one
three
two

Maybe the text could make it more clear that that's the desired output.

--
nosy: +eric.smith

___
Python tracker 

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



[issue44194] Folding ''.join() into f-strings

2021-05-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

To be pedantic, f-strings don't "cast" to a string, they call format(obj) on 
the argument. Typically this is the same as str(obj), but it need not be. I 
guess if all of the arguments are already exact strings then this distinction 
doesn't matter, but I'd have to give it some more thought.

I've never seen the pattern of joining a fixed size list, but I guess it exists 
in the wild. I'm skeptical that this optimization is worth doing. We should 
check on a real-world benchmark instead of a micro benchmark.

--

___
Python tracker 

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



[issue44201] REPL requests another line despite syntax error

2021-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Unfortunately this happens because to generate the error message we check for 
the equal and the right hand side of the equal (to also discard some false 
positives) and this triggers the parser to ask for additional tokens. Notice 
that you don't need to close the ']', just provide an additional token:

>>> x = [x=4
... f
  File "", line 1
x = [x=4
 ^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?

Unfortunately is not going to be easy to solve without looking at the right 
hand side :(

--

___
Python tracker 

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



[issue44120] logging.config.fileConfig/dictConfig can not import class

2021-05-20 Thread Hiroaki Mizuguchi


Hiroaki Mizuguchi  added the comment:

bar module use logging module of stdlib not bar.logging module in this test 
case.

change the statement to `from . import logging` is not a solution.

--

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +24881
stage: commit review -> patch review
pull_request: https://github.com/python/cpython/pull/26275

___
Python tracker 

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



[issue44202] Add errors argument to importlib.abc.Traversable.read_text

2021-05-20 Thread Filipe Laíns

Filipe Laíns  added the comment:

I am gonna wait until/if GH-26272 (#44196) gets merged to submit a PR because 
it will conflict with that.

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



[issue44202] Add errors argument to importlib.abc.Traversable.read_text

2021-05-20 Thread Filipe Laíns

New submission from Filipe Laíns :

errors should be supported by Traversable.open and is currently supported in 
importlib.resources.open_text, but Traversable.read_text cannot do it, making 
it an unsuitable replacement for open_text.

--
messages: 394088
nosy: FFY00, brett.cannon, jaraco
priority: normal
severity: normal
status: open
title: Add errors argument to importlib.abc.Traversable.read_text

___
Python tracker 

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



[issue44201] REPL requests another line despite syntax error

2021-05-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +lys.nikolaou, pablogsal

___
Python tracker 

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



[issue44201] REPL requests another line despite syntax error

2021-05-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +3.10regression

___
Python tracker 

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



[issue44201] REPL requests another line despite syntax error

2021-05-20 Thread Guido van Rossum


New submission from Guido van Rossum :

This seems a regression from 3.9.

>>> foo[x = 1
... ]
  File "", line 1
foo[x = 1
^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
>>>

Note how the syntax error is in line 1 and yet the REPL asks for more input 
(the "..." prompt) and doesn't stop until I type "]".

In 3.9 I just get "SyntaxError: invalid syntax" but the REPL doesn't ask for 
the second line:

>>> foo[x = 1
  File "", line 1
foo[x = 1
  ^
SyntaxError: invalid syntax
>>>

--
messages: 394087
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: REPL requests another line despite syntax error
type: compile error
versions: Python 3.10

___
Python tracker 

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



[issue44200] Recommend importlib.abc.Traversable users to implement __fspath__

2021-05-20 Thread Filipe Laíns

Change by Filipe Laíns :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

Valgrind detects the bug (unmodified Python):

$ PYTHONMALLOC=debug valgrind ./python ref.py 
(...)
==607098== Invalid read of size 8
==607098==at 0x493FBE: subtype_dealloc (typeobject.c:1456)
==607098==by 0x47C914: _Py_Dealloc (object.c:2288)
==607098==by 0x45F6BF: _Py_DECREF (object.h:500)
==607098==by 0x45F70D: _Py_XDECREF (object.h:567)
==607098==by 0x4654F5: dict_dealloc (dictobject.c:2068)
==607098==by 0x47C914: _Py_Dealloc (object.c:2288)
==607098==by 0x668EBE: _Py_DECREF (object.h:500)
==607098==by 0x66E8BE: ast_dealloc (Python-ast.c:764)
==607098==by 0x493FB9: subtype_dealloc (typeobject.c:1450)
(...)

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ok, I got a crash under the address sanitizer using ref.py:

 ./python lel.py
exit
Cycle.__del__
Cycle.__del__
=
==77503==ERROR: AddressSanitizer: heap-use-after-free on address 0x6195a638 
at pc 0x55a491f59376 bp 0x7fff8b27cd10 sp 0x7fff8b27cd00
READ of size 8 at 0x6195a638 thread T0
#0 0x55a491f59375 in subtype_dealloc Objects/typeobject.c:1456
#1 0x55a491ebb5e4 in _Py_DECREF Include/object.h:500
#2 0x55a491ebb5e4 in _Py_XDECREF Include/object.h:567
#3 0x55a491ebb5e4 in list_dealloc Objects/listobject.c:342
#4 0x55a491eebe44 in _Py_DECREF Include/object.h:500
#5 0x55a491eebe44 in _Py_XDECREF Include/object.h:567
#6 0x55a491eebe44 in dict_dealloc Objects/dictobject.c:2068
#7 0x55a492305eec in _Py_DECREF Include/object.h:500
#8 0x55a492305eec in ast_dealloc Python/Python-ast.c:764
#9 0x55a491f59065 in subtype_dealloc Objects/typeobject.c:1450
#10 0x55a491eebe44 in _Py_DECREF Include/object.h:500
#11 0x55a491eebe44 in _Py_XDECREF Include/object.h:567
#12 0x55a491eebe44 in dict_dealloc Objects/dictobject.c:2068
#13 0x55a492305eec in _Py_DECREF Include/object.h:500
#14 0x55a492305eec in ast_dealloc Python/Python-ast.c:764
#15 0x55a491f59065 in subtype_dealloc Objects/typeobject.c:1450
#16 0x55a491ebb5e4 in _Py_DECREF Include/object.h:500
#17 0x55a491ebb5e4 in _Py_XDECREF Include/object.h:567
#18 0x55a491ebb5e4 in list_dealloc Objects/listobject.c:342
#19 0x55a491eebe44 in _Py_DECREF Include/object.h:500
#20 0x55a491eebe44 in _Py_XDECREF Include/object.h:567
#21 0x55a491eebe44 in dict_dealloc Objects/dictobject.c:2068
#22 0x55a492305e1f in _Py_DECREF Include/object.h:500
#23 0x55a492305e1f in ast_clear Python/Python-ast.c:782
#24 0x55a49216367b in delete_garbage Modules/gcmodule.c:1017
#25 0x55a49216367b in gc_collect_main Modules/gcmodule.c:1300
#26 0x55a492165fe5 in _PyGC_CollectNoFail Modules/gcmodule.c:2123
#27 0x55a492105745 in interpreter_clear Python/pystate.c:326
#28 0x55a4920f5565 in finalize_interp_clear Python/pylifecycle.c:1634
#29 0x55a4920fa882 in Py_FinalizeEx Python/pylifecycle.c:1812
#30 0x55a491e72870 in Py_RunMain Modules/main.c:668
#31 0x55a491e72870 in pymain_main Modules/main.c:696
#32 0x55a491e72870 in Py_BytesMain Modules/main.c:720
#33 0x7f772d82eb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#34 0x55a491e6ec2d in _start 
(/home/pablogsal/github/python/master/python+0x174c2d)
0x6195a638 is located 184 bytes inside of 944-byte region 
[0x6195a580,0x6195a930)
freed by thread T0 here:
#0 0x7f772dbfaf19 in __interceptor_free 
/build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:127
#1 0x55a491f5466e in type_dealloc Objects/typeobject.c:4041
#2 0x55a491f59065 in subtype_dealloc Objects/typeobject.c:1450
#3 0x55a491ebb5e4 in _Py_DECREF Include/object.h:500
#4 0x55a491ebb5e4 in _Py_XDECREF Include/object.h:567
#5 0x55a491ebb5e4 in list_dealloc Objects/listobject.c:342
#6 0x55a491eebe44 in _Py_DECREF Include/object.h:500
#7 0x55a491eebe44 in _Py_XDECREF Include/object.h:567
#8 0x55a491eebe44 in dict_dealloc Objects/dictobject.c:2068
#9 0x55a492305eec in _Py_DECREF Include/object.h:500
#10 0x55a492305eec in ast_dealloc Python/Python-ast.c:764
#11 0x55a491f59065 in subtype_dealloc Objects/typeobject.c:1450
#12 0x55a491eebe44 in _Py_DECREF Include/object.h:500
#13 0x55a491eebe44 in _Py_XDECREF Include/object.h:567
#14 0x55a491eebe44 in dict_dealloc Objects/dictobject.c:2068
#15 0x55a492305eec in _Py_DECREF Include/object.h:500
#16 0x55a492305eec in ast_dealloc Python/Python-ast.c:764
#17 0x55a491f59065 in subtype_dealloc Objects/typeobject.c:1450
#18 0x55a491ebb5e4 in _Py_DECREF Include/object.h:500
#19 0x55a491ebb5e4 in _Py_XDECREF Include/object.h:567
#20 0x55a491ebb5e4 in list_dealloc Objects/listobject.c:342
#21 0x55a491eebe44 in _Py_DECREF Include/object.h:500
#22 0x55a491eebe44 in _Py_XDECREF Include/object.h:567
#23 0x55a491eebe44 in dict_dealloc Objects/dictobject.c:2068
#24 0x55a492305e1f in _Py_DECREF Include/object.h:500
#25 0x55a492305e1f in ast_clear Python/Python-ast.c:782
#26 0x55a49216367b in delete_garbage Modules/gcmodule.c:1017
#27 0x55a49216367b in gc_collect_main Modules/gcmodule.c:1300
#28 0x55a492165fe5 in _PyGC_CollectNoFail Modules/gcmodule.c:2123
#29 0x55a492105745 in interpreter_clear Python/pystate.c:326
#30 0x55a4920f5565 in finalize_interp_clear Python/pylifecycle.c:1634
#31 0x55a4920fa882 in Py_FinalizeEx Python/pylifecycle.c:1812
#32 0x55a491e72870 in Py_RunMain Modules/main.c:668
#33 0x55a491e72870 in pymain_main Modules/main.c:696
#34 0x55a491e72870 in Py_BytesMain Modules/main.c:720
#35 0x7f772d82eb24 in __libc_start_main 

[issue44200] Recommend importlib.abc.Traversable users to implement __fspath__

2021-05-20 Thread Filipe Laíns

Filipe Laíns  added the comment:

I am gonna wait until/if GH-26272 (#44196) gets merged because this would 
conflict with that.

--

___
Python tracker 

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



[issue44200] Recommend importlib.abc.Traversable users to implement __fspath__

2021-05-20 Thread Filipe Laíns

New submission from Filipe Laíns :

The files()/Traversable api is meant to replace ResourceReader api, but it 
falls short in one dimension, tying the abstraction to a file system path.

I propose to document that Traversable users *should* implement __fspath__ if 
the Traversable represents a file-system path.

This will essentially make os.fspath(importlib.resources.files(module) / 
resource) the equivalent of importlib.resources.path(module, resource), for 
which currently there is no replacement using files().

--
messages: 394083
nosy: FFY00, brett.cannon, jaraco
priority: normal
severity: normal
status: open
title: Recommend importlib.abc.Traversable users to implement __fspath__
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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50056/debug_subtype_dealloc.patch

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

Apply attached debug_subtype_dealloc.patch to reproduce the issue on Linux with 
attached ref.py script:

$ ./python ref.py 
exit
subtype_dealloc(_ABC): call basedealloc() with Py_REFCNT(type)=1
subtype_dealloc(_Precedence): call basedealloc() with Py_REFCNT(type)=1
subtype_dealloc(property): call basedealloc() with Py_REFCNT(type)=1
subtype_dealloc(FlagBoundary): call basedealloc() with Py_REFCNT(type)=1
LAST GC
Cycle.__del__
Cycle.__del__
subtype_dealloc(keyword): call basedealloc() with Py_REFCNT(type)=1
python: Objects/typeobject.c:1462: subtype_dealloc: Assertion 
`!_PyMem_IsPtrFreed(type->tp_name)' failed.
Abandon (core dumped)

--
Added file: https://bugs.python.org/file50055/ref.py

___
Python tracker 

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2021-05-20 Thread Ethan Smith


Ethan Smith  added the comment:

I think the first thing we should do is figure out whether we want to support 
Emscripten or WASI (or both).

Emscripten uses Javascript polyfills for some syscalls, while WASI makes direct 
calls the VM it is running in. They both can use WebAssembly for executing the 
code. This means Emscripten has wider API support, but WASI is lighter weight 
in many ways.

I think starting with patches to support Emscripten would be best, as it is 
easier to target, then add support for WASI later.

I think supporting WASI has a lot of value, because it can be run 
deterministically, which would be great for data science (Imagine a jupyter 
notebook that runs the same everywhere!)

One issue with WASI, and may be an issue with Emscripten, is threads. In 3.8 
(or 3.9?) threadless builds were removed. However, WebAssembly's threading API 
is not really meant to emulate pthread, and SharedArrayBuffer, the primitive it 
is built on, is disabled in several browsers due to Spectre concerns.

Would patches to re-add a threadless build mode be accepted?

--
nosy: +ethan smith

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

I have a reproducer (.py script) on Windows, but the crash rate is between 1/3 
and 1/2. Also, in VS, if I run "import bug" (bug.py) in the REPL, I fail to 
reproduce the crash. Using "exec(open('../bug.py').read())" is more likely to 
trigger the crash, but in VS, I have hard time to trigger the bug. I only 
reproduced it once.

The bug seems to require very precise conditions. Maybe it depends on the 
randomized hash function.

--

___
Python tracker 

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



[issue44197] [request feature] Itertools extended combinations to limited number of repetition

2021-05-20 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

How is proposed_function("abcd", max_repeat=3) any different from what you can 
currently spell as combinations("aaabbbcccddd") ? Or, more generally,

def proposed_function(it, repeats)
repeated = chain.from_iterable([x] * repeat for x in it)
return combinations(repeated)

This can easily generalize to specifying the max count of each item.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue44189] multiprocessing AF_PIPE name format is slightly confusing in the docs

2021-05-20 Thread Eryk Sun


Eryk Sun  added the comment:

There's a formatting problem in Doc/library/multiprocessing.rst due to 
consumption of the backslashes in multiple steps. The following keeps all of 
the required backslashes in the HTML output:

* An ``'AF_PIPE'`` address is a string of the form
  :samp:`r'\\.\\pipe{PipeName}'`.  To use :func:`Client` to connect 
to a named
  pipe on a remote computer called *ServerName* one should use an address 
of the
  form :samp:`r'{ServerName}\\pipe{PipeName}'` instead.

Or just use a regular literal and rely on the reader to understand that 
"{PipeName}" and "{ServerName}" are parameters:

* An ``'AF_PIPE'`` address is a string of the form
  ``r'\\.\pipe\{PipeName}'``.  To use :func:`Client` to connect to a named
  pipe on a remote computer called *ServerName* one should use an address 
of the
  form ``r'\\{ServerName}\pipe\{PipeName}'`` instead.

--
nosy: +eryksun
type:  -> enhancement
versions: +Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 

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



[issue44199] code example index error in tutorial controlflow

2021-05-20 Thread HVoltBb


Change by HVoltBb :


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



[issue44199] code example index error in tutorial controlflow

2021-05-20 Thread HVoltBb


New submission from HVoltBb :

An index error in the code example given just above 
https://docs.python.org/3/tutorial/controlflow.html#documentation-strings

The code now is :
pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
pairs.sort(key=lambda pair: pair[1])
pairs

The "pair[1]" in the second line should be "pair[0]".

--
assignee: docs@python
components: Documentation
messages: 394077
nosy: HVoltBb, docs@python
priority: normal
severity: normal
status: open
title: code example index error in tutorial controlflow
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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Anthony Sottile


Anthony Sottile  added the comment:

would it maybe be helpful to bisect a history where the dataclasses / inspect 
import change is introduced earlier?  this would perhaps help pinpoint the 
other commit which is causing this?

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Steve Dower


Steve Dower  added the comment:

> I've found that it's reproducible if you run flake8 on a file that just 
> contains: `a.b`

ISTR there were some changes made to assigning attributes on AST classes 
recently? I forget who did them, but I remember discussing it during the 
sprints last year. Perhaps it's related to that? (Though more likely a 
subclass, as Steve suggests.)

--

___
Python tracker 

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



[issue14965] super() and property inheritance behavior

2021-05-20 Thread Daniel Urban


Daniel Urban  added the comment:

@habnabit I believe I've already signed some contributor form some years ago. 
If there is a new one, I can sign that one too.

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

This bug is really hard to reproduce on Windows. It depends on flake8 is run. 
It's a random crash in the last GC collection at Python exit.

Crash related to AST in interpreter_clear() remains me bpo-41796.

Extract of the code:

static void
interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
{
...
_PyAST_Fini(interp);
...
/* Last garbage collection on this interpreter */
_PyGC_CollectNoFail(tstate);
_PyGC_Fini(interp);
...
}

The crash occurs in _PyGC_CollectNoFail().

_PyAST_Fini() clears references to AST types in the interpreter AST state. AST 
type instances hold a reference to the their heap type:

static int
ast_traverse(AST_object *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
Py_VISIT(self->dict);
return 0;
}

But the crash happens when self->dict is deallocated.

--

___
Python tracker 

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



[issue25625] "chdir" Contex manager for pathlib

2021-05-20 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



[issue44163] IDLE ValueError in HyperParser

2021-05-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

For now, I want to just improve the error message and then close.

--

___
Python tracker 

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



[issue14965] super() and property inheritance behavior

2021-05-20 Thread Will Razen


Will Razen  added the comment:

@simonzack Your superprop.py doesn't work for multiple inheritance, because 
you're using __thisclass__.__mro__ in each step instead of the initial object 
mro

--
nosy: +willrazen

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FWIW, I'm also unable to reproduce on macOS (so far).

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I'm trying to reproduce on Linux but I am unable to make it fail even with the 
address sanitizer activated :(

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

My bet is because this is caused by the AST module using heap typed here. There 
is probably a missing strong reference somewhere.

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

Just to thicken the mystery a bit further, if you comment out

import inspect

in dataclasses.py, the error also goes away.

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Steve Stagg


Steve Stagg  added the comment:

So, for me, the single line from 11159d that causes the problem is this:

pprint.py:
import dataclasses as _dataclasses

Obviously importing dataclasses here is having some side-effect

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Steve Stagg


Steve Stagg  added the comment:

I got the same result from a bisect:

11159d2c9d6616497ef4cc62953a5c3cc8454afb

--

___
Python tracker 

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



[issue44198] Add flags or function in pathlib.Path

2021-05-20 Thread Mikhail


New submission from Mikhail :

Hello! This is a very useful feature when a Path-object gets a list (or 
generator, as it is now) of files/dirs in self.dir, I think. Right now this is 
the .iterdir() function, but sometimes you only need `dirs` of that path (for 
example, I really needed the function when I was working with images for 
classification), and at the moment this is only solved by (path for path in 
root.iterdir() if path.is_dir()). You could make separate functions for this, 
but I suggest just adding the only_dirs/only_files(/only_links) flags to 
.iterdir().

--
components: Library (Lib)
messages: 394064
nosy: tetelevm
priority: normal
severity: normal
status: open
title: Add flags or function in pathlib.Path
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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

The bisect was bizarre to say the least...

It points to commit 11159d2c9d6616497ef4cc62953a5c3cc8454afb

bpo-43080: pprint for dataclass instances (GH-24389)
* Added pprint support for dataclass instances which don't have a custom 
__repr__.

which doesn't touch any C code by itself and isn't the heap type conversions.

If I check out to latest 3.10 and revert that commit, this issue seems to go 
away. Can someone else confirm just to make sure the bisect was done correctly?

--

___
Python tracker 

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



[issue44126] Support cross-compiling of cpython modules using setuptools

2021-05-20 Thread Jeff Moguillansky


Change by Jeff Moguillansky :


--
status: open -> closed

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Lets get equivalent whatsnew text into the 3.8 and 3.9 and 3.10 branches before 
closing it.

--

___
Python tracker 

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



[issue44197] [request feature] Itertools extended combinations to limited number of repetition

2021-05-20 Thread latot


New submission from latot :

Hi, some time ago I was looking for a function in itertools, actually, the 
combination functions allow us to have or not repetitions of element, have in 
consideration that if we allow repetitions there can be any amount of them, no 
way to limit the number of repetitions.

Here I asked in stackoverflow about this if there is a lib or option, in the 
end we wasn't able to found any about this and there was an answer with the 
solution.

I think this solution worth to be added to itertools, conceptually, the actual 
2 functions of combinations are particular cases of this function.

https://stackoverflow.com/questions/67559105/combinatory-with-n-picked-elements-and-limited-repetitions-in-python/67559625

Well, there can be a extension of this too, where we can say, "how many times 
every particular element can be repeated".

Both of this things world be useful.

Thx.

--
components: Library (Lib)
messages: 394061
nosy: latot
priority: normal
severity: normal
status: open
title: [request feature] Itertools extended combinations to limited number of 
repetition

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

Mark: Can you please document your change on types.CodeType? In:

* https://docs.python.org/dev/library/types.html#types.CodeType
* https://docs.python.org/dev/whatsnew/3.11.html

The change broke the Genshi project:
https://github.com/edgewall/genshi/issues/43

in this Genshi function:

def build_code_chunk(code, filename, name, lineno):
params =  [0, code.co_nlocals, code.co_kwonlyargcount,
  code.co_stacksize, code.co_flags | 0x0040,
  code.co_code, code.co_consts, code.co_names,
  code.co_varnames, filename, name, lineno,
  code.co_lnotab, (), ()]
if hasattr(code, "co_posonlyargcount"):
# PEP 570 added "positional only arguments"
params.insert(2, code.co_posonlyargcount)
return CodeType(*params)

--
nosy: +vstinner

___
Python tracker 

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



[issue44126] Support cross-compiling of cpython modules using setuptools

2021-05-20 Thread Jeff Moguillansky


Jeff Moguillansky  added the comment:

Is it possible to add support for cross-compiling of cpython modules to 
setuptools?
It seems that currently there's some 3rd party solutions like "crossenv" but 
they don't seem to work with clang / ndk-toolchain for example.

--
status: closed -> open
title: Cross Compile CPython Modules -> Support cross-compiling of cpython 
modules using setuptools

___
Python tracker 

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



[issue44169] Add HTTPS support to http.server

2021-05-20 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Make http.server support SSL

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Ned Deily


Ned Deily  added the comment:

Thanks, Senthil and Greg! The updates for 3.7 and 3.6 are now merged. Is there 
anything else that needs to be done for this issue or can it now be closed?

--
priority: release blocker -> high
resolution: fixed -> 
stage: patch review -> commit review

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Ned Deily


Ned Deily  added the comment:


New changeset 6f743e7a4da904f61dfa84cc7d7385e4dcc79ac5 by Senthil Kumaran in 
branch '3.6':
[3.6] bpo-43882 - Mention urllib.parse changes in Whats New section for 3.6.14 
(GH-26268)
https://github.com/python/cpython/commit/6f743e7a4da904f61dfa84cc7d7385e4dcc79ac5


--

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Ned Deily


Ned Deily  added the comment:


New changeset c723d5191110f99849f7b0944820f6c3cd5f7747 by Senthil Kumaran in 
branch '3.7':
[3.7] bpo-43882 - Mention urllib.parse changes in Whats New section for 3.7.11 
(GH-26267)
https://github.com/python/cpython/commit/c723d5191110f99849f7b0944820f6c3cd5f7747


--

___
Python tracker 

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



[issue36203] PyWeakref_NewRef docs are misleading

2021-05-20 Thread Maxwell Bernstein


Change by Maxwell Bernstein :


--
pull_requests: +24879
pull_request: https://github.com/python/cpython/pull/26273

___
Python tracker 

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



[issue44196] Document that importlib.abc.Traversable's methods should raise FileNotFoundError

2021-05-20 Thread Filipe Laíns

Change by Filipe Laíns :


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

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-20 Thread Filipe Laíns

Change by Filipe Laíns :


--
pull_requests: +24877
pull_request: https://github.com/python/cpython/pull/26272

___
Python tracker 

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



[issue44196] Document that importlib.abc.Traversable's methods should raise FileNotFoundError

2021-05-20 Thread Filipe Laíns

New submission from Filipe Laíns :

ResourceReader used to have this requirement, Traversable does not. We cannot 
add a requirement as there might be users not doing this, but we can ask new 
users to do so.

We should document that FileNotFoundError should be raised if a file is not 
found, but that it is not guaranteed that it will for all Traversable 
implementations for compatibility reasons.

--
assignee: docs@python
components: Documentation
messages: 394055
nosy: FFY00, brett.cannon, docs@python, jaraco
priority: normal
severity: normal
status: open
title: Document that importlib.abc.Traversable's methods should raise 
FileNotFoundError
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



[issue42022] Allow ensurepip to work without bundled wheels

2021-05-20 Thread Filipe Laíns

Filipe Laíns  added the comment:

Closing as the new --with-wheel-pkg-dir option provides an alternative 
mechanism.

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

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-20 Thread Filipe Laíns

Change by Filipe Laíns :


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

___
Python tracker 

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



[issue40092] Crash in _PyThreadState_DeleteExcept() at fork in the process child

2021-05-20 Thread David Edelsohn


Change by David Edelsohn :


--
nosy: +David.Edelsohn

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Also, why this doesn't happen on Linux?

--

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-20 Thread Filipe Laíns

New submission from Filipe Laíns :

7f7e706d78ab968a1221c6179dfdba714860bd12 introduced the files() api and 
documented a importlib.abc.TraversableReader protocol, but it did not implement 
it.

This class is documented and marked as introduced in 3.9, but it's actually 
missing.

--
messages: 394052
nosy: FFY00, brett.cannon, jaraco
priority: normal
severity: normal
status: open
title: importlib.abc.TraversableReader is not implemented
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Given how hairy finding these GC errors is, I would recommend to bisect this so 
we can trim down the search to some commit, although my bet is some of the heap 
type conversions.

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Steve Stagg


Steve Stagg  added the comment:

I've found that it's reproducible if you run flake8 on a file that just 
contains:
`a.b`
whereas:
`a`
and
`a(b)`
don't seem to trigger the error.

The object being cleaned up when the segfault appears, seems to be a subclass 
of ast.AST

--

___
Python tracker 

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



[issue44194] Folding ''.join() into f-strings

2021-05-20 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

Since strings are immutable types, we could fold some operation on top of them. 
Serhiy has done some work on issue 28307 regarding folding `str % args` 
combination, which I think we can extend even further. One simple example that 
I daily encounter is that, there is this pattern

'/'.join([something, something_else, user_arg])

where people would join N number of elements together with a separator, where 
the N is something that we know. Just a search over some locally cloned PyPI 
projects (a couple thousand, showed 5000+ occurrences where this optimization 
applies).

The preliminary benchmarks indicate that the speedup is about %40. Though there 
are multiple issues that might concern others:
   - type checking, f-strings cast automatically but .join() requires each 
element to be a string subclass. The current implementation introduces a new 
conversion called 'c' which actually does the type checking instead of 
converting the value.
   - preventing a call to a runtime function, I belive that this work is not 
that different than issue 28307 which prevents str.__mod__ though I understand 
the concern

Here is the implementation if anybody wants to take a look at it: 
https://github.com/isidentical/cpython/commit/d7ea8f6e38578ba06d28deb4b4a8df676887ec26

I believe that the implementation can be optimized further (etc if a continuous 
block of elements are a string, then we can load all of them in one go!). And 
some cases proved that the f-strings might be faster than the join by 1.7-1.8x.

--
messages: 394049
nosy: BTaskaya, eric.smith, pablogsal, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Folding ''.join() into f-strings

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

The segfault seems to be occuring on typeobject.c:1456 during interpreter 
finalization:

if (type->tp_flags & Py_TPFLAGS_HEAPTYPE && !(base->tp_flags & 
Py_TPFLAGS_HEAPTYPE))

where `type` seems to have already been deallocated.

Here's the stack trace:

python310.dll!subtype_dealloc(_object * self) Line 1456 C
[Inline Frame] python310.dll!_Py_Dealloc(_object *) Line 2288   C
[Inline Frame] python310.dll!_Py_DECREF(_object *) Line 500 C
[Inline Frame] python310.dll!_Py_XDECREF(_object * op) Line 567 C
>   python310.dll!dict_dealloc(PyDictObject * mp) Line 2067 C
[Inline Frame] python310.dll!_Py_Dealloc(_object *) Line 2288   C
[Inline Frame] python310.dll!_Py_DECREF(_object *) Line 500 C
python310.dll!ast_clear(AST_object * self) Line 784 C
python310.dll!delete_garbage(_ts * tstate, _gc_runtime_state * gcstate, 
PyGC_Head * collectable, PyGC_Head * old) Line 1018 C
python310.dll!gc_collect_main(_ts * tstate, int generation, __int64 * 
n_collected, __int64 * n_uncollectable, int nofail) Line 1304 C
[Inline Frame] python310.dll!_PyGC_CollectNoFail(_ts *) Line 2123   
C
python310.dll!interpreter_clear(_is * interp, _ts * tstate) Line 326
C
[Inline Frame] python310.dll!_PyInterpreterState_Clear(_ts *) Line 358  
C
python310.dll!finalize_interp_clear(_ts * tstate) Line 1639 C
python310.dll!Py_FinalizeEx() Line 1813 C
[Inline Frame] python310.dll!Py_RunMain() Line 668  C
[Inline Frame] python310.dll!pymain_main(_PyArgv *) Line 696C
python310.dll!Py_Main(int argc, wchar_t * * argv) Line 708  C

--

___
Python tracker 

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



[issue44193] socket line 46 import _socket Import Error

2021-05-20 Thread Joshex


Joshex  added the comment:

LOL! the issue does not happen if I uninstall the 64 bit python install the 32 
bit python and change the environment variables for the python path to the 32 
bit folders. 

so it's a problem with 64 bit python. good thing I have the 32 bit as a backup.

--

___
Python tracker 

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



[issue44193] socket line 46 import _socket Import Error

2021-05-20 Thread Joshex


Joshex  added the comment:

Same error when importing Tkinter

it looks like any python module that tries to import a DLL fails because it 
forgets it should be looking for a 64 bit dll and instead goes looking for a 32 
bit DLL and when it finds out it's 64 it throws a tantrum.

--

___
Python tracker 

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



[issue36203] PyWeakref_NewRef docs are misleading

2021-05-20 Thread Irit Katriel


Irit Katriel  added the comment:

Please add unit tests to the patch.

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

___
Python tracker 

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



[issue43757] pathlib: move 'resolve()' logic out of path flavour

2021-05-20 Thread Barney Gale


Change by Barney Gale :


--
pull_requests: +24875
pull_request: https://github.com/python/cpython/pull/26270

___
Python tracker 

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



[issue38671] pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist

2021-05-20 Thread Barney Gale


Change by Barney Gale :


--
pull_requests: +24874
pull_request: https://github.com/python/cpython/pull/26270

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Steve Stagg


Change by Steve Stagg :


--
nosy: +stestagg

___
Python tracker 

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



[issue44193] socket line 46 import _socket Import Error

2021-05-20 Thread Joshex


Joshex  added the comment:

sorry: edit, it only appears on my 64 bit computer

--

___
Python tracker 

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



[issue44193] socket line 46 import _socket Import Error

2021-05-20 Thread Joshex


New submission from Joshex :

I assume someone has already fixed this problem, as I am using a very old 
version of python compatible with my version of blender. Though after 
searching, I found results for the same error message only a month or 2 ago.

anyways, my version of python 2.6.2 is out of support. but I assume if this has 
recently been fixed for more recent python modules, the same sort of fix could 
be applied to my install.

The problem is, I am on 64 bit windows 7 with 64 bit python 2.6.2 installed to 
use blender 2.49b. I have a 32 bit computer and verified the error does not 
appear when importng the socket module there! only on my 32 bit computer., I 
tried uninstalling 64 bit python from C:\Python26 and reinstalling to 
C:\Program Files (x86)\Python26. I have updated the system environment 
variables, to include this in the python path.

and I still get 
"C:\Program Files (x86)\Python26\LIB\socket.py", line 46, in  
import _socket 
ImportError: DLL load failed: %1 is not a valid Win32 application

I would be happy if someone remembered the fix for this so I could apply it 
myself.

--
messages: 394043
nosy: Joshex
priority: normal
severity: normal
status: open
title: socket line 46 import _socket Import Error

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

This is a flake8 error not tox error. Though if it was a complete flake8 error 
then it would fail in all Python. But it only fails in 3.10 (don't know about 
3.11 because haven't tested it yet.)

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Anthony Sottile


Anthony Sottile  added the comment:

vstinner I showed the directions above, but here they are again:


venv\Scripts\pip install flake8==3.6.0
venv\Scripts\pip install -e . --no-deps  # ignore the conflict, but fix pyflakes

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

Where does flake8.exe come from? Is it created by pip? Or by Python? Is it part 
of the flake8 project?

--
nosy: +vstinner

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

Can recreate on the latest 3.10 checkout, taking a look.

--
nosy: +ammar2

___
Python tracker 

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



[issue44192] Annotations, Inheritance and Circular Reference

2021-05-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy:  -pablogsal

___
Python tracker 

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



[issue44192] Annotations, Inheritance and Circular Reference

2021-05-20 Thread ReOb


New submission from ReOb :

Basically, I have:

```
class Base:
_sub: list[Sub]

class Sub:
_parent: Base
```

What creates a circular reference.

It could be solved doing:

```
class Sub:
pass

class Base:
_sub: list[Sub]

class Sub:
_parent: Base
```

But in the annotation, I will get the class Sub without his annotations, 
methods and properties (the first definition is not updated in annotation after 
the redefinition).

Then, I suggest one of three possible solutions:

1. Update the reference to class in annotations if the class was redefined
2. Add a way to forward declaration (it could be implemented by a new reserved 
word "forward")
3. Or, like Ruby, make that the redefinition of a class, open the class to 
change the definition of class, including new methods, properties and 
annotations.

It is very important to have the correct type in annotation, because we use 
this type to create new objects dinamically, but actually is impossible to 
solve this problem because we can not have the correct definition at both 
classes: Base and Sub class.

When we use the type annotated to create a new object, as it is, we loose the 
annotations, methods and properties defined at the redefinition of the class.

This problem occurs only if we use annotations.

Like Python added the possibility to define annotations, needs to provide one 
of these solutions pointed (or another) to solve problems like this.

If the decision was to implement a forward reserved word, it could be solved 
doing:

```
class Sub:
forward

class Base:
_sub: list[Sub]

class Sub:
_parent: Base
```

If the first or third solution was preferred this code will work:

```
class Sub:
pass

class Base:
_sub: list[Sub]

class Sub:
_parent: Base
```

I hope Python could implement one of these solutions to provide a better 
support for annotations, because actually what we have are two classes, with 
the same name, that walks like a duck, swim like a duck, sound like a duck but 
they are not the same duck, and they should be.

The framework that we are developping depends strongly that we could get the 
correct type from annotation to create the correct object based on this.

I hope it could be handled as soon as possible, because change the definition 
to another class that was a super class of both classes (Base and Sub, in this 
example) will not permit us to know the correct class to create another object 
dinamically and probabily we will need to create a hack to handle this, making 
the code less Pythonic.

Thanks.

--
components: Parser
messages: 394038
nosy: lys.nikolaou, pablogsal, reob-info
priority: normal
severity: normal
status: open
title: Annotations, Inheritance and Circular Reference
type: resource usage
versions: Python 3.9

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Anthony Sottile


Anthony Sottile  added the comment:

ah sorry, the branch got squash-merged

this is the equivalent revision after the merge: 
f3b1b44bf3d2d5927004fa1c2fcf1ab2def816b9

--

___
Python tracker 

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



[issue41318] Better error message of "Cannot recover from stack overflow."

2021-05-20 Thread Irit Katriel


Irit Katriel  added the comment:

I am unable to reproduce the error with your code on 3.11.  It could be that 
recent changes in recursion handling fixed this case.

As I mentioned on the PR, adding this to the error message can make it even 
more confusing because this is not the only scenario in which this error can 
show up.

I'm closing this issue for the two reasons mentioned above.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Is b02ba019e16f7c156ec63c2ea05c627a0fe86c48 the correct commit? I cannot 
checkout this:

❯ git clone https://github.com/pycqa/pyflakes

Cloning into 'pyflakes'...
remote: Enumerating objects: 2651, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 2651 (delta 27), reused 28 (delta 15), pack-reused 2598
Receiving objects: 100% (2651/2651), 905.17 KiB | 10.40 MiB/s, done.
Resolving deltas: 100% (1774/1774), done.

/tmp
❯ cd pyflakes

pyflakes on  master  pyenv 3.9.1
❯ git checkout b02ba019e16f7c156ec63c2ea05c627a0fe86c48

fatal: reference is not a tree: b02ba019e16f7c156ec63c2ea05c627a0fe86c48

--

___
Python tracker 

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



[issue44191] Getting an ImportError DLL load failed while importing _ssl

2021-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

py2exe is a third party tool and not maintained by Python core development. 
Please use resources at http://www.py2exe.org/ to get help, e.g. issue tracker 
https://github.com/py2exe/py2exe

--

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: deferred blocker -> release blocker

___
Python tracker 

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



[issue44191] Getting an ImportError DLL load failed while importing _ssl

2021-05-20 Thread Luis González

New submission from Luis González :

Good morning everyone. First of all, I would like apologize for my poor 
english. I'm a very newby programming in python.  I'm getting an ImportError 
DLL load failed while importing _ssl. Can't find _ssl.pyd, from my EXE file 
created by de sentence "Python setup.py py2exe". The file _ssl.pyd, is at the 
same folder than the .exe file. Thanks in advance.

--
assignee: christian.heimes
components: SSL
messages: 394033
nosy: christian.heimes, lnegger
priority: normal
severity: normal
status: open
title: Getting an ImportError DLL load failed while importing _ssl
type: crash
versions: Python 3.9

___
Python tracker 

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



[issue44099] [C API] Introduce a new slot in PyModuleDef to hold the classes

2021-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

See also 
https://discuss.python.org/t/define-module-constants-in-pymoduledef/5749

--
nosy: +vstinner

___
Python tracker 

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



[issue44187] Implement infrastructure for quickening and specializing

2021-05-20 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2021-05-20 Thread miss-islington


miss-islington  added the comment:


New changeset 36843f716df7cfa67ea7cd858acb0df1fc5e980e by Miss Islington (bot) 
in branch '3.10':
bpo-38820: Test with OpenSSL 3.0.0-alpha17 (GH-26266)
https://github.com/python/cpython/commit/36843f716df7cfa67ea7cd858acb0df1fc5e980e


--

___
Python tracker 

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



[issue44099] [C API] Introduce a new slot in PyModuleDef to hold the classes

2021-05-20 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Yes. It's becoming hard to implement both static and heap types using one 
struct member. Since this is all about implementing a helping hand when it 
comes to types I think two different members one for static and another one for 
heap would be fine. And if someone then comes up with even a better idea, then 
I'll implement that. I'm now working on implementing them.

--

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +24872
pull_request: https://github.com/python/cpython/pull/26268

___
Python tracker 

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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2021-05-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24873
pull_request: https://github.com/python/cpython/pull/26269

___
Python tracker 

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



[issue44190] Dictionary assignment shorthand

2021-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

Your proposal is not possible in Python. The object does not know under which 
variable names it is accessible. The closest you can get is this:

>>> dict(
... foo="bar"
... )
{'foo': 'bar'}

--
nosy: +christian.heimes

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

Pablo, Steve, please take a look.

--
assignee:  -> steve.dower
keywords: +3.10regression
nosy: +pablogsal
priority: normal -> deferred blocker
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



[issue44190] Dictionary assignment shorthand

2021-05-20 Thread David Hariri


New submission from David Hariri :

In some languages, one may declare a dictionary's key and its value like so:

```
foo = "bar"

my_dict = { foo }
>> { "foo" : "bar" }
```

In Python, one must instead write:

```
foo = "bar"

my_dict = {
"foo": foo
}
>> { "foo" : "bar" }
```

I humbly suggest this change as a QoL improvement for those who work with 
dictionaries all day.

--
messages: 394027
nosy: davidhariri
priority: normal
severity: normal
status: open
title: Dictionary assignment shorthand
type: enhancement

___
Python tracker 

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



[issue44185] mock_open file handle __exit__ does not call close

2021-05-20 Thread Pierre Ossman


Change by Pierre Ossman :


--
nosy: +CendioOssman

___
Python tracker 

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



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Anthony Sottile


Anthony Sottile  added the comment:

everything in this virtualenv is pure python so I don't think it's a faulty 
third party extension module

--

___
Python tracker 

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



[issue43882] [security] urllib.parse should sanitize urls containing ASCII newline and tabs.

2021-05-20 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +24871
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/26267

___
Python tracker 

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



  1   2   >