[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



Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread Cameron Simpson
On 09Jan2022 13:08, Dennis Lee Bieber  wrote:
>>Only the four functions that I have written below I have to make and 
>>that’s it. All the input will be entered by the user on a website:
>>1. First, I have to check in the Excel sheet or table whether the book user 
>>has entered is present in the book bank or not.
>>
>   Where does this requirement come from? Who is providing this "Excel
>sheet or table"?

As a spectator, I have the impression that NArshad has to produce a 
little web interface to update records kept in a preexisting business 
system.

I've a friend who earns her $s doing data work for various corporates.  
Anecdotally, _many_ of these use Excel as their storage and work 
backend. Awful, but an existing situation. I infer that NArshad has to 
deal with such a situation.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread Avi Gross via Python-list
Is this thread even close to being on track?
It is not really relevant to argue yet on whether to use EXCEL directly or a 
data.base. Many ways can be used to solve a problem and if the EXCEL sheet will 
never be updated manually or by some other program, it is sort of moot as you 
can ONE TIME transfer the existing data to any form you want and from then on 
work with that.
The higher level requirement of the project is not clear.
Is there a single application that wakes up and processes requests and 
eventually exits? If this is true, then there can be a discussion on how to do 
it, and of course the user can hire someone to do all the work if they are not 
willing to spend the time and learn. Getting it all done for free by volunteers 
is not something many are willing to do.
If multiple processes can dip in and out of the data, often concurrently, that 
is a whole new ball of wax. Others ahve mentioned that. It does not matter 
where the data is as in all cases you need ways to guarantee the data will not 
get messed up
But consider the simple case. Your program starts and runs ALONE. It 
initializes and reads in the data needed and stores it IN MEMORY. It might be 
in one or more pandas DataFrame structures, for example.
Now it processes requests and all the work in searching and updating data is 
done in memory. You can of course save a snapshot, or whatever logging, along 
the way in case of disaster. There are all kinds of ways to handle your needs 
such as searching for a record/row/whatever that contains the book you want, 
checking if it has been lent out, marking it appropriately and so on. The next 
request continues to operate on the in-memory data and your program will notice 
if someone else tries to take out a book no longer marked as available and so 
on. You can add all kinds of functionality to this loop that processes 
requests. Again, you design what  requests look like and how they are seen by 
your process and what replies it gives.
When done, or when you feel like it, you can save your data wherever you want. 
Here is an example of how to write to EXCEL: 
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_excel.html
Of course, many of us would suggest writing to a .CSV file that EXCEL can 
easily open and even update.
Now if you are not trusting, and want to save everything after each transaction 
and maybe even read it back in, fine. You may also want to not overwrite the 
previous file and that may mean renaming the old file or whatever makes you 
happy. If you have a lot of data and serious activity, as many libraries have, 
it could be a bit silly to read in a gigabyte of data all the time and it may 
indeed be a better idea to have a database back end that you send queries to 
and updates that typically are short and quick.
I am not sure why you are even talking about changing column names as normal 
ones can generally be the same. What some may have suggested is calculating 
additional columns from others just in Memory.
As with any tool, you need to learn enough to be dangerous. just copying 
snippets from the web may have drawbacks.
It sounds like one source of confusion is that your EXCEL data takes some 
shortcuts including lists of comma-separated values with multiple names, or 
something similar. That is not necessarily a barrier but may require more 
programming as searching for a specific user embedded within a larger amount of 
text may be harder than parsing the text into some other data structures that 
can more easily be searched individually. If you cannot change what you start 
with, that may be lots of extra work.
And it is not python alone what might require work but other languages like R 
too. 
Perhaps I missed a better description of the design.

-Original Message-
From: Dennis Lee Bieber 
To: python-list@python.org
Sent: Sun, Jan 9, 2022 1:08 pm
Subject: Re: What to write or search on github to get the code for what is 
written below:

On Sun, 9 Jan 2022 08:53:58 -0800 (PST), NArshad 
declaimed the following:

>
>I cannot change the column names.
>
    But you can change the values under those columns? And that implies...
>
>

>No need to save the CSV file once the work is done CSV file will be exited 
>without saving. If the above is going to work then I will be requiring 
>something to see how to do all this that’s why written tutorial. For a more 
>thorough analysis I have written once again what I want to do. 
>

    You probably won't find "A tutorial"... You might find some examples
but you will have to figure out how to use the contents. For example, there
are multiple ways to have Python access Excel -- from simple read and write
modules xlrd/xlwt, (which is out-dated; xlrd does not work with .xlsx
format, only the older .xls format). Please review:
http://www.python-excel.org/ There is also the, on Windows, the potential
to use the pythonwin extensions OR ctypes module to make low-level calls
directly to the Excel DLLs (the 

Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread Peter J. Holzer
On 2022-01-09 13:08:51 -0500, Dennis Lee Bieber wrote:
> there are multiple ways to have Python access Excel -- from simple
> read and write modules xlrd/xlwt, (which is out-dated; xlrd does not
> work with .xlsx format, only the older .xls format).

This is not true. xlrd has supported .xlsx since at least 2014 (when I
started using it). For new projects I would recommend openpyxl though,
which is much more feature-complete.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread MRAB

On 2022-01-09 07:04, NArshad wrote:

On Friday, 7 January 2022 at 02:59:17 UTC+5, alister wrote:
On Thu, 6 Jan 2022 10:55:30 -0800 (PST), NArshad wrote: 

> All this is going to be in python’s flask and HTML only 
> 
> 1. First, I have to check in the Excel sheet or table whether the book 
> user has entered is present in the book bank or not. 
>
Excel is the wrong application for storing this data - it should be in a 
database
> 2. If a book is present and the quantity of the required book is greater 
> than 0 (COPIES_LEFT column in excel file) and if the user wants the 
> book, it will be assigned to the user which he will take from the book 
> bank physically. When COPIES_LEFT will is less than or equal to 0 the 
> message will be “Book finished or not present”.

Again Excel is not the correct application for processing this data
> 
> 3. The quantity of the book in the Excel file will be reduced by 1 in 
> the COPIES_LEFT column and the name of the borrower or user will be 
> entered/added in the Excel file table or sheet already made and the 
> column name is BORROWER’S NAME. 
>

Database!
> 4. The borrower’s or user name can be more than one so they will be 
> separated with a comma in the Excel file BORROWER’S NAME column. 
>

Database
> 
> - All functions mentioned above are to be deployed on the website 
> pythonhow.com so make according to 
> https://pythonhow.com/python-tutorial/flask/web-development-with-python- 
and-flask/ 
> 
> - Do you know any other websites to deploy a python web application?? 
> 
> - No time to switch from Excel to anywhere else. Please do not make any 
> changes to the Excel file. 
> 
> - Tutorials and repositories of the web for such problems are also 
> required. The same is required for python (flask, Django...) also.
Sorry did not spot that this was a homework assignment 
data should still be imported into a DB (a trivial task) It can be 
exported back to a compatible format just as easily if hard copy output is 
required 



As written no time to switch from excel to anywhere else but if a certain 
database is required to make changes in Excel’s cell values then which database 
to use (example Access or what) and after the right selection of the database, 
how to import data to a database and then export back to a compatible format 
that is to Excel cells….

I mean how to do this written below:

“data should still be imported into a DB (a trivial task) it can be exported 
back to a compatible format just as easily if hard copy output is required”

The reason I have written:

“What to write on GitHub or on google search to find the necessary code to 
start with? “

I will also be requiring a code to start with just as most people do. The same 
is the case with tutorials.

This is not homework and I have been checking openpyxl for the last one or two 
months to find what is required by me when I found nothing of what is required 
by me then posted on this google group.



Using openpyxl is pretty straightforward:


from openpyxl import load_workbook
wb = load_workbook(spreadsheet_path)
sheet = wb.active

# Reading the values in cells:
print('Cell A1 contains', sheet['A1'].value)
print('Cell A2 contains', sheet['A2'].value)
print('Cell B1 contains', sheet['B1'].value)

# Alternatively:
print('Cell A1 contains', sheet.cell(1, 1).value)
print('Cell A2 contains', sheet.cell(1, 2).value)
print('Cell B1 contains', sheet.cell(2, 1).value)

# Changing the value in a cell:
sheet.cell(1, 20).value = 'TEST'

# A value of None means that the cell is empty.

wb.save(spreadsheet_path)
wb.close()
--
https://mail.python.org/mailman/listinfo/python-list


[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



Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread NArshad
-Whose time??  
My time
I do not have not time to switch to a database but if necessary I can use the 
database to make changes in Excel column entries. 

-No changes??

I cannot change the column names.


-“maybe the point is that at any time one has to be able to re-export to the 
original excel format?  (And why??  Do we actually need "reporting": then we 
can generate a PDF rather, otherwise we can just send out a CSV... etc.)  Is 
that it?”

PDF is not required and I am not doing any reporting at all. 


-“loading the data from the CSV file in memory into a pandas dataframe, working 
with that, and eventually saving back to the CSV file might be just enough... 
as long as there is never more than one user concurrently using the system, or 
you need also implement some concurrency management (you need that with a 
database, too, anyway): but that's tutorial number 2, and already quite less 
trivial, since to begin with it requires a more thorough analysis”

No need to save the CSV file once the work is done CSV file will be exited 
without saving. If the above is going to work then I will be requiring 
something to see how to do all this that’s why written tutorial. For a more 
thorough analysis I have written once again what I want to do. 

Only the four functions that I have written below I have to make and that’s it. 
All the input will be entered by the user on a website:
1. First, I have to check in the Excel sheet or table whether the book user has 
entered is present in the book bank or not.
 
2. If a book is present and the quantity of the required book is greater than 0 
(COPIES_LEFT column in excel file) and if the user wants the book, it will be 
assigned to the user which he will take from the book bank physically. When 
COPIES_LEFT is less than or equal to 0 the message will be “Book finished or 
not present”.
 
3. The quantity of the book in the Excel file will be reduced by 1 in the 
COPIES_LEFT column and the name of the borrower or user will be entered/added 
in the Excel file table or sheet already made and the column name is BORROWER’S 
NAME.
 
4. The borrower’s or user name can be more than one so they will be separated 
with a comma in the Excel file BORROWER’S NAME column.


-1st save the data from excel as a CSV file

you will find the CSV module makes these much easier to deal with, even if
you do not import into a DB (although even then I would import into SQL-
lite just for the benefits of the search algorithms)

If in order to do the required task it is necessary to use SQLite and without 
using SQLite I cannot do what I want to do then I think I have to go for SQLite 
otherwise CSV looks to me as fine. To do everything using CSV I will be 
requiring a tutorial to see how to do all this. 

Anything not clear?
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread alister via Python-list
On Sun, 9 Jan 2022 08:53:58 -0800 (PST), NArshad wrote:

> -Whose time??
> My time I do not have not time to switch to a database but if necessary
> I can use the database to make changes in Excel column entries.
> 
> -No changes??
> 
> I cannot change the column names.
> 
> 
> -“maybe the point is that at any time one has to be able to re-export to
> the original excel format?  (And why??  Do we actually need "reporting":
> then we can generate a PDF rather, otherwise we can just send out a
> CSV... etc.)  Is that it?”
> 
> PDF is not required and I am not doing any reporting at all.
> 
> 
> -“loading the data from the CSV file in memory into a pandas dataframe,
> working with that, and eventually saving back to the CSV file might be
> just enough... as long as there is never more than one user concurrently
> using the system, or you need also implement some concurrency management
> (you need that with a database, too, anyway): but that's tutorial number
> 2, and already quite less trivial, since to begin with it requires a
> more thorough analysis”
> 
> No need to save the CSV file once the work is done CSV file will be
> exited without saving. If the above is going to work then I will be
> requiring something to see how to do all this that’s why written
> tutorial. For a more thorough analysis I have written once again what I
> want to do.
> 
> Only the four functions that I have written below I have to make and
> that’s it. All the input will be entered by the user on a website:
> 1. First, I have to check in the Excel sheet or table whether the book
> user has entered is present in the book bank or not.
>  
> 2. If a book is present and the quantity of the required book is greater
> than 0 (COPIES_LEFT column in excel file) and if the user wants the
> book, it will be assigned to the user which he will take from the book
> bank physically. When COPIES_LEFT is less than or equal to 0 the message
> will be “Book finished or not present”.
>  
> 3. The quantity of the book in the Excel file will be reduced by 1 in
> the COPIES_LEFT column and the name of the borrower or user will be
> entered/added in the Excel file table or sheet already made and the
> column name is BORROWER’S NAME.
>  
> 4. The borrower’s or user name can be more than one so they will be
> separated with a comma in the Excel file BORROWER’S NAME column.
> 
> 
> -1st save the data from excel as a CSV file
> 
> you will find the CSV module makes these much easier to deal with, even
> if you do not import into a DB (although even then I would import into
> SQL-
> lite just for the benefits of the search algorithms)
> 
> If in order to do the required task it is necessary to use SQLite and
> without using SQLite I cannot do what I want to do then I think I have
> to go for SQLite otherwise CSV looks to me as fine. To do everything
> using CSV I will be requiring a tutorial to see how to do all this.
> 
> Anything not clear?

Sql-lite is not essential to the task CSV would be sufficient, but you may 
find that taking the time to learn it pays off later (even if you wait 
untill after this project)




-- 
Trying to establish voice contact ... please yell into 
keyboard.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread alister via Python-list
On Sat, 8 Jan 2022 23:04:20 -0800 (PST), NArshad wrote:

> On Friday, 7 January 2022 at 02:59:17 UTC+5, alister wrote:
>> On Thu, 6 Jan 2022 10:55:30 -0800 (PST), NArshad wrote:
>> 
>> > All this is going to be in python’s flask and HTML only
>> > 
>> > 1. First, I have to check in the Excel sheet or table whether the
>> > book user has entered is present in the book bank or not.
>> >
>> Excel is the wrong application for storing this data - it should be in
>> a database
>> > 2. If a book is present and the quantity of the required book is
>> > greater than 0 (COPIES_LEFT column in excel file) and if the user
>> > wants the book, it will be assigned to the user which he will take
>> > from the book bank physically. When COPIES_LEFT will is less than or
>> > equal to 0 the message will be “Book finished or not present”.
>> Again Excel is not the correct application for processing this data
>> > 
>> > 3. The quantity of the book in the Excel file will be reduced by 1 in
>> > the COPIES_LEFT column and the name of the borrower or user will be
>> > entered/added in the Excel file table or sheet already made and the
>> > column name is BORROWER’S NAME.
>> >
>> Database!
>> > 4. The borrower’s or user name can be more than one so they will be
>> > separated with a comma in the Excel file BORROWER’S NAME column.
>> >
>> Database
>> > 
>> > - All functions mentioned above are to be deployed on the website
>> > pythonhow.com so make according to
>> > https://pythonhow.com/python-tutorial/flask/web-development-with-
python-
>> and-flask/
>> > 
>> > - Do you know any other websites to deploy a python web application??
>> > 
>> > - No time to switch from Excel to anywhere else. Please do not make
>> > any changes to the Excel file.
>> > 
>> > - Tutorials and repositories of the web for such problems are also
>> > required. The same is required for python (flask, Django...) also.
>> Sorry did not spot that this was a homework assignment data should
>> still be imported into a DB (a trivial task) It can be exported back to
>> a compatible format just as easily if hard copy output is required
>> 
>> 
>> 
>> 
>> --
>> "Rembrandt's first name was Beauregard, which is why he never used it."
>> -- Dave Barry
> 
> 
> 
> As written no time to switch from excel to anywhere else but if a
> certain database is required to make changes in Excel’s cell values then
> which database to use (example Access or what) and after the right
> selection of the database, how to import data to a database and then
> export back to a compatible format that is to Excel cells….
> 
> I mean how to do this written below:
> 
> “data should still be imported into a DB (a trivial task) it can be
> exported back to a compatible format just as easily if hard copy output
> is required”
> 
> The reason I have written:
> 
> “What to write on GitHub or on google search to find the necessary code
> to start with? “
> 
> I will also be requiring a code to start with just as most people do.
> The same is the case with tutorials.
> 
> This is not homework and I have been checking openpyxl for the last one
> or two months to find what is required by me when I found nothing of
> what is required by me then posted on this google group.

1st save the data from excel as a csv file

you will find the csv module makes these much easier to deal with, even if 
you do not import into a db (although even then I would import into sql-
lite just for the benefits of the search algorithms)




-- 
Sometime in 1993 NANCY SINATRA will lead a BLOODLESS COUP on GUAM!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread NArshad
On Friday, 7 January 2022 at 02:59:17 UTC+5, alister wrote:
> On Thu, 6 Jan 2022 10:55:30 -0800 (PST), NArshad wrote: 
> 
> > All this is going to be in python’s flask and HTML only 
> > 
> > 1. First, I have to check in the Excel sheet or table whether the book 
> > user has entered is present in the book bank or not. 
> >
> Excel is the wrong application for storing this data - it should be in a 
> database
> > 2. If a book is present and the quantity of the required book is greater 
> > than 0 (COPIES_LEFT column in excel file) and if the user wants the 
> > book, it will be assigned to the user which he will take from the book 
> > bank physically. When COPIES_LEFT will is less than or equal to 0 the 
> > message will be “Book finished or not present”.
> Again Excel is not the correct application for processing this data
> > 
> > 3. The quantity of the book in the Excel file will be reduced by 1 in 
> > the COPIES_LEFT column and the name of the borrower or user will be 
> > entered/added in the Excel file table or sheet already made and the 
> > column name is BORROWER’S NAME. 
> >
> Database!
> > 4. The borrower’s or user name can be more than one so they will be 
> > separated with a comma in the Excel file BORROWER’S NAME column. 
> >
> Database
> > 
> > - All functions mentioned above are to be deployed on the website 
> > pythonhow.com so make according to 
> > https://pythonhow.com/python-tutorial/flask/web-development-with-python- 
> and-flask/ 
> > 
> > - Do you know any other websites to deploy a python web application?? 
> > 
> > - No time to switch from Excel to anywhere else. Please do not make any 
> > changes to the Excel file. 
> > 
> > - Tutorials and repositories of the web for such problems are also 
> > required. The same is required for python (flask, Django...) also.
> Sorry did not spot that this was a homework assignment 
> data should still be imported into a DB (a trivial task) It can be 
> exported back to a compatible format just as easily if hard copy output is 
> required 
> 
> 
> 
> 
> -- 
> "Rembrandt's first name was Beauregard, which is why he never used it." 
> -- Dave Barry



As written no time to switch from excel to anywhere else but if a certain 
database is required to make changes in Excel’s cell values then which database 
to use (example Access or what) and after the right selection of the database, 
how to import data to a database and then export back to a compatible format 
that is to Excel cells….  

I mean how to do this written below:

“data should still be imported into a DB (a trivial task) it can be exported 
back to a compatible format just as easily if hard copy output is required”

The reason I have written:

“What to write on GitHub or on google search to find the necessary code to 
start with? “

I will also be requiring a code to start with just as most people do. The same 
is the case with tutorials.  

This is not homework and I have been checking openpyxl for the last one or two 
months to find what is required by me when I found nothing of what is required 
by me then posted on this google group. 


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extracting dataframe column with multiple conditions on row values

2022-01-09 Thread Edmondo Giovannozzi
Il giorno sabato 8 gennaio 2022 alle 23:01:13 UTC+1 Avi Gross ha scritto:
> I have to wonder if when something looks like HOMEWORK, if it should be 
> answered in detail, let alone using methods beyond what is expected in class. 
> The goal of this particular project seems to be to find one (or perhaps more) 
> columns in some data structure like a dataframe that match two conditions 
> (containing a copy of two numbers in one or more places) and then KNOW what 
> column it was in. The reason I say that is because the next fairly 
> nonsensical request is to then explicitly return what that column has in the 
> row called 2, meaning the third row. 
> Perhaps stated another way: "what it the item in row/address 2 of the column 
> that somewhere contains two additional specified contents called key1 and 
> key2"  
> My guess is that if the instructor wanted this to be solved using methods 
> being taught, then loops may well be a way to go. Python and numpy/pandas 
> make it often easier to do things with columns rather than in rows across 
> them, albeit many things allow you to specify an axis. So, yes, transposing 
> is a way to go that transforms the problem in a way easier to solve without 
> thinking deeply. Some other languages allow relatively easy access in both 
> directions of horizontally versus vertically. And this may be an example 
> where solving it as a list of lists may also be easier.  
> Is the solution at the bottom a solution? Before I check, I want to see if I 
> understand the required functionality and ask if it is completely and 
> unambiguously specified.  
> For completeness, the question being asked may need to deal with a uniqueness 
> issue. Is it possible multiple columns match the request and thus more than 
> one answer is required to be returned? Is the row called 2 allowed to 
> participate in the match or must it be excluded and the question becomes to 
> find one (or more) columns that contain key1 somewhere else than row 2 and 
> key2 (which may have to be different than key1 or not) somewhere else and 
> THEN provide the corresponding entry from row 2 and that (or those) 
> column(s)? 
> So in looking at the solution offered, what exactly was this supposed to do 
> when dft is the transpose?
> idt = (dft[0] == 1) & (dft[1] == 5)
> Was the code (way below in this message) tried out or just written for us to 
> ponder? I tried it. I got an answer of: 0 1 2 
>V2 1 5 6 
> That is not my understanding of what was requested. Row 2 (shown transposed 
> as a column) is being shown as a whole. The request was for item "2" which 
> would be just 6. Something more like this: 
> print(dft[idt][2]) 
> 
> But the code makes no sense to me.  seems to explicitly test the first column 
> (0) to see if it contains a 1 and then the second column (1) to see if it 
> contains a 5. Not sure who cares about this hard-wired query as this is not 
> my understanding of the question. You want any of the original three rows 
> (now transposed)  tested to see if it contains BOTH.  
> I may have read the requirements wrong or it may not be explained well. Until 
> I am sure what is being asked and whether there is a good reason someone 
> wants a different solution, I see no reason to provide yet another 
> solution.But just for fund, assuming dft contains the transpose of the 
> original data, will this work? 
> first = dft[dft.values == key1 ]second = first[first.values == key2 
> ]print(second[2]) 
> I get a 6 as an answer and suppose it could be done in one more complex 
> expression if needed! LOL!
> -Original Message- 
> From: Edmondo Giovannozzi  
> To: pytho...@python.org 
> Sent: Sat, Jan 8, 2022 8:00 am 
> Subject: Re: Extracting dataframe column with multiple conditions on row 
> values 
> 
> Il giorno sabato 8 gennaio 2022 alle 02:21:40 UTC+1 dn ha scritto: 
> > Salaam Mahmood, 
> > On 08/01/2022 12.07, Mahmood Naderan via Python-list wrote: 
> > > I have a csv file like this 
> > > V0,V1,V2,V3 
> > > 4,1,1,1 
> > > 6,4,5,2 
> > > 2,3,6,7 
> > > 
> > > And I want to search two rows for a match and find the column. For 
> > > example, I want to search row[0] for 1 and row[1] for 5. The 
> > > corresponding 
> > > column is V2 (which is the third column). Then I want to return the value 
> > > at row[2] and the found column. The result should be 6 then. 
> > Not quite: isn't the "found column" also required? 
> > > I can manually extract the specified rows (with index 0 and 1 which are 
> > > fixed) and manually iterate over them like arrays to find a match. Then I 
> > Perhaps this idea has been influenced by a similar solution in another 
> > programming language. May I suggest that the better-answer you seek lies 
> > in using Python idioms (as well as Python's tools)... 
> > > key1 = 1 
> > > key2 = 5 
> > Fine, so far - excepting that this 'problem' is likely to be a small 
> > part of some larger system. Accordingly, consider writing it as a 
> > function. In which 

[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