[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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