[issue41859] Uncaught ValueError

2020-09-30 Thread Patricia Timmers


Patricia Timmers  added the comment:

JRequest Id: 74c342d8-c8af-46fe-a488-837736590d01
Correlation Id: 79fac27b-d04d-4597-9bfd-ee7624927c4e
Timestamp: 2020-10-01T04:53:13Z
Message: AADSTS750054: SAMLRequest or SAMLResponse must be present as query 
string parameters in HTTP request for SAML Redirect binding.

--
nosy: +patanjalisutra666
Added file: https://bugs.python.org/file49480/debian-desktop.png

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

Now the suggestion is applied!
Thank you Pablo and Victor!!!

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-30 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset fa7ce080175f65d678a7d5756c94f82887fc9803 by Dong-hee Na in branch 
'master':
bpo-41870: Avoid the test when nargs=0 (GH-22462)
https://github.com/python/cpython/commit/fa7ce080175f65d678a7d5756c94f82887fc9803


--

___
Python tracker 

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



Re: Problem

2020-09-30 Thread Grant Edwards
On 2020-09-30, Mirko via Python-list  wrote:

> We are seeing these troubles from newcomers on Windows all of the
> time -- and that for years. Isn't it time to ask if the way Python
> installs itself on Windows-Systems is appropriate?

And that's been asked every few months for years.

Time and time again, people suggest that the installer should be
tweaked to end with a page explaining how to run python, or that some
sort of "launcher" or other be added.  Those sound like good ideas to
me (even though I'm not sure exactly what the "launger" suggestion
is), but I'm a Linux user, so what do I know?

--
Grant



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


Re: Problem

2020-09-30 Thread Grant Edwards
On 2020-09-30, Eryk Sun  wrote:
> On 9/30/20, Mirko via Python-list  wrote:
>>
>> I have only limited knowledge about current Windows systems. But it
>> seems to me that newcomers download some setup exe/msi and then
>> search the menu to run what ever is found (python.exe or even the
>> setup-program.)
>
> It might help some people who try to run Python via the installer if
> it actually had "installer" in the name. For example,
> "python-3.8.5-amd64-installer.exe" instead of
> "python-3.8.5-amd64.exe".

Yep. And, that too has been suggested many times over the years.

--
Grant

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


[issue41899] Poor example for Element.remove()

2020-09-30 Thread WoodyWoo


WoodyWoo  added the comment:

Could I say the mutable sequence containing not the object but the pointer like 
C++.
So they can changed in def functions.

--

___
Python tracker 

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



[issue41859] Uncaught ValueError

2020-09-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't have a reproducer.  The event occurred one in a full-day session.

I don't get a completion box.

--

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread WoodyWoo


WoodyWoo  added the comment:

@eric.smith @scoder @serhiy.storchaka Thank U all.
I get what to do,and still think the "for in" structure should rebuilding.
All three methods:

import xml.etree.ElementTree as ET 
xmlstr=\
r'''


2
2008
141100




5
2011
59900



69
2011
13600




69
2011
13600



'''
print(xmlstr)

#orginal code
root = ET.fromstring(xmlstr)
for country in root.findall('country'):
rank = int(country.find('rank').text)
if rank > 50:
root.remove(country)
print("___orginal___")
for country in root.findall('country'):
print (country.get("name"))
print("^^^orginal\n")

#wrong code in my mind
root = ET.fromstring(xmlstr)
for country in root:
rank = int(country.find('rank').text)
if rank > 50:
root.remove(country)
print("___bad___")
for country in root.findall('country'):
print (country.get("name"))
print("^^^bad\n")

#my code
root = ET.fromstring(xmlstr)
index=0
count=len(root.findall("./*"))
while index 50:
root.remove(root[index])
index=index+0
count=count-1  # avoid index err
continue
index=index+1
print("___new___")
for country in root.findall('country'):
print (country.get("name"))
print("^^^new\n")

--

___
Python tracker 

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



[issue36255] Provide a simple way to delete and edit python's welcome message

2020-09-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



Re: A library that converts a type-annotated function into a webpage with HTML forms?

2020-09-30 Thread Kushal Kumaran
On Wed, Sep 30 2020 at 04:45:47 PM, James Lu  wrote:
> Is there a python library available that converts a type-annotated Python
> function into a webpage with HTML forms?
>
> Something like:
>
>
> def foo(name: str, times: int):
> return f"Hello {name}!" * times
>
> serve_from(foo, host="0.0.0.0", port=3000)
>
> Turning into a server that serves something like this:
>
> 
> name
> 
> 
> 
>
> And hitting the submit button executes the function.
>
> I'm aware I could use sls, and build a form manually, but that's extra work.

https://fastapi.tiangolo.com/

https://fastapi.tiangolo.com/tutorial/path-params/#documentation

Depending on what you need to use the forms for, this might suffice.

-- 
regards,
kushal
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41899] Poor example for Element.remove()

2020-09-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

As you've seen, the example is correct. I made the same mistake earlier today.

For others: see also #41891 for a suggestion to improve the documentation.

As was pointed out in that issue, it's generally true in Python that you should 
not mutate a sequence while iterating over it.

--
nosy: +eric.smith

___
Python tracker 

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



[issue41899] Poor example for Element.remove()

2020-09-30 Thread WoodyWoo


WoodyWoo  added the comment:

The docs should specially tell that when need root.remove(child) must works 
with "for child  in root.findall()".

And my code with "while if continue" could make root.insert(index,newchild) 
easily.

--

___
Python tracker 

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



[issue41899] Poor example for Element.remove()

2020-09-30 Thread WoodyWoo

WoodyWoo  added the comment:

My fault.
"for country in root.findall('country')“ is not working as same as "for country 
in root"
all 3 method below:

import xml.etree.ElementTree as ET 
xmlstr=\
r'''


2
2008
141100




5
2011
59900



69
2011
13600




69
2011
13600



'''
print(xmlstr)

#orginal code
root = ET.fromstring(xmlstr)
for country in root.findall('country'):
rank = int(country.find('rank').text)
if rank > 50:
root.remove(country)
print("___orginal___")
for country in root.findall('country'):
print (country.get("name"))
print("^^^orginal\n")

#wrong code in my mind
root = ET.fromstring(xmlstr)
for country in root:
rank = int(country.find('rank').text)
if rank > 50:
root.remove(country)
print("___bad___")
for country in root.findall('country'):
print (country.get("name"))
print("^^^bad\n")

#my code
root = ET.fromstring(xmlstr)
index=0
count=len(root.findall("./*"))
while index 50:
root.remove(root[index])
index=index+0
count=count-1  # avoid index err
continue
index=index+1
print("___new___")
for country in root.findall('country'):
print (country.get("name"))
print("^^^new\n")

--

___
Python tracker 

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



[issue41899] Poor example for Element.remove()

2020-09-30 Thread WoodyWoo


WoodyWoo  added the comment:

#new code to avoid an err
index=0
count=len(root.findall("./*"))
while index 50:
root.remove(root[index])
index=index+0
count=count-1  # avoid index err
continue
index=index+1

--

___
Python tracker 

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



[issue37294] concurrent.futures.ProcessPoolExecutor state=finished raised error

2020-09-30 Thread Kyle Stanley


Kyle Stanley  added the comment:

DanilZ, could you take a look at the superseding issue 
(https://bugs.python.org/issue37297) and see if your exception raised within 
the job is the same?  

If it's not, I would suggest opening a separate issue (and linking to it in a 
comment here), as I don't think it's necessarily related to this one. 
"state=finished raised error" doesn't indicate the specific exception that 
occurred. A good format for the name would be something along the lines of:

"ProcessPoolExecutor.submit()  while reading 
large object (4GB)"

It'd also be helpful in the separate issue to paste the full exception stack 
trace, specify OS, and multiprocessing start method used (spawn, fork, or 
forkserver). This is necessary to know for replicating the issue on our end.

In the meantime, I workaround I would suggest trying would be to use the  
*chunksize* parameter (or *Iterator*) in pandas.read_csv(), and split it across 
several jobs (at least 4+, more if you have additional cores) instead of within 
a single one. It'd also be generally helpful to see if that alleviates the 
problem, as it could possibly indicate an issue with running out of memory when 
the dataframe is converted to pickle format (which often increases the total 
size) within the process associated with the job.

--
nosy: +aeros

___
Python tracker 

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



[issue41703] Most bytecode changes are absent from Python 3.9 What's new

2020-09-30 Thread Matthieu Dartiailh


Matthieu Dartiailh  added the comment:

Looking at the current version of the page 
https://docs.python.org/3.9/whatsnew/3.9.html#cpython-bytecode-changes I still 
see only the LOAD_ASSERTION_ERROR. It seems the changelog got updated but not 
the What's new

--

___
Python tracker 

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



[issue41899] Poor example for Element.remove()

2020-09-30 Thread WoodyWoo

New submission from WoodyWoo :

We can remove elements using Element.remove(). Let’s say we want to remove all 
countries with a rank higher than 50:

>>>
>>> for country in root.findall('country'):
... rank = int(country.find('rank').text)
... if rank > 50:
... root.remove(country)
...
>>> tree.write('output.xml')

When the original xml has over 2 country with  rank>50,and they are one by one 
neighborly siblings element,the upper code will delete the 1st 3rd 5th and more 
odd No. country.
A proper example should be:
index=0
while index < len(root.findall("./*")):
rank = int (root[index].find("rank").text)
if rank>50:
root.remove(root[index])
index=index+0
continue
index=index+1


I think "for each in list" should not work by index,but should work by pointer 
like thing,could be a list of pointers.
A finial solution should be like this --- when the "for each in list" was 
acting,the pointers list would be fixed,and you need not to worry about the 
"list" changing.

--
assignee: docs@python
components: Documentation
messages: 377726
nosy: WoodyWoo, docs@python
priority: normal
severity: normal
status: open
title: Poor example for Element.remove()
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: Problem

2020-09-30 Thread Michael Torrie
On 9/29/20 4:31 PM, Ron Villarreal via Python-list wrote:
> Tried to open Python 3.8. I have Windows 10. Icon won’t open.

Did you read the documentation? https://docs.python.org/3/using/windows.html

Seems like this comes up several times a week. Perhaps the installer
should automatically open this page.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread WoodyWoo


WoodyWoo  added the comment:

I think "for each in list" should not work by index,but should work by pointer 
like thing,could be a list of pointers.
When the "for each in list" was acting,the pointers list would be fixed,and you 
need not to worry about the "list" changing.

--

___
Python tracker 

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



Re: Problem

2020-09-30 Thread Eryk Sun
On 9/30/20, Mirko via Python-list  wrote:
>
> I have only limited knowledge about current Windows systems. But it
> seems to me that newcomers download some setup exe/msi and then
> search the menu to run what ever is found (python.exe or even the
> setup-program.)

It might help some people who try to run Python via the installer if
it actually had "installer" in the name. For example,
"python-3.8.5-amd64-installer.exe" instead of
"python-3.8.5-amd64.exe".

> Shouldn't IDLE be named something like "Python Editor" (or Python
> IDE/App) in the menu, so beginners can more easily find it? Further
> it might be a good idea to make this "Repair/Modify/Remove"-Dialog
> more explicit by clearly saying "Python is already installed. If you
> want to use it, do ...".

Explorer tracks recently added start-menu items and indicates them as
"New". The Python 3.x start-menu folder has clearly named shell links
such as "IDLE (Python 3.9 64-bit)" and "Python 3.9 (64-bit)" (run
python.exe), as well as "Python 3.9 Manuals (64-bit)" (chm docs) and
"Python 3.9 Module Docs (64-bit)" (pydoc browser).

The successful installation message was recently changed to include
brief instructions for running Python via the `py` command as well as
a direct link to Python on Windows docs [1]:

New to Python? Start with the online tutorial [link] and
documentation [link]. At your terminal,
type "py" to launch Python, or search for Python in your Start menu.

See what's new [link] in this release, or find more info about
using Python on Windows [link].

I'd wager that Steve would welcome a PR to add a similar message to
the modify/repair dialog.

[1] 
https://github.com/python/cpython/blob/v3.9.0rc2/Tools/msi/bundle/Default.wxl#L108
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem

2020-09-30 Thread Chris Angelico
On Thu, Oct 1, 2020 at 7:33 AM Mirko via Python-list
 wrote:
>
> Am 30.09.2020 um 17:55 schrieb Dennis Lee Bieber:
> > On Tue, 29 Sep 2020 22:31:18 + (UTC), Ron Villarreal via Python-list
> >  declaimed the following:
> >
> >> Tried to open Python 3.8. I have Windows 10. Icon won’t open.
> >
> >   What "Icon"?
> >
> >   Python is a language interpreter/compiler -- it runs from a command
> > prompt/shell. Clicking on a Python SCRIPT might open a shell, which will
> > almost immediately close when the script finishes executing (files with a
> > .pyw extension are supposed to create their own GUI using one of a couple
> > of libraries, and don't open a shell).
>
>
> I'm just a lurker, hobby programmer and Linux geek, so take my words
> with some caution.
>
> We are seeing these troubles from newcomers on Windows all of the
> time -- and that for years. Isn't it time to ask if the way Python
> installs itself on Windows-Systems is appropriate?
>

The problem is that there isn't "the way". Did the person:

1) Download an MSI file from python.org?
2) Install ActiveState?
3) Install Enthought?
4) Install Anaconda?
5) Get Python from the Microsoft Store?
6) Something else?

They're all different, they all behave differently, they all have
different defaults. And then there's the question of "did you install
it for everyone or just you?", and so on.

The core Python devs have control of the first option, and some
control over the fifth, but none of the others. And quite often, it
turns out that these issues come from someone doing *more than one* of
these, making it even more difficult to figure out what's happened.

So, go ahead, ask if it's appropriate good luck getting a useful response :|

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


Re: Problem

2020-09-30 Thread Mirko via Python-list
Am 30.09.2020 um 17:55 schrieb Dennis Lee Bieber:
> On Tue, 29 Sep 2020 22:31:18 + (UTC), Ron Villarreal via Python-list
>  declaimed the following:
> 
>> Tried to open Python 3.8. I have Windows 10. Icon won’t open.
> 
>   What "Icon"?
> 
>   Python is a language interpreter/compiler -- it runs from a command
> prompt/shell. Clicking on a Python SCRIPT might open a shell, which will
> almost immediately close when the script finishes executing (files with a
> .pyw extension are supposed to create their own GUI using one of a couple
> of libraries, and don't open a shell).


I'm just a lurker, hobby programmer and Linux geek, so take my words
with some caution.

We are seeing these troubles from newcomers on Windows all of the
time -- and that for years. Isn't it time to ask if the way Python
installs itself on Windows-Systems is appropriate?

I have only limited knowledge about current Windows systems. But it
seems to me that newcomers download some setup exe/msi and then
search the menu to run what ever is found (python.exe or even the
setup-program.)

That's Ok, if you understand what an interpreter/compiler for the
command-line is. But programming beginners usually don't know that
(especially not if there are Windows users).

There has been a lot of effort to make this group inclusive and
newcomer-friendly. But it seems to me that this is not the case for
the software itself. Given that Python ships with a rudimentary IDE
(IDLE), should that one be promoted more intensively?

Shouldn't IDLE be named something like "Python Editor" (or Python
IDE/App) in the menu, so beginners can more easily find it? Further
it might be a good idea to make this "Repair/Modify/Remove"-Dialog
more explicit by clearly saying "Python is already installed. If you
want to use it, do ...".
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36255] Provide a simple way to delete and edit python's welcome message

2020-09-30 Thread Irit Katriel


Irit Katriel  added the comment:

Raymond, I think you intended to close this but missed a click.

--

___
Python tracker 

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



A library that converts a type-annotated function into a webpage with HTML forms?

2020-09-30 Thread James Lu
Is there a python library available that converts a type-annotated Python
function into a webpage with HTML forms?

Something like:


def foo(name: str, times: int):
return f"Hello {name}!" * times

serve_from(foo, host="0.0.0.0", port=3000)

Turning into a server that serves something like this:


name




And hitting the submit button executes the function.

I'm aware I could use sls, and build a form manually, but that's extra work.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



Re: Problem

2020-09-30 Thread Eryk Sun
On 9/30/20, Dennis Lee Bieber  wrote:
> On Tue, 29 Sep 2020 22:31:18 + (UTC), Ron Villarreal via Python-list
>  declaimed the following:
>
>>Tried to open Python 3.8. I have Windows 10. Icon won’t open.
>
>   What "Icon"?
>
>   Python is a language interpreter/compiler -- it runs from a command
> prompt/shell. Clicking on a Python SCRIPT might open a shell, which will
> almost immediately close when the script finishes executing

No shell should be executed by a normal .py file association. If it's
running CMD or PowerShell, or any other shell, it's likely a mistake.

Double clicking on an icon for a .py file should run "py.exe" ->
"python.exe" or just "python.exe", assuming .py scripts are configured
to execute by default as opposed to opening in an editor. These are
console applications, which, when executed without an inherited
console session, will automatically create a new console session that
creates a window for the console/terminal user interface. The latter
includes keyboard and mouse input and display of the active screen
buffer. Client applications access the session's input buffer and
screen buffers via console I/O files that are attached to the console
session.  (In Windows 7+, a console session is an instance of
conhost.exe. In Windows 8+, console I/O files are provided by the
ConDrv device, which is implemented by the condrv.sys driver. In
Windows 10, console I/O also supports virtual-terminal ANSI sequences,
which improves API compatibility with terminals on other platforms.)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Guido van Rossum


Guido van Rossum  added the comment:

Hm, I'm not sure. ast.literal_eval() does accept trailing whitespace, and 
embedded whitespace.

```
>>> ast.literal_eval("- ( 1\n)\n")
-1
>>> 
```

So I think it should start accepting leading whitespace too (but only in a 
feature release, so 3.10).

--

___
Python tracker 

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



[issue41897] ast.parse in Python 3.9 does not produce SyntaxError for assignment to __debug__

2020-09-30 Thread Guido van Rossum


Guido van Rossum  added the comment:

We moved the check from the parser to the bytecode compiler. I don't think this 
should be a problem. Kudos for noticing though! :-)

```
>>> compile("__debug__ = 1", "", "exec")
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1
SyntaxError: cannot assign to __debug__
>>> 
```

--
resolution:  -> wont fix
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



[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue41895] PyMethodDef does NOT have any fields contain context in embedded C

2020-09-30 Thread dexter


dexter  added the comment:

for example, there are some of shared libs, all these libs have a function 
named getList() exported. and getList() will return a list of names which also 
as a function name been exported.

shared lib A
export getList() -> return ["aaa", "bbb"]
export aaa()
export bbb();

shared lib A
export getList() -> return ["xyz", "abc", "mno"]
export xyz()
export abc();
export mno();

and I want expose shared lib A aaa, bbb or shared lib B xyz abc mno when I load 
them, (maybe A, maybe B, or maybe both if they exists, work like plugins)

I have a loop like

for (int i = 0; i < length_of_list; ++i) {
char* funcName = getName(i);
PyMethodDef def { funcName, fooCall, MATH_VARARGS, nullptr, /* funcname 
here */};
/// 
}

PyObject* fooCall(PyObject* self, PyObject* args, void* context) {
char* funcname = (char*) context;
///  load func based on name.
}

--

___
Python tracker 

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



[issue41897] ast.parse in Python 3.9 does not produce SyntaxError for assignment to __debug__

2020-09-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +BTaskaya, gvanrossum, pablogsal

___
Python tracker 

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



[issue41898] Any logging causes assertLogs to pass

2020-09-30 Thread Troy Daniels


New submission from Troy Daniels :

The following test code unexpectedly passes.

import logging
import unittest

LOG_FORMAT = '%(levelname)-10s %(asctime)s: %(message)s'


def set_up_logger(app_name, level=logging.INFO, file="test.log"):
formatter = logging.Formatter(LOG_FORMAT)
log = logging.getLogger(app_name)
# The next line lets the test pass
log.setLevel(level)
return log

logger = set_up_logger(__name__)

class TestLogging(unittest.TestCase):
def test_logging(self):
with self.assertLogs(level=logging.WARNING):
logger.info('foo')

Based on discussion at 
https://stackoverflow.com/questions/64141681/any-level-of-logging-lets-assertlogs-pass,
 it appears that I need to pass in the logger which is going to be doing the 
logging.  

Doing so would make the test over-specific and fragile.  The requirement is 
that a warning be logged, not that a specific logger issue the warning.

This was verified with Python 3.8.5 on a Mac, but probably exists in most/all 
other versions.

--
components: Tests
messages: 377719
nosy: udalrich.schermer
priority: normal
severity: normal
status: open
title: Any logging causes assertLogs to pass
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



[issue41895] PyMethodDef does NOT have any fields contain context in embedded C

2020-09-30 Thread dexter


Change by dexter :


--
title: PyMethodDef does NOT have any field contains context in embedded C -> 
PyMethodDef does NOT have any fields contain context in embedded C

___
Python tracker 

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



[issue31256] xml.etree.ElementTree: add support for doctype in tostring method

2020-09-30 Thread Irit Katriel


Irit Katriel  added the comment:

It looks like PR 12225 resolved this issue. Can this be closed then?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue41897] ast.parse in Python 3.9 does not produce SyntaxError for assignment to __debug__

2020-09-30 Thread Saiyang Gou


New submission from Saiyang Gou :

ast.parse in Python 3.9 does not produce SyntaxError for assignment to 
__debug__:

```
>>> import ast
>>> ast.dump(ast.parse('__debug__ = 0'))
"Module(body=[Assign(targets=[Name(id='__debug__', ctx=Store())], 
value=Constant(value=0))], type_ignores=[])"
>>> exec('__debug__ = 0')
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1
SyntaxError: cannot assign to __debug__
```

In Python 3.8 a SyntaxError was properly raised. Probably this is due to the 
new PEG parser.

--
components: Library (Lib)
messages: 377717
nosy: gousaiyang
priority: normal
severity: normal
status: open
title: ast.parse in Python 3.9 does not produce SyntaxError for assignment to 
__debug__
type: enhancement
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



Re: [RELEASE] Python 3.8.6 is now available

2020-09-30 Thread Mats Wichmann
On 9/29/20 9:16 AM, David Raymond wrote:
>> Python 3.8.6 is the sixth maintenance release of Python 3.8. Go get it here:
> 
>> https://www.python.org/downloads/release/python-386/ 
>> 
> 
> 
> Just a quick note that there still seem to be a few places on the website 
> which are still showing 3.8.5 as the latest release. (Looking at it with 
> Firefox on Windows)
> 
> On the main page www.python.org it has 3.8.6 down in the latest news section, 
> and a direct link in the little download box right above that. But if you 
> hover over the big "Downloads" tab at the top it gives a big 3.8.5 button
> 
> If you click on that Downloads tab and go to www.python.org/downloads, again 
> there's a big gold button for 3.8.5, and if you scroll down to the "Looking 
> for a specific release?" section there is no 3.8.6 visible. The most recent 
> line is 3.5.10 from Sept 5th
> 

A lot of this is automated.

But if you go to https://www.python.org/downloads/windows, the entry for
3.8.6 says "No files for this release".  That's somewhat going to impact
the ability to download :)




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


[issue41896] Moving index with wordstart expression includes non-alphanumberic and underline characters if word is tagged and iat the edge of a text widget

2020-09-30 Thread Tama-kun


New submission from Tama-kun :

This issue occurs when using the current mouse position from an event and the 
wordstart expression to find the index of the start of a clicked word on a text 
widget and the indices for the clicked word are tagged. If there's a single 
non-alphanumberic and underline character between the clicked word and the left 
edge of the text widget the index return for the start of the word will be the 
one for said non-alphanumeric and underline character. 

test.index(('@%s,%s wordstart' % (event.x, event.y)))

Assuming "[testing]" is at the indices 1.0 to 1.9 of a text widget, clicking on 
testing will return 1.1. If we tag the indices 1.1 to 1.8 with 
test.tag_add("tag", 1.1, 1.8) then clicking on the word testing will return 
1.0. This change of return doesn't occur if "[testing]" does not begin at a x.0 
index or if there's multiple non-alphanumeric and underline characters such as 
"[[testing]". Using wordend will return 1.8 in both tagged and non tagged 
scenarios.

The attached script illustrates this bug, only the middle text widget will 
print out the unexpected start index when clicking on the word testing. This 
issue isn't present when using python 3.5, running the script on python 3.5 
will print out all expected indices.

--
components: Tkinter
files: test.py
messages: 377716
nosy: Tama-kun, gpolo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Moving index with wordstart expression includes non-alphanumberic and 
underline characters if word is tagged and iat the edge of a text widget
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49479/test.py

___
Python tracker 

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



Re: error in install.sh

2020-09-30 Thread Dieter Maurer
RobH wrote at 2020-9-30 13:27 +0100:
>I had to do a reinstall of my linux system due to a faulty ssd, and have
>a problem with a install.sh script.The said script is included in with
>lcd files. which I downloaded from github.
>
>When I run ./install.sh, it fails at
>./install.sh: line 34: syntax error: unexpected end of file.
>
>I don't know what the syntax should be here;
>
>These are the last 4 lines in the script, and if I count the spaces then:
>
>echo "Should be now all finished. Please press any key to now reboot.
>After rebooting run"
>echo "'sudo python demo_lcd.py' from this directory"
>read -n1 -s < I think this is the line in question

The command above is broken:
`read` is a `SHELL BUILTIN COMMAND`;
its purpose is to read words from standard input into shell variables
specified on the command line. The command above does not name
any variables.
The "<<" in the command above introduces a `HERE DOCUMENT` redirection:
it allows a script to privide input data. Its syntax is:
  [n]<<[-]word
  here-document
  delimiter
The "HERE DOCUMENT" redirection reads the script text following
the command until *delimiter* (derived from *word*) is found on
a line by itself.
In your case, the delimiter is not found resulting in "unexpected EOF".




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


[issue15877] xml.dom.minidom cannot parse ISO-2022-JP

2020-09-30 Thread Irit Katriel


Irit Katriel  added the comment:

I don't see this problem on 3.10. Is this still an issue or can this issue be 
closed?


Running Release|Win32 interpreter...
Python 3.10.0a0 (heads/bpo17490-dirty:00eb063b66, Sep 27 2020, 13:20:24) [MSC 
v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> c = u'\u65e5\u672c\u8a9e'
>>> import xml.dom.minidom
>>> xml.dom.minidom.parseString('>> ?>%s' % c.encode('UTF-8'))

>>> xml.dom.minidom.parseString('>> ?>%s' % c.encode('ISO-2022-JP'))

>>>

--
nosy: +iritkatriel

___
Python tracker 

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



[issue41894] UnicodeDecodeError during load failure in non-UTF-8 locale

2020-09-30 Thread Kevin


Change by Kevin :


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

___
Python tracker 

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



[issue41895] PyMethodDef does NOT have any field contains context in embedded C

2020-09-30 Thread dexter


New submission from dexter :

I am trying to create app embedded python as interpreter, and I use 
PyImport_AppendInittab to import some helper functions to python. on website 
the example is excellent when you already know how many functions we want to 
import. but when my functions are based on a runtime dynamic list, even I 
create all PyModuleDef and PyMethodDef, but when the function all goes to 
PyCFunction which only has two PyObject* and return PyObject* i lost context 
information about C. may be I am not clear, but what I am expecting is 
PyMethodDef should define like
struct PyMethodDef {
const char  *ml_name;   /* The name of the built-in function/method */
PyCFunction ml_meth;/* The C function that implements it */
int ml_flags;   /* Combination of METH_xxx flags, which mostly
   describe the args expected by the C func */
const char  *ml_doc;/* The __doc__ attribute, or NULL */
void* extra; /* <= here is NEW */ 
};

and PyCFunction should define like

typedef PyObject *(*PyCFunction)(PyObject *, PyObject *, void * /* for extra 
void* */);

--
components: C API
messages: 377714
nosy: dexter
priority: normal
severity: normal
status: open
title: PyMethodDef does NOT have any field contains context in embedded C
type: enhancement
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



[issue41894] UnicodeDecodeError during load failure in non-UTF-8 locale

2020-09-30 Thread Kevin

New submission from Kevin :

If a native module fails to load, the dynload code will call 
PyUnicode_FromString on the error message to give back to the user. This can 
cause a UnicodeDecodeError if the locale is not a UTF-8 locale and the error 
message contains non-ASCII code points.

While Linux systems almost always use a UTF-8 locale by default nowadays, AIX 
systems typically use non-UTF-8 locales by default. We encountered an issue 
where a customer did not have libbz2 installed, causing a load failure when bz2 
tried to import _bz2 when running in an Italian locale:

$ LC_ALL=it_IT python3 -c 'import bz2'
Traceback (most recent call last): 
 File "", line 1, in  
 File "/QOpenSys/pkgs/lib/python3.6/bz2.py", line 21, in  
   from _bz2 import BZ2Compressor, BZ2Decompressor 
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 161: 
invalid continuation byte

After switching to a UTF-8 locale, the problem goes away:

$ LC_ALL=IT_IT python3 -c 'import bz2'   
Traceback (most recent call last): 
 File "", line 1, in  
 File "/QOpenSys/pkgs/lib/python3.6/bz2.py", line 21, in  
   from _bz2 import BZ2Compressor, BZ2Decompressor 
ImportError:0509-022 Impossibile caricare il modulo 
/QOpenSys/pkgs/lib/python3.6/lib-dynload/_bz2.so. 
   0509-150   Il modulo dipendente libbz2.so non è stato caricato. 
   0509-022 Impossibile caricare il modulo libbz2.so. 
   0509-026 Errore di sistema: Un file o una directory nel nome percorso 
non esiste. 
   0509-022 Impossibile caricare il modulo 
/QOpenSys/pkgs/lib/python3.6/lib-dynload/_bz2.so. 
   0509-150   Il modulo dipendente 
/QOpenSys/pkgs/lib/python3.6/lib-dynload/_bz2.so non è stato caricato.


While this conceivably affects any Unix-like platform, the only system I can 
recreate it on is AIX and IBM i PASE. As far as I can tell, on Linux you will 
always get something like "error while loading shared libraries: libbz2.so.1.0: 
cannot open shared object file: No such file or directory". Even though there 
seems to be some translations in GLIBC, I have been unable to get them to be 
used on either Fedora or Ubuntu.

--
components: Interpreter Core
messages: 377713
nosy: kadler
priority: normal
severity: normal
status: open
title: UnicodeDecodeError during load failure in non-UTF-8 locale
type: behavior
versions: Python 3.10, Python 3.5, Python 3.6, 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



[issue41893] remove() method is not working as expected(Hard to explain)

2020-09-30 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



Re: new feature in Python

2020-09-30 Thread Christman, Roger Graydon
On 30/09/2020, yonatan <53770...@gmail.com> proposed:
> instead of
> con = "some text here"
> con  = con.replace("here", "there")

> we could do

> con = "some text here"
> con  .= replace("here", "there")

That would require a major rewrite of the grammer
of the Python language, which would probably be a bad thing.

The operands to all of those assignment operators are
complete objects in their own rights.   This 'replace'
is not an independent object, but a member of the
string object.   Without that "con." in front of it,
you would likely get the error about
"'replace' not defined"

For the grammar to be clean and orthogonal,
it would not be at all good to have a context-sensitivity
introduced to allow orphaned method names to be
permitted,  just because there was this ".=" token
somewhere earlier in the program statement.

Besides, I could foresee a lot of programming
errors when people would start to generalize this
operation to do things like:

list .= append(item)
list .= sort()

which would most certainly be incorrect.

Roger Christman
Pennsylvania State University
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-30 Thread Ian M. Hoffman


Ian M. Hoffman  added the comment:

I agree with you. When I wrote "desired behavior" I intended it to mean "my 
selfishly desired outcome of not loading my struct with a dangling pointer." 
This issue seems to have descended into workarounds that treat the symptoms; 
I'm all for treating the cause.

--

___
Python tracker 

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



Re: new feature in Python.

2020-09-30 Thread Chris Angelico
On Thu, Oct 1, 2020 at 2:14 AM Jason C. McDonald
 wrote:
>
>
> > I have a great idea, there are __iX__` methods, such as `__ior__`,
> > `__iadd__`, `__iand__` etc.., which implements the |=, +=, &=
> > behavior,
> > it would be nice if you could implement also `__igetattr__` or
> > something, which means:
> >
> > instead of
> > con = "some text here"
> > con  = con.replace("here", "there")
> >
> > we could do
> >
> > con = "some text here"
> > con  .= replace("here", "there")
>
> I have three concerns about this. First, there's a lot of wizardry
> under the covers with getattr() and dot access to begin with, so this
> would be significantly non-trivial. I suspect the behavior would wind
> up being "surprising" too often.
>
> Second, explicit is better than implicit. It's better to explicitly
> rebind the name (or mutate on the name) rather than have a fancy
> shorthand for trampling over an existing mutable value. In the case of
> the compound operators on numbers, you're dealing with immutable types
> anyway, so you're really just rebinding the name. The same is true of
> your string there. But what about a list?
>
> spam = [1, 2, 3]
> eggs = spam
> eggs .= append(4)  # what is happening
> eggs .= sort()  # how about now?
> eggs .= sorted(eggs) # and now?
>
> You see? It's going to be a lot of surprises, because you're stripping
> the usual visual cues of explicit assignment:
>
> spam = [1, 2, 3]
> eggs = spam
> eggs.append(4)  # mutating spam too
> eggs.sort()  # mutating spam too
> eggs = eggs.sorted() # rebinding eggs to a new value, spam is safe
>

These examples reveal a few other issues, though, which can best be
highlighted by this:

x = 5
x *= 2 + 3
print(x)

x = 5
x = x * 2 + 3
print(x)

Augmented assignment works with a single other operand. It's not
textually equivalent to "x = x  other"; it's closer to "x = x 
(other)", putting the right hand side in parentheses. That doesn't
work with a hypothetical igetattr, because you're invariably going to
want to do more than just get an attribute.

It's also notable that the in-place *methods* are actually used
something like this (omitting detaily bits about slots):

x += y
# is roughly equivalent to
x = x.__iadd__(y)

So there's assignment *as well as* the in-place method call. The only
value of the __iadd__ family of methods is with types that can
implement them directly; for instance, a list can append to itself,
rather than copying itself and then reassigning (which is semantically
different, as well as being far less efficient). The ".=" operator
wouldn't be able to take advantage of that.

If you find yourself frequently writing long chains of statements that
all do "thing = thing.method()", it may be better to consider writing
them as a single statement instead:

name = (name
.capitalize()
.expandtabs()
.lstrip(" ")
.replace(", ", ",")
)

It'd be as efficient and readable as the augmented assignment form would be.

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


Re: new feature in Python.

2020-09-30 Thread Jason C. McDonald

> I have a great idea, there are __iX__` methods, such as `__ior__`,
> `__iadd__`, `__iand__` etc.., which implements the |=, +=, &=
> behavior, 
> it would be nice if you could implement also `__igetattr__` or
> something, which means:
> 
> instead of
> con = "some text here"
> con  = con.replace("here", "there")
> 
> we could do
> 
> con = "some text here"
> con  .= replace("here", "there")

I have three concerns about this. First, there's a lot of wizardry
under the covers with getattr() and dot access to begin with, so this
would be significantly non-trivial. I suspect the behavior would wind
up being "surprising" too often.

Second, explicit is better than implicit. It's better to explicitly
rebind the name (or mutate on the name) rather than have a fancy
shorthand for trampling over an existing mutable value. In the case of
the compound operators on numbers, you're dealing with immutable types
anyway, so you're really just rebinding the name. The same is true of
your string there. But what about a list?

spam = [1, 2, 3]
eggs = spam
eggs .= append(4)  # what is happening
eggs .= sort()  # how about now?
eggs .= sorted(eggs) # and now?

You see? It's going to be a lot of surprises, because you're stripping
the usual visual cues of explicit assignment:

spam = [1, 2, 3]
eggs = spam
eggs.append(4)  # mutating spam too
eggs.sort()  # mutating spam too
eggs = eggs.sorted() # rebinding eggs to a new value, spam is safe

Yes, yes, I know, you could "get used to it", but it's adding
complexity and detracting from the One Obvious Way to do things. If an
object decides to implement those compound operators and abuse them
thusly, that's a consenting adults situation. Introducing this new
syntax into the language creates a trip hazard for the user.

Third, that proposed operator, .=  oww that's hard to see. It looks
like a typo, and could easily be typed as one, or overlooked altogether
(again, surprises).

Explicit-is-better-than-implicit'ly yrs,

-- 
Jason C. McDonald
(CodeMouse92)

Author | Speaker | Hacker | Time Lord


signature.asc
Description: This is a digitally signed message part
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Looks like skipping the leading whitespace is an undocumented behavior for 
eval() introduced back in 1992 (f08ab0ad158f88f05dd923b129d2397e1882be14). I 
don't think that bringing it to the literal_eval is a good idea, at least after 
this much of a time. If so, both of them should be explicitly documented or at 
least mentioned in the source code (to avoid confusion).

--
nosy: +pablogsal

___
Python tracker 

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



[issue41893] remove() method is not working as expected(Hard to explain)

2020-09-30 Thread Ben


Ben  added the comment:

See the note in 
https://docs.python.org/3.7/reference/compound_stmts.html#the-for-statement 
"There is a subtlety when the sequence is being modified by the loop ..."

Since your code is mutating the  all_fields  list as you iterate it, you get 
the " next item will be skipped " behaviour, which is why the loop is skipping 
over "password".  remove() was never called to remove "password".

There is an open issue https://bugs.python.org/issue32767 to clarify the docs 
about this,  but it is not a bug in Python.

--
nosy: +bjs

___
Python tracker 

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



[issue41889] enum: Mixin and int base class regression in 3.8.6

2020-09-30 Thread William Pickard


William Pickard  added the comment:

Actually, this is an issue with native types in general that define a 'tp_new' 
slot value ('!= NULL').

--
nosy: +WildCard65

___
Python tracker 

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



[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue41893] remove() method is not working as expected(Hard to explain)

2020-09-30 Thread pushpam kumar


New submission from pushpam kumar :

I am not able to understand why "password" word is not removed by remove() 
method

--
components: Interpreter Core
files: testtt.py
messages: 377708
nosy: ctf.challenge.pushpam
priority: normal
severity: normal
status: open
title: remove() method is not working as expected(Hard to explain)
versions: Python 3.8
Added file: https://bugs.python.org/file49478/testtt.py

___
Python tracker 

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



new feature in Python.

2020-09-30 Thread yonatan
Hi, My name is Jonatan and i am programming in Python for about 4 years, 
I have a great idea, there are __iX__` methods, such as `__ior__`, `__iadd__`, 
`__iand__` etc.., which implements the |=, +=, &= behavior, 
it would be nice if you could implement also `__igetattr__` or something, which 
means:

instead of
con = "some text here"
con  = con.replace("here", "there")

we could do

con = "some text here"
con  .= replace("here", "there")


Please let me know what do you think about it, Jonatan.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Stefan Behnel


Stefan Behnel  added the comment:

@WoodyWoo, you can (and should) do something like this:

for ELEMchild in list(etroot):

Modifying a container while iterating over it is usually not a good idea. The 
same applies to Python lists and dicts, for example.

--
stage: patch review -> 

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Stefan Behnel


Change by Stefan Behnel :


--
stage:  -> patch review

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Stefan Behnel


Change by Stefan Behnel :


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

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

The example is iterating over the list returned by root.findall(), but removing 
from a different data structure in root, so it won't have a problem.

--

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread WoodyWoo


WoodyWoo  added the comment:

Only that makes "for each in list" literally.

--

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread WoodyWoo


WoodyWoo  added the comment:

I'm green hand in Coding.
But I think the problem caused by "for each in list".
Anything changed in "list" should not act at once,but should act when "for end" 
or break.

--

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

Ah, good point. I agree the example should make that clear. And I think a note 
in .remove() about using it while iterating would be a good idea, too.

--

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Stefan Behnel


Stefan Behnel  added the comment:

> That example is especially problematic.

No, it's not. It uses .findall(), which returns a list. It's like when you make 
a copy of a list to iterate over, when you want to modify the original list in 
the loop.

That could be made explicit in the text that introduces the example, but I 
think it's a very good example.

--

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, eli.bendersky, scoder

___
Python tracker 

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



Re: Interference tkinter and plot from matplotlib

2020-09-30 Thread Christian Gollwitzer

Am 30.09.20 um 15:46 schrieb Pierre Bonville:

  Hi everybody,



Interference tkinter and plot from matplotlib



You are mixing different ways of control flow. In a GUI program, don't 
call input(). Use the mainloop() as the very last of your calls, and 
only work in the callbacks. That means you would integrate a "Next" 
button in your GUI which switches the plots - or even show them side by 
side.


Concerning matplotlib, you'll need to tell it to integrate with Tk 
properly.

https://matplotlib.org/3.3.1/gallery/user_interfaces/embedding_in_tk_sgskip.html


If you want a simple solution instead of full-blown GUI programming, use 
IPython https://ipython.readthedocs.io/en/stable/config/eventloops.html

or jupyter notebooks.


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


[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think the only action here is to improve the documentation. That example is 
especially problematic.

--

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

You will get the same behavior for lists:

>>> a = [1, 2, 3]
>>> for x in a:
... if x == 1:
... a.remove(x)
... print(x)
... 
1
3

Lists are iterated by index. First you get an item at index 0, then at index 1, 
etc, to the end of the list. Initially the list is [1, 2, 3]. After removing 1 
at the first iteration it becomes [2, 3], and at the next iteration you get an 
item at index 1 which is 3.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

I assume that ElementTree doesn't support mutation while iterating.

However, the docs at 
https://docs.python.org/3/library/xml.etree.elementtree.html#modifying-an-xml-file
 show removing an item while iterating. It probably only works because the 
child being removed is the last one.

--
nosy: +eric.smith

___
Python tracker 

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



[issue41892] use both "for in" and "ElementTree.remove" has a index bug

2020-09-30 Thread WoodyWoo


Change by WoodyWoo :


--
title: use both "for" and "ElementTree.remove" has a index bug -> use both "for 
in" and "ElementTree.remove" has a index bug

___
Python tracker 

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



[issue41892] use both "for" and "ElementTree.remove" has a index bug

2020-09-30 Thread WoodyWoo


New submission from WoodyWoo :

#Just run it in Python v3.8.6 of win7 32bit 
import xml.etree.ElementTree as ET 
xmlstr='''



'''
etroot = ET.fromstring(xmlstr)
for ELEMchild in etroot:
if ELEMchild.get("no") == "1" :
etroot.remove(ELEMchild)   #so far so good
print (ELEMchild.tag)
#It should be :  "b /n c" or "a /n b /n c",I can live with it both.
#But it is :  "a /n c".
#The index of ELEMchild should not +1 when there was a remove method worked 
on one of the before ELEMs.
#I was forced to use while and if to control the index +1/+0.
#BTW,ELEM has no method returning index in siblings, which is buging me too.

--
components: XML
messages: 377698
nosy: WoodyWoo
priority: normal
severity: normal
status: open
title: use both "for" and "ElementTree.remove" has a index bug
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



Interference tkinter and plot from matplotlib

2020-09-30 Thread Pierre Bonville
 Hi everybody,
I am running this little program below on Win 10 with Python 3.8 (just
typing prog.py after the prompt c:\Users ...>), and while it correctly
displays the window and does the first plt.plot(), it does not reach the
input command and remains waiting after I shut the plot. If I replace
'quit' by 'destroy' in the button command, it works correctly. I looked on
various Python forums on the Net, but didn't find an answer.
Regards,
P.Bonville

import tkinter as tk
import matplotlib.pyplot as plt
r = tk.Tk()
b = tk.Button(r, text= r.quit)
b = tk.Button(r, text='quit', command=r.quit)
b.pack()
r.mainloop()  # This blocks until press button.
# Root window with button is still displayed.
plt.plot()
plt.show()
rep = input("Return")
plt.plot()
plt.show()
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-30 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +21488
pull_request: https://github.com/python/cpython/pull/22462

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-30 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -21486

___
Python tracker 

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



[issue41890] crypt produces wrong hashes for passwords containing newline character

2020-09-30 Thread Hazem Amara


Hazem Amara  added the comment:

Thanks for your answer :)

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



Re: error in install.sh

2020-09-30 Thread RobH

On 30/09/2020 13:49, 2qdxy4rzwzuui...@potatochowder.com wrote:

On 2020-09-30 at 13:27:43 +0100,
RobH  wrote:


I had to do a reinstall of my linux system due to a faulty ssd, and have a
problem with a install.sh script.The said script is included in with lcd
files. which I downloaded from github.

When I run ./install.sh, it fails at
./install.sh: line 34: syntax error: unexpected end of file.

I don't know what the syntax should be here;

These are the last 4 lines in the script, and if I count the spaces then:

echo "Should be now all finished. Please press any key to now reboot. After
rebooting run"
echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s < I think this is the line in question
sudo reboot


I'm not sure that this is a Python problem, but usually "unexpected end
of file" errors are due to missing or mismatched quotes.  Basically, the
interpreter (Python, shell, or whatever) detects an opening quoute and
doesn't find the matching closing quote until it runs off the end of the
file (or the script).

I'd check with other users or the support system of that specific script
("lcd files" isn't enough for me to know where it came from), or check
any modifications you may have made to it.



This is where I got the files from:

https://github.com/the-raspberry-pi-guy/lcd/find/master

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


Re: error in install.sh

2020-09-30 Thread 2QdxY4RzWzUUiLuE
On 2020-09-30 at 13:27:43 +0100,
RobH  wrote:

> I had to do a reinstall of my linux system due to a faulty ssd, and have a
> problem with a install.sh script.The said script is included in with lcd
> files. which I downloaded from github.
> 
> When I run ./install.sh, it fails at
> ./install.sh: line 34: syntax error: unexpected end of file.
> 
> I don't know what the syntax should be here;
> 
> These are the last 4 lines in the script, and if I count the spaces then:
> 
> echo "Should be now all finished. Please press any key to now reboot. After
> rebooting run"
> echo "'sudo python demo_lcd.py' from this directory"
> read -n1 -s < I think this is the line in question
> sudo reboot

I'm not sure that this is a Python problem, but usually "unexpected end
of file" errors are due to missing or mismatched quotes.  Basically, the
interpreter (Python, shell, or whatever) detects an opening quoute and
doesn't find the matching closing quote until it runs off the end of the
file (or the script).

I'd check with other users or the support system of that specific script
("lcd files" isn't enough for me to know where it came from), or check
any modifications you may have made to it.
-- 
https://mail.python.org/mailman/listinfo/python-list


error in install.sh

2020-09-30 Thread RobH
I had to do a reinstall of my linux system due to a faulty ssd, and have 
a problem with a install.sh script.The said script is included in with 
lcd files. which I downloaded from github.


When I run ./install.sh, it fails at
./install.sh: line 34: syntax error: unexpected end of file.

I don't know what the syntax should be here;

These are the last 4 lines in the script, and if I count the spaces then:

echo "Should be now all finished. Please press any key to now reboot. 
After rebooting run"

echo "'sudo python demo_lcd.py' from this directory"
read -n1 -s < I think this is the line in question
sudo reboot

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


[issue41890] crypt produces wrong hashes for passwords containing newline character

2020-09-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For openssl and mkpasswd the password does not contain the newline character. 
It contains a pair of characters "\" and "n". And the crypt module produces the 
same output for it:

$ python3 -c 'import crypt; print(crypt.crypt(r"password\n","$6$saltySalt"))'
$6$saltySalt$v.6rXp74bIjKX42ufuY7/KWnngOAgFReenROiPODOQYzlRuE2NT4/Bgs8s4ULd3BgKNZQQ7i9GqlibMhRw2SV1

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41891] asyncio.wait_for does not wait for task/future to be completed in all cases

2020-09-30 Thread Richard Kojedzinszky


Change by Richard Kojedzinszky :


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

___
Python tracker 

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



[issue41891] asyncio.wait_for does not wait for task/future to be completed in all cases

2020-09-30 Thread Richard Kojedzinszky


New submission from Richard Kojedzinszky :

This code should run without errors:

```
#!/usr/bin/env python

import asyncio

async def task1():
cv = asyncio.Condition()

async with cv:
await asyncio.wait_for(cv.wait(), 10)

async def main(loop):
task = loop.create_task(task1())

await asyncio.sleep(0)

task.cancel()

res = await asyncio.wait({task})

if __name__ == '__main__':
loop = asyncio.get_event_loop()

loop.run_until_complete(main(loop))
```

--
components: asyncio
messages: 377695
nosy: asvetlov, rkojedzinszky, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.wait_for does not wait for task/future to be completed in all 
cases
type: behavior
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



[issue41890] crypt produces wrong hashes for passwords containing newline character

2020-09-30 Thread Hazem Amara


Change by Hazem Amara :


--
type:  -> behavior

___
Python tracker 

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



[issue41890] crypt produces wrong hashes for passwords containing newline character

2020-09-30 Thread Hazem Amara


New submission from Hazem Amara :

I am having an issue with crypt library (Lib/crypt.py) when hashing passwords 
containing \n character. I am using python 3.8.2 on Linux.  To compare hashed 
passwords produced by crypt, I used openssl and mkpasswd utilities. 

When generating hashes for password without \n, crypt, openssl and mkpasswd 
return the same result:

openssl passwd -6 -salt "saltySalt" "password"
$6$saltySalt$0zG/rneQmcu2mKFi/xXKF5WVH4ald6AlPTwnSRggVpyu7iRbq9buUmS5gD884iB1seAPw3UehNZ/b.jxL0g4Y/

mkpasswd -S "saltySalt" -m sha-512 "password"
$6$saltySalt$0zG/rneQmcu2mKFi/xXKF5WVH4ald6AlPTwnSRggVpyu7iRbq9buUmS5gD884iB1seAPw3UehNZ/b.jxL0g4Y/

python3 -c 'import crypt; print(crypt.crypt("password","$6$saltySalt"))'
$6$saltySalt$0zG/rneQmcu2mKFi/xXKF5WVH4ald6AlPTwnSRggVpyu7iRbq9buUmS5gD884iB1seAPw3UehNZ/b.jxL0g4Y/


But when generating hashes for passwords containing \n character, crypt returns 
a result different from the result returned by openssl and mkpasswd: 

openssl passwd -6 -salt "saltySalt" "password\n"
$6$saltySalt$v.6rXp74bIjKX42ufuY7/KWnngOAgFReenROiPODOQYzlRuE2NT4/Bgs8s4ULd3BgKNZQQ7i9GqlibMhRw2SV1
 
mkpasswd -S "saltySalt" -m sha-512 "password\n"
$6$saltySalt$v.6rXp74bIjKX42ufuY7/KWnngOAgFReenROiPODOQYzlRuE2NT4/Bgs8s4ULd3BgKNZQQ7i9GqlibMhRw2SV1
 
python3 -c 'import crypt; print(crypt.crypt("password\n","$6$saltySalt"))'
$6$saltySalt$hsmSR02RXIRP5U14cDo3wtwLCOD1Lb/9huWQEuJYRyatQjRjXmzYJI9rpfqys8ucIc.GbymuE3a5DVcLzSxn5/


I did not find a special mention for newline character in the documentation. 
Thanks for your help.

--
components: Library (Lib)
messages: 377694
nosy: amarahzm
priority: normal
severity: normal
status: open
title: crypt produces wrong hashes for passwords containing newline character
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



[issue23706] pathlib.Path.write_text should include a newline argument

2020-09-30 Thread Maxim Burov


Maxim Burov  added the comment:

CLA signed now and PR is ready :)

--

___
Python tracker 

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