[issue46324] 'import traceback' Causes a Crash

2022-01-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Your module token.py "shadowed" the stdlib token.py, and prevented it from 
being seen until you changed the name.

--
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue46318] asyncio and ssl: ResourceWarning: unclosed transport

2022-01-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46265] Error when cross compiling for hardfloat MIPS

2022-01-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +pablogsal

___
Python tracker 

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



[issue46310] Simplify `for` loop in `.close()` method in `asyncio/windows_events`

2022-01-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
components: +asyncio -Library (Lib)
nosy: +kumaraditya303, yselivanov

___
Python tracker 

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



[issue46315] Add support for WebAssembly System Interface (wasm32-wasi)

2022-01-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-01-09 Thread Kumar Aditya


Kumar Aditya  added the comment:

Targeting Python 3.11 as it a performance improvement.

--
nosy: +kumaraditya303, vstinner
versions:  -Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46324] 'import traceback' Causes a Crash

2022-01-09 Thread Kumar Aditya


Kumar Aditya  added the comment:

Python has a token module so you should use any other name for your module.

--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46325] Documentation for SubprocessTransport.get_pipe_transport return values readable/writable

2022-01-09 Thread xx11mz


New submission from xx11mz :

SubprocessTransport.get_pipe_transport returns a "transport for the 
communication pipe corresponding to the integer file descriptor fd".
Below that, it currently says fd 0 is readable and fd 1 and 2 are writable.

But since it is referring to the subprocess' file descriptors from the 
perspective of the parent process, I believe fd 0 should be writable while fd 1 
and 2 are readable. In other words, the parent process can write to the 
subprocess' stdin and read from its stdout and stderr.

Maybe I have completely misunderstood this method, but I have confirmed that 
get_pipe_transport(0) indeed returns a writable transport.

So unless I'm mistaken, I think the word "readable" should be changed to 
"writable" and vice-versa in the SubprocessTransport.get_pipe_transport 
documentation.

--
assignee: docs@python
components: Documentation
messages: 410188
nosy: docs@python, xx11mz
priority: normal
severity: normal
status: open
title: Documentation for SubprocessTransport.get_pipe_transport return values 
readable/writable
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46324] 'import traceback' Causes a Crash

2022-01-09 Thread bichanna


New submission from bichanna :

I was developing a programming language using Python, and I had a 'token.py' 
file. After changing the name of the file, the issue was solved.

I am sure that my 'token.py' caused the error.

Here's the traceback I got:
Traceback (most recent call last):
  File "/some/path/main.py", line 2, in 
from parser import Parser
  File "/some/path/parser.py", line 3, in 
import traceback
  File 
"/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/traceback.py",
 line 5, in 
import linecache
  File 
"/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/linecache.py",
 line 11, in 
import tokenize
  File 
"/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tokenize.py",
 line 35, in 
from token import EXACT_TOKEN_TYPES
ImportError: cannot import name 'EXACT_TOKEN_TYPES' from 'token' 
(/some/path/token.py)

--
components: macOS
messages: 410187
nosy: bichanna, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: 'import traceback' Causes a Crash
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



[issue46275] caret location for syntax error pointing with f-strings

2022-01-09 Thread William Navaraj


William Navaraj  added the comment:

The variation in the caret position was also due to the trailing spaces. This 
is now sorted in this solution with a factored out function to find out the 
correct offset.
https://github.com/python/cpython/compare/main...williamnavaraj:fix-issue-46275?expand=1

Tested against all of the following cases and it works great:

temp=f"blank ({foo()}"+f"blank ({foo(}"+f"blank ({foo()}"
temp=f"blank*{foo(*blank*foo()*blank*foo()}"+f"({foo(}"+f"blank ({foo(}"
a=foo)+foo()+foo()  
f"blank ({foo(blank ({foo()}) blank foo()})"   
temp=f"blank ({foo)foo2" 
temp=f"blank {foo)"
temp=f"blank {foo)"
temp=f"blank ({foo)blank ({foo()}) blank foo()})"  yetAnotherBlah
temp=f"blank ({foo)blank ({foo()}) blank foo()})"  
yetAnotherBlahWithFurtherSpacesAfter

--

___
Python tracker 

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



[issue46301] Enum tests: One branch is not covered in `Enum._convert_`

2022-01-09 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



[issue46323] Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c

2022-01-09 Thread hydroflask


New submission from hydroflask :

_CallPythonObject() in Modules/_ctypes/callbacks.c still uses the old API 
(PyObject_CallObject()) to invoke methods. It should use 
_PyObject_Vectorcall(). Creating an issue for this since this method is a 
little more performance sensitive than normal Python library code.

--
components: ctypes
messages: 410185
nosy: hydroflask
priority: normal
severity: normal
status: open
title: Use _PyObject_Vectorcall in Modules/_ctypes/callbacks.c
type: performance
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46301] Enum tests: One branch is not covered in `Enum._convert_`

2022-01-09 Thread Ethan Furman


Ethan Furman  added the comment:

Reverting.

Nikita, you can use the command:

./python -m test.regrtest -R : test_enum

to show the leaks and hopefully track them down.  The half-hour I spent yielded 
no clues.

--

___
Python tracker 

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



[issue46319] datetime.utcnow() should return a timezone aware datetime

2022-01-09 Thread Paul Ganssle


Paul Ganssle  added the comment:

Yes, this is the documented behavior, including a warning against using UTC now 
in the documentation!

There is some possibility of removing utcnow entirely as an "attractive 
nuisance", but I suspect that this will lead to much consternation and 
hand-wringing, and there are some legitimate uses for `utcnow`, so I haven't 
made it a high priority to have that particular fight...

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

___
Python tracker 

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



[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 2e6798f35260ff90129861ef1f289ac40c0396c2 by Miss Islington (bot) 
in branch '3.10':
bpo-46270: Describe the `in` and `not in` operators as membership tests. 
(GH-30504) (GH-30509)
https://github.com/python/cpython/commit/2e6798f35260ff90129861ef1f289ac40c0396c2


--

___
Python tracker 

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



[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d24cd49acb25c36db31893b84d0ca4fe2f373b94 by Raymond Hettinger in 
branch 'main':
bpo-46270: Describe the `in` and `not in` operators as membership tests. 
(GH-30504)
https://github.com/python/cpython/commit/d24cd49acb25c36db31893b84d0ca4fe2f373b94


--

___
Python tracker 

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



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2022-01-09 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 0b2b9d251374c5ed94265e28039f82b37d039e3e by Inada Naoki in branch 
'main':
bpo-23882: unittest: Drop PEP 420 support from discovery. (GH-29745)
https://github.com/python/cpython/commit/0b2b9d251374c5ed94265e28039f82b37d039e3e


--

___
Python tracker 

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



[issue46319] datetime.utcnow() should return a timezone aware datetime

2022-01-09 Thread Martin Panter


Martin Panter  added the comment:

Perhaps this is a duplicate of Issue 12756?

--
nosy: +martin.panter
superseder:  -> datetime.datetime.utcnow should return a UTC timestamp

___
Python tracker 

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



[issue46167] Parse assert (x == y, "Descriptive text") as statement params instead of a tuple

2022-01-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I created a PEP to formally propose the change:

https://www.python.org/dev/peps/pep-0679/

--

___
Python tracker 

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



[issue46322] Invalid file path of SSLKEYLOGFILE throw FileNotFoundError

2022-01-09 Thread SinaGhaaf


New submission from SinaGhaaf :

An existence check of 'keylogfile' is missed at 
https://github.com/python/cpython/blob/main/Lib/ssl.py#L779, if the file path 
does not exist, it tries to set 'context.keylog_filename' to an invalid file, 
and the result would be 'FileNotFoundError'. 
The following check fixed the issue:

if keylogfile and not sys.flags.ignore_environment and 
os.path.isfile(keylogfile):



```
Traceback (most recent call last):
  File "test_https.py", line 19, in 
from test.conftest import ServerConfig
  File "C:\Check\urllib3-patch-1\src\test\conftest.py", line 12, in 
from tornado import ioloop, web
  File "C:\Python38\lib\site-packages\tornado\web.py", line 87, in 
from tornado.httpserver import HTTPServer
  File "C:\Python38\lib\site-packages\tornado\httpserver.py", line 32, in 

from tornado.http1connection import HTTP1ServerConnection, 
HTTP1ConnectionParameters
  File "C:\Python38\lib\site-packages\tornado\http1connection.py", line 34, in 

from tornado import iostream
  File "C:\Python38\lib\site-packages\tornado\iostream.py", line 40, in 
from tornado.netutil import ssl_wrap_socket, _client_ssl_defaults, 
_server_ssl_defaults
  File "C:\Python38\lib\site-packages\tornado\netutil.py", line 34, in 
_client_ssl_defaults = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
  File "C:\Python38\lib\ssl.py", line 755, in create_default_context
context.keylog_filename = keylogfile
FileNotFoundError: [Errno 2] No such file or directory: 
'D:\\invalid_path\\invalid_file.txt'
```

--
assignee: christian.heimes
components: SSL
messages: 410177
nosy: christian.heimes, ghaaf
priority: normal
severity: normal
status: open
title: Invalid file path of SSLKEYLOGFILE throw FileNotFoundError
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue1283110] Give __len__() advice for "don't know"

2022-01-09 Thread Irit Katriel


Change by Irit Katriel :


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



[issue46321] Don't need delineators on lists

2022-01-09 Thread Devin Harper


Devin Harper <345t...@gmail.com> added the comment:

Had to look up tuple in documentation instead of list. Thanks for mentioning 
tuple!

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-09 Thread Ben Kehoe

Ben Kehoe  added the comment:

That doesn’t really seem like a Pythonic way of extracting that
information? Nor does it seem like it would be an obvious trick for the
average developer to come up with. A method that provides the information
directly seems useful.

--

___
Python tracker 

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The simplest way of collecting template names is to use a defaultdict:

>>> d = collections.defaultdict(str)
>>> string.Template('$a $b').substitute(d)
' '
>>> d.keys()
dict_keys(['a', 'b'])

You can use a custom mapping if you need special handling of absent keys.

--

___
Python tracker 

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



[issue46301] Enum tests: One branch is not covered in `Enum._convert_`

2022-01-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that this PR has broken the refleak buildbots:

https://buildbot.python.org/all/#/builders/320/builds/269/
https://buildbot.python.org/all/#/builders/384/builds/255

According to our buildbot policy, if this is not fixed in 24h we will need to 
revert

--
nosy: +pablogsal

___
Python tracker 

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-09 Thread Ben Kehoe

Ben Kehoe  added the comment:

The point is to be able to programmatically determine what is needed for a
successful substitute() call. A basic use case for this is better error
messages; calling substitute() with an incomplete mapping will tell you
only the first missing identifier it encounters; if you know all the
identifiers you can raise an error about all the missing identifiers.
Another error handling use case is checking whether the template is valid,
without needing to provide a complete mapping. A use case unrelated to
error handling that I’ve encountered a few times is interactive prompting
for template values, which you can only do if you can get a list of the
identifiers in the template.

--

___
Python tracker 

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



[issue46315] Add support for WebAssembly System Interface (wasm32-wasi)

2022-01-09 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



[issue46321] Don't need delineators on lists

2022-01-09 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

As Dennis points out, this is not a bug, it's already valid Python syntax.

--
nosy: +barry
resolution:  -> not a bug
status: pending -> open

___
Python tracker 

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



[issue43698] Use syntactically correct examples on abc package page

2022-01-09 Thread Alex Waygood


Change by Alex Waygood :


--
stage:  -> patch review
type: compile error -> behavior

___
Python tracker 

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



[issue46321] Don't need delineators on lists

2022-01-09 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

What you typed is already valid syntax, it's just that `a, b, c` makes a tuple, 
not a list. Changing that now would be backwards-incompatible.

Is this a request for some kind of tweak to some documentation, or is this a 
request for a different behavior?

--
nosy: +Dennis Sweeney
status: open -> pending

___
Python tracker 

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



[issue46321] Don't need delineators on lists

2022-01-09 Thread Devin Harper


New submission from Devin Harper <345t...@gmail.com>:

a=1
b=2
c=3
list=a, b, c
#Remove spaces at the end of lists. Because sometimes spaces are errors or not 
depending on the number of items in your list. Remove list delineators to save 
a little memory and time not typing those delineator symbols on list 
definitions.
for items in list:
print(items)

--
assignee: docs@python
components: Documentation
messages: 410169
nosy: 345trig, docs@python
priority: normal
severity: normal
status: open
title: Don't need delineators on lists
type: resource usage

___
Python tracker 

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



[issue46008] Prepare runtime/interp/thread state and init for upcoming changes.

2022-01-09 Thread Quentin Pradet


Quentin Pradet  added the comment:

For what it's worth, this refactoring led to a 100% reproducible crash on my 
Fedora laptop: https://bugs.python.org/issue46320. (And led to various crashes 
in urllib3's CI, but they were more random.)

--
nosy: +Quentin.Pradet

___
Python tracker 

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



[issue46320] runtime/interp/thread state refactoring leads to segmentation fault

2022-01-09 Thread Quentin Pradet


Quentin Pradet  added the comment:

Sorry, I pasted the same crash twice. Here's the segmentation fault in 
`selectors`:

```
=
 test session starts 
=
platform linux -- Python 3.11.0a2+, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/q/pub/urllib3, configfile: setup.cfg
collected 1 item

  

test/test_reproduce.py Fatal Python error: Segmentation fault

Thread 0x7f9683378640 (most recent call first):
  File "/home/q/pub/install/lib/python3.11/selectors.py", line 416 in select
  File "/home/q/pub/install/lib/python3.11/asyncio/base_events.py", line 1822 
in _run_once
  File "/home/q/pub/install/lib/python3.11/asyncio/base_events.py", line 591 in 
run_forever
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/platform/asyncio.py",
 line 199 in start
  File "/home/q/pub/install/lib/python3.11/threading.py", line 968 in run
  File "/home/q/pub/install/lib/python3.11/threading.py", line 1031 in 
_bootstrap_inner
  File "/home/q/pub/install/lib/python3.11/threading.py", line 988 in _bootstrap

Extension modules: tornado.speedups, _brotli, _cffi_backend (total: 3)
zsh: segmentation fault (core dumped)  pytest
```

(Those results are produced with 
https://github.com/python/cpython/commit/32a67246b0d1e08cd50fc3bfa58052cfeb515b2e)

--

___
Python tracker 

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



[issue46320] runtime/interp/thread state refactoring leads to segmentation fault

2022-01-09 Thread Quentin Pradet


New submission from Quentin Pradet :

Since 
https://github.com/python/cpython/commit/32a67246b0d1e08cd50fc3bfa58052cfeb515b2e
 which was introduced through https://bugs.python.org/issue46008 and shipped as 
part of alpha 3, the urllib3 test suite reliably crashes on Fedora 35 (ie. 
gives a segfault).

I've narrowed the reproducer code down to 
https://github.com/pquentin/urllib3/blob/segfault/test/test_reproduce.py, but 
that still requires cffi, pyOpenSSL and Tornado.

The segfault either happens in the `ssl` module or the `selectors` module:

```
= test session starts 
=
platform linux -- Python 3.11.0a2+, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/q/pub/urllib3, configfile: setup.cfg
collected 1 item
  

test/test_reproduce.py Fatal Python error: Segmentation fault

Thread 0x7fee9a250640 (most recent call first):
  File "/home/q/pub/install/lib/python3.11/ssl.py", line 1346 in do_handshake
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/iostream.py", 
line 1391 in _do_ssl_handshake
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/iostream.py", 
line 1478 in _handle_read
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/iostream.py", 
line 696 in _handle_events
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/platform/asyncio.py",
 line 189 in _handle_events
  File "/home/q/pub/install/lib/python3.11/asyncio/events.py", line 80 in _run
  File "/home/q/pub/install/lib/python3.11/asyncio/base_events.py", line 1858 
in _run_once
  File "/home/q/pub/install/lib/python3.11/asyncio/base_events.py", line 591 in 
run_forever
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/platform/asyncio.py",
 line 199 in start
  File "/home/q/pub/install/lib/python3.11/threading.py", line 968 in run
  File "/home/q/pub/install/lib/python3.11/threading.py", line 1031 in 
_bootstrap_inner
  File "/home/q/pub/install/lib/python3.11/threading.py", line 988 in _bootstrap

Extension modules: tornado.speedups, _brotli, _cffi_backend (total: 3)
zsh: segmentation fault (core dumped)  pytest
```

```
= test session starts 
=
platform linux -- Python 3.11.0a2+, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/q/pub/urllib3, configfile: setup.cfg
collected 1 item
  

test/test_reproduce.py Fatal Python error: Segmentation fault

Thread 0x7fee9a250640 (most recent call first):
  File "/home/q/pub/install/lib/python3.11/ssl.py", line 1346 in do_handshake
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/iostream.py", 
line 1391 in _do_ssl_handshake
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/iostream.py", 
line 1478 in _handle_read
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/iostream.py", 
line 696 in _handle_events
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/platform/asyncio.py",
 line 189 in _handle_events
  File "/home/q/pub/install/lib/python3.11/asyncio/events.py", line 80 in _run
  File "/home/q/pub/install/lib/python3.11/asyncio/base_events.py", line 1858 
in _run_once
  File "/home/q/pub/install/lib/python3.11/asyncio/base_events.py", line 591 in 
run_forever
  File 
"/home/q/pub/urllib3/venv/lib/python3.11/site-packages/tornado/platform/asyncio.py",
 line 199 in start
  File "/home/q/pub/install/lib/python3.11/threading.py", line 968 in run
  File "/home/q/pub/install/lib/python3.11/threading.py", line 1031 in 
_bootstrap_inner
  File "/home/q/pub/install/lib/python3.11/threading.py", line 988 in _bootstrap

Extension modules: tornado.speedups, _brotli, _cffi_backend (total: 3)
zsh: segmentation fault (core dumped)  pytest
```

I can work on a better reproducer, but thought this was already interesting as 
https://github.com/python/cpython/pull/29977 states there should have been zero 
change in behavior.

--
components: Interpreter Core
messages: 410166
nosy: Quentin.Pradet, SethMichaelLarson, eric.snow
priority: normal
severity: normal
status: open
title: runtime/interp/thread state refactoring leads to segmentation fault
type: crash
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



[issue46313] SSLObject does not raise SSLEOFError on OpenSSL 3

2022-01-09 Thread Alex Grönholm

Alex Grönholm  added the comment:

Good to see that this is being handled. I could try to write a patch to do what 
I suggested above, if you're willing to review it.

--

___
Python tracker 

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



[issue46313] SSLObject does not raise SSLEOFError on OpenSSL 3

2022-01-09 Thread Christian Heimes


Christian Heimes  added the comment:

Petr and Charis are aware that there are issues with OpenSSL 3.0 support. RHEL 
9 FIPS support is broken as well. It's also documented in the release notes and 
I just wrote an email to python-dev, too.

--

___
Python tracker 

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



[issue46285] http/server.py wont respect its protocol_version

2022-01-09 Thread Hugo Almeida


Hugo Almeida  added the comment:

Hi, buddy, there is no problem if invoke the http.server.test function as its 
designed, I mean the function iteself is okay, thus http/server.py invoked it 
via the functools.partial wrapper (handler_class) only will case this issue, 
which technically ignored its protocol parameter's specify. User of 
http/server.py::test should specify a handler class directly.

If this is a bug, maybe it is about the usage/desire of `functools.partial` ... 
I am not sure, closure model programming (the lambda etc.) is not eary for me 
and I closed this issue by courtesy yesterday, if reopen this issue will 
help/valueable a bit, please tell me.

Improve my English seems too nessary, thank you so much for your warm hearted.

--

___
Python tracker 

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



[issue46313] SSLObject does not raise SSLEOFError on OpenSSL 3

2022-01-09 Thread Alex Grönholm

Alex Grönholm  added the comment:

I hope the Fedora maintainers/packagers know this because on Rawhide, Python is 
being compiled against OpenSSL 3 (which is how we discovered the problem). F36 
is due out in a little over 3 months.

--

___
Python tracker 

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



[issue46319] datetime.utcnow() should return a timezone aware datetime

2022-01-09 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +belopolsky, p-ganssle
versions:  -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



[issue46249] [sqlite3] lastrowid improvements

2022-01-09 Thread Mariusz Felisiak


Change by Mariusz Felisiak :


--
nosy: +felixxm

___
Python tracker 

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



[issue46285] http/server.py wont respect its protocol_version

2022-01-09 Thread Éric Araujo

Éric Araujo  added the comment:

I am a bit confused!

The script you attached is to show a problem, but you’re saying there is no 
problem?

--

___
Python tracker 

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



[issue46315] Add support for WebAssembly System Interface (wasm32-wasi)

2022-01-09 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue46319] datetime.utcnow() should return a timezone aware datetime

2022-01-09 Thread Tony Rice


New submission from Tony Rice :

datetime.datetime.utcnow()

returns a timezone naive datetime, this is counter-intuitive since you are 
logically dealing with a known timezone. I suspect this was implemented this 
way for fidelity with the rest of datetime.datetime (which returns timezone 
naive datetime objects).

The workaround (see below) is to replace the missing tzinfo.

Recommendation:
By default datetime.datetime.utcnow() should return a timezone aware datetime 
(with tzinfo of UTC of course) or at least offer this behavoir as an option, 

e.g.:

datetime.datetime.utcnow(timezone-aware=True)

Workaround:
dt = datetime.utcnow().replace(tzinfo=timezone.utc)

--
components: Library (Lib)
messages: 410160
nosy: rtphokie
priority: normal
severity: normal
status: open
title: datetime.utcnow() should return a timezone aware datetime
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-09 Thread Simon Wrede


Change by Simon Wrede :


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

___
Python tracker 

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



[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue46313] SSLObject does not raise SSLEOFError on OpenSSL 3

2022-01-09 Thread Christian Heimes


Christian Heimes  added the comment:

This is not a security issue because OpenSSL 3.0.0 is not officially supported 
yet. OpenSSL 3.0.0 support is prelimiary, experimental, and provisional.

>From https://docs.python.org/3/whatsnew/3.10.html#ssl

> The ssl module has preliminary support for OpenSSL 3.0.0.

--

___
Python tracker 

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



[issue46272] Fix bitwise and logical terminology in python.gram

2022-01-09 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



[issue46272] Fix bitwise and logical terminology in python.gram

2022-01-09 Thread miss-islington


miss-islington  added the comment:


New changeset 1bee9a4625e101d3308831de37590f4e2f57c71c by Mark Dickinson in 
branch 'main':
bpo-46272: Fix two heading comments in python.gram (GH-30499)
https://github.com/python/cpython/commit/1bee9a4625e101d3308831de37590f4e2f57c71c


--
nosy: +miss-islington

___
Python tracker 

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



[issue43698] Use syntactically correct examples on abc package page

2022-01-09 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Thank you, I fully agree that this can be improved.

Please, take a look at https://github.com/python/cpython/pull/30502
I will apprecaite your review!

--
stage: patch review -> 

___
Python tracker 

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



[issue43698] Use syntactically correct examples on abc package page

2022-01-09 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 2.0 -> 3.0
pull_requests: +28708
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30502

___
Python tracker 

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



[issue46316] Optimize pathlib.Path.iterdir()

2022-01-09 Thread Barney Gale


Change by Barney Gale :


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

___
Python tracker 

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



[issue46318] asyncio and ssl: ResourceWarning: unclosed transport

2022-01-09 Thread Julien Palard


New submission from Julien Palard :

Originally opened at: https://github.com/aio-libs/aiohttp/issues/6071

Reproducer:


import asyncio


class DumbProtocol(asyncio.Protocol):
def connection_made(self, transport):
print("Connection made")
self.transport = transport

def data_received(self, data):
print("Data received: {!r}".format(data))


async def main():
loop = asyncio.get_running_loop()

for i in range(2):
_, _ = await loop.create_connection(DumbProtocol, "python.org", 
443, ssl=True)
while True:
print("Waiting for the server to close the connection...")
await asyncio.sleep(10)


asyncio.run(main())


Using this reproducer I get a ResourceWarning:

Data received: b"HTTP/1.0 408 Request Time-out\r\nCache-Control: 
no-cache\r\nConnection: close\r\nContent-Type: 
text/html\r\n\r\n408 Request Time-out\nYour browser didn't 
send a complete request in time.\n\n\n"
/usr/lib/python3.9/asyncio/sslproto.py:320: ResourceWarning: unclosed 
transport 
  _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
Object allocated at (most recent call last):
  File "/usr/lib/python3.9/asyncio/sslproto.py", lineno 445
self._app_transport = _SSLProtocolTransport(self._loop, self)

I can also reproduce it on current master.

--
components: asyncio
messages: 410156
nosy: asvetlov, mdk, yselivanov
priority: normal
severity: normal
status: open
title: asyncio and ssl: ResourceWarning: unclosed transport
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46317] Pathlib.rename isn't robust

2022-01-09 Thread Oz Tiram


New submission from Oz Tiram :

Pathlib.rename will fail across file system with:

OSError: [Errno 18] Invalid cross-device link

e.g:
-> path_dict["current_path"].rename(path_dict["destination"])
(Pdb) n
OSError: [Errno 18] Invalid cross-device link: 
'/tmp/pipenv-k1m0oynt-yaml/PyYAML-6.0/lib/yaml' -> 
'/home/oz123/Software/pipenv/pipenv/patched/yaml3'

This is because it uses os.rename under the hood:
https://github.com/python/cpython/blob/3.10/Lib/pathlib.py#L306

One can either replace it with `shutil.move` which works, or one could
add another method to Pathlib.move(...) with similar signature and return 
value, which calls `shutil.move` under the hood.

Before submitting a patch for that, I would like to get feedback for that.

--
components: Library (Lib)
messages: 410155
nosy: Oz.Tiram
priority: normal
severity: normal
status: open
title: Pathlib.rename isn't robust
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



[issue46316] Optimize pathlib.Path.iterdir()

2022-01-09 Thread Barney Gale


New submission from Barney Gale :

pathlib.Path.iterdir() contains the following code:

if name in {'.', '..'}:
# Yielding a path object for these makes little sense
continue

This check is unnecessary as os.listdir() does not return entries for '.' or 
'..':

os.listdir(path='.')
Return a list containing the names of the entries in the
directory given by path. The list is in arbitrary order, and
does not include the special entries '.' and '..' even if they
are present in the directory

See https://docs.python.org/3/library/os.html#os.listdir

--
components: Library (Lib)
messages: 410154
nosy: barneygale
priority: normal
severity: normal
status: open
title: Optimize pathlib.Path.iterdir()
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



[issue46315] Add support for WebAssembly System Interface (wasm32-wasi)

2022-01-09 Thread Christian Heimes


New submission from Christian Heimes :

WASI is another WebAssembly platform similar to Emscripten (bpo-40280). Simply 
speaking Emscripten binaries (wasm32-emscripten) run inside a browser while 
WASI binaries target standalone runtimes like wasmtime [2][3] on the host. The 
lines are a bit blurry, as it is possible to run WASI binaries in the browser 
with help of JS-polyfills. WASI provides compile once, run anyway with JIT/AOT 
and sandboxing.

WASI is still under development and is lacking several core features:

- threading support and pthread API
- sockets
- signals are emulated (_WASI_EMULATED_SIGNAL and -lwasi-emulated-signal)
- DAC APIs like chmod, umask
- user-related APIs like pwd, grp
- dup(), dup2(), F_DUPFD

For 3.11 I plan to fix our use of #ifdef HAVE_FEATURE to make it easier to 
experiment with WASI. The pthread APIs need stubs, which I won't commit to 3.11 
upstream yet.

[1] https://wasi.dev/
[2] https://github.com/bytecodealliance/wasmtime
[3] 
https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/

--
assignee: christian.heimes
components: Build
messages: 410153
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Add support for WebAssembly System Interface (wasm32-wasi)
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



[issue46225] f_lasti behaves differently for lambdas returned from loops

2022-01-09 Thread Ned Batchelder


Ned Batchelder  added the comment:

Thanks, it does help.

While updating coverage.py to use the RESUME information, I found another 
problem:  https://bugs.python.org/issue46314

--

___
Python tracker 

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



[issue46314] Stray RESUME opcode for unused lambda

2022-01-09 Thread Ned Batchelder


New submission from Ned Batchelder :

This code seems to get a RESUME opcode where no function call is happening:

a = 1
fn = lambda 2
b = 3

Here is the disassembly. Offset 6 has a RESUME opcode for line 2:


Python 3.11.0a3+ (heads/main:0fc58c1e05, Jan  8 2022, 19:45:58) [Clang 12.0.0 
(clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dis
>>> dis.dis("""\
... a = 1
... fn = lambda: 2
... b = 3
... """)
  0 RESUME   0

  1   2 LOAD_CONST   0 (1)
  4 STORE_NAME   0 (a)

  2   6 RESUME   0
  8 LOAD_CONST   1 ( at 
0x10772c2d0, file "", line 2>)
 10 MAKE_FUNCTION0
 12 STORE_NAME   1 (fn)

  3  14 LOAD_CONST   2 (3)
 16 STORE_NAME   2 (b)
 18 LOAD_CONST   3 (None)
 20 RETURN_VALUE

Disassembly of  at 0x10772c2d0, file "", line 2>:
  2   0 RESUME   0
  2 LOAD_CONST   1 (2)
  4 RETURN_VALUE


This causes an extra "call" event when tracing:

---< bug233.py >
import linecache, os.path, sys

def trace(frame, event, arg):
if (event != "line") and ("bug233" in frame.f_code.co_filename):
lineno = frame.f_lineno
first = frame.f_code.co_firstlineno
source = linecache.getline(frame.f_code.co_filename, lineno) if lineno 
else "**"
file = os.path.basename(frame.f_code.co_filename)
print("{} {}@{!s:4} (first={}): {}".format(event[:4], file, lineno, 
first, source.rstrip()))
return trace

print(sys.version)
sys.settrace(trace)

def f():
a = 1
fn = lambda: 2
b = 3
f()


% python3.10 bug233.py
3.10.1 (main, Dec 14 2021, 08:30:13) [Clang 12.0.0 (clang-1200.0.32.29)]
call bug233.py@15   (first=15): def f():
retu bug233.py@18   (first=15): b = 3

% python3.11 bug233.py
3.11.0a3+ (heads/main:0fc58c1e05, Jan  8 2022, 19:45:58) [Clang 12.0.0 
(clang-1200.0.32.29)]
call bug233.py@15   (first=15): def f():
call bug233.py@17   (first=15): fn = lambda: 2
retu bug233.py@18   (first=15): b = 3

--
components: Interpreter Core
keywords: 3.11regression
messages: 410151
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: Stray RESUME opcode for unused lambda
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



[issue46313] SSLObject does not raise SSLEOFError on OpenSSL 3

2022-01-09 Thread Alex Grönholm

Alex Grönholm  added the comment:

This is a security issue because it exposes users to TLS truncation attacks 
that weren't possible before because such attempts would raise SSLEOFError.

--

___
Python tracker 

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



[issue46313] SSLObject does not raise SSLEOFError on OpenSSL 3

2022-01-09 Thread Christian Heimes


Change by Christian Heimes :


--
assignee: christian.heimes -> 
type: security -> behavior

___
Python tracker 

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



[issue46264] 'I'.lower() should give non dotted i for LANG=tr_TR

2022-01-09 Thread Frank Feuerbacher

Frank Feuerbacher  added the comment:

Using casefold did not help

ubuntu Lang is en_US.UTF-8
[GCC 9.3.0] on linux
>>> folded_1: str = "Turkish I: İı".casefold()
>>> folded_2: str = "tUrkİsh i: iI".casefold()
>>> print(folded_1)
turkish i: i̇ı
>>> print(folded_2)
turki̇sh i: ii
>>> print(folded_1==folded_2)
False

It exhibits the same shortcoming as toLower.
multi-language support ain't easy, especially when everything you learned about 
strings ain't true.

--

___
Python tracker 

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What are the use cases for this feature?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46312] range() function could accept slice() objects as parameters

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Accepting a slice directly in the range constructor is ambiguous. What to do if 
start or stop are negative or None? What if stop is less than start? You need 
to specify a sequence length to handle these cases.

Maybe the following expressions work for you:

   range(length)[s]

or

   range(*s.indices(length))

But other users may need different behavior (if they want convert slice(-20, 
-10) to range(-20, -10)). There is no general solution which would work for 
all, you have to code what you need.

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue46313] SSLObject does not raise SSLEOFError on OpenSSL 3

2022-01-09 Thread Alex Grönholm

New submission from Alex Grönholm :

PR #25309 (https://github.com/python/cpython/pull/25309) changed OpenSSL 
behavior so that it ignores unexpected EOFs by default. This was detected by 
the test suites of both trio and AnyIO when running on OpenSSL 3.

We worked around the problem by explicitly unsetting the 
SSL_OP_IGNORE_UNEXPECTED_EOF flag and then checking if the "strerror" attribute 
of SSLError contains the text "UNEXPECTED_EOF_WHILE_READING".

The remedy in the standard library would be twofold:
1. Revert the change of enabling SSL_OP_IGNORE_UNEXPECTED_EOF by default
2. Handle the condition properly so that SSLEOFError is raised instead of the 
generic SSLError

As SSLSockets ignore SSLEOFError by default, this fix should work fine for 
those too.

--
assignee: christian.heimes
components: SSL
messages: 410146
nosy: alex.gronholm, christian.heimes, lukasz.langa
priority: normal
severity: normal
status: open
title: SSLObject does not raise SSLEOFError on OpenSSL 3
type: security
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2d787971c65b005d0cce219399b9a8e2b70d4ef4 by Serhiy Storchaka in 
branch 'main':
bpo-37295: Use constant-time comb() and perm() for larger n depending on k 
(GH-30305)
https://github.com/python/cpython/commit/2d787971c65b005d0cce219399b9a8e2b70d4ef4


--

___
Python tracker 

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



[issue46312] range() function could accept slice() objects as parameters

2022-01-09 Thread yota moteuchi


Change by yota moteuchi :


--
components: +Interpreter Core -Library (Lib)

___
Python tracker 

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



[issue46307] string.Template should allow inspection of identifiers

2022-01-09 Thread Ben Kehoe


Ben Kehoe  added the comment:

Having slept on it, I realized that if I was presenting interactive prompts for 
a template, I would expect the prompts to be in order that the identifiers 
appear in the template. Accordingly, I've updated the PR to maintain ordering.

--

___
Python tracker 

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



[issue46312] range() function could accept slice() objects as parameters

2022-01-09 Thread yota moteuchi


Change by yota moteuchi :


--
components: +Library (Lib)

___
Python tracker 

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



[issue46312] range() function could accept slice() objects as parameters

2022-01-09 Thread yota moteuchi


New submission from yota moteuchi :

This improvement proposal is close to : https://bugs.python.org/issue42956 and 
also detailed in 
https://stackoverflow.com/questions/13855288/turn-slice-into-range

to iterate over a slice, the recommended method seems to be : 

s = slice(5,100,3)
for i in range(s.stop)[s] :
# do something

but if range() accepted directly a slice, it would dramatically improve the 
readability :

s = slice(5,100,3)
for i in range(s) :
# do something

and it could be convenient, especially inside the __getitem__ property. I'll 
try to make a quick patch to test...

--
messages: 410143
nosy: yota moteuchi
priority: normal
severity: normal
status: open
title: range() function could accept slice() objects as parameters
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



[issue1598083] Top-level exception handler writes to stdout unsafely

2022-01-09 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46272] Fix bitwise and logical terminology in python.gram

2022-01-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

> So, the meaning of these names like this is, "lt followed by an optional 
> bitwise_or expression"?

That's certainly how I was reading it.

--

___
Python tracker 

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



[issue46272] Fix bitwise and logical terminology in python.gram

2022-01-09 Thread Mark Dickinson


Change by Mark Dickinson :


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

___
Python tracker 

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



[issue46311] Clean up PyLong_FromLong and PyLong_FromLongLong

2022-01-09 Thread Mark Dickinson


Change by Mark Dickinson :


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

___
Python tracker 

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



[issue46311] Clean up PyLong_FromLong and PyLong_FromLongLong

2022-01-09 Thread Mark Dickinson


New submission from Mark Dickinson :

PR GH-27832 inadvertently (I believe) introduced a couple of changes to 
PyLong_FromLong that didn't make a lot of sense: an (unsigned long) cast was 
replaced with (twodigits), and a digit count variable (counting number of 
PyLong digits in a C long) had its type needlessly changed from int to 
Py_ssize_t.

The first change is a potential portability bug, but only on platforms where 
the width of C's `long` exceeds 64 bits. The (unsigned long) cast is obviously 
correct, while figuring out whether (twodigits) loses information takes some 
work.

The second change is merely a potential pessimization: there's no need to use 
what's typically a 64-bit integer to count the number of PyLong digits in a 
long.

While fixing these, I've also reworked the PyLong_FromLong code a bit to move 
the medium int check earlier, and I've applied analogous changes to 
PyLong_FromLongLong.

--
messages: 410141
nosy: Mark.Shannon, mark.dickinson
priority: normal
severity: normal
status: open
title: Clean up PyLong_FromLong and PyLong_FromLongLong
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



[issue40064] py38: document xml.etree.cElementTree will be removed in 3.9

2022-01-09 Thread Irit Katriel


Change by Irit Katriel :


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



[issue28249] doctest.DocTestFinder reports incorrect line numbers with exclude_empty=False

2022-01-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5

___
Python tracker 

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



[issue46294] Integer overflow & Int values loaded into Bool detected via Libfuzzer & UndefinedBehaviorSanitizer

2022-01-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

Thanks for checking, Steven. Your report also helped me to notice a minor 
portability bug (at Objects/longobject.c:288, where the wrong type is used in a 
cast); a fix is in GH-30496.

--

___
Python tracker 

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



[issue28249] doctest.DocTestFinder reports incorrect line numbers with exclude_empty=False

2022-01-09 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 2.0 -> 3.0
pull_requests: +28704
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30498

___
Python tracker 

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



[issue45569] Drop support for 15-bit PyLong digits?

2022-01-09 Thread Mark Dickinson


Mark Dickinson  added the comment:

First step in GH-30497, which changes the default to 30-bit digits 
unconditionally, instead of having the default be platform dependent.

--

___
Python tracker 

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



[issue45569] Drop support for 15-bit PyLong digits?

2022-01-09 Thread Mark Dickinson


Change by Mark Dickinson :


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

___
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

2022-01-09 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 5c66414b5561c54e7a0f4bde8cc3271908ea525e by Ethan Smith in branch 
'main':
bpo-40280: Disable epoll_create in Emscripten config.site (GH-30494)
https://github.com/python/cpython/commit/5c66414b5561c54e7a0f4bde8cc3271908ea525e


--

___
Python tracker 

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



[issue46304] Unable to iterate over lines in a file without a block of code

2022-01-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The safe way of using read_lines() is:

lines = read_lines()
try:
# use lines
finally:
lines.close()

or

with contextlib.closing(read_lines()) as lines:
# use lines

And it is in no way better than using "with open()" directly.

I think it is better to not add such sing to the stdlib because it only makes 
an illusion of safety but actually removes safety guards.

If we want using generators in expressions we need to add support for "with" in 
expressions and comprehensions.

data = json.load(f) with open(path, 'rb') as f
lines = (line.strip() for path in files with open(path) as f for line in f)

--

___
Python tracker 

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



[issue46203] Add timeout for Windows build steps

2022-01-09 Thread Mark Dickinson


Change by Mark Dickinson :


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

___
Python tracker 

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



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

2022-01-09 Thread Ethan Smith


Change by Ethan Smith :


--
pull_requests: +28702
pull_request: https://github.com/python/cpython/pull/30495

___
Python tracker 

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



[issue46148] Optimize pathlib

2022-01-09 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy:  -kumaraditya303

___
Python tracker 

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



[issue46310] Simplify `for` loop in `.close()` method in `asyncio/windows_events`

2022-01-09 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46310] Simplify `for` loop in `.close()` method in `asyncio/windows_events`

2022-01-09 Thread Nikita Sobolev


New submission from Nikita Sobolev :

This line 
https://github.com/python/cpython/blob/3d11c1b8b49800c5c4c295953cc3abf577f6065a/Lib/asyncio/windows_events.py#L842
 uses `.items()`, but the key seems unsused.

It would be better to use `.values()` there.

1. It is slightly faster, very generic benchmark:

```
import timeit
cache = {i: (i, i + 1, None, f'a{i}') for i in range(1000)}
timeit.timeit('list(cache.items())', number=1000, globals=locals())
# 0.18165644304826856
timeit.timeit('list(cache.values())', number=1000, globals=locals())
# 0.04786261299159378
```

2. It is more readable, because unused variables are not created

And since it does not break anything, I think it is safe to refactor.

--
assignee: sobolevn
components: Library (Lib)
messages: 410136
nosy: asvetlov, eric.araujo, sobolevn
priority: normal
severity: normal
status: open
title: Simplify `for` loop in `.close()` method in `asyncio/windows_events`
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