[issue45180] possible wrong result for difflib.SequenceMatcher.ratio()

2021-09-12 Thread Tim Peters


Tim Peters  added the comment:

Unfortunately, you're getting hurt by the "autojunk" feature (see the docs). If 
you turn it off, you'll get a result much more to your liking:

>>> print(SequenceMatcher(None, a, b).ratio())
0.3431803896920176

>>> print(SequenceMatcher(None, a, b, autojunk=False).ratio())
0.9553739786297926

--
nosy: +tim.peters
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue45126] [sqlite3] cleanup and harden Connection and Cursor __init__

2021-09-12 Thread miss-islington


miss-islington  added the comment:


New changeset 5d28bb699a305135a220a97ac52e90d9344a3004 by Miss Islington (bot) 
in branch '3.9':
[3.10] bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231). 
(GH-28298)
https://github.com/python/cpython/commit/5d28bb699a305135a220a97ac52e90d9344a3004


--

___
Python tracker 

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



[issue45180] possible wrong result for difflib.SequenceMatcher.ratio()

2021-09-12 Thread Nabeel Alzahrani


New submission from Nabeel Alzahrani :

The difflib.SequenceMatcher.ratio() gives 0.3 instead of 1.0 or at least 0.9 
for the following two strings a and b: 
a="""
#include 
#include 
using namespace std;
int main() {
   string userWord;
   unsigned int i;
  cin >> userWord;

  
  for(i = 0; i < userWord.size(); i++) {
 if(userWord.at(i) == 'i') {
userWord.at(i) = '1';
 }
 if(userWord.at(i) == 'a') {
userWord.at(i) = '@'; 
 }
 if(userWord.at(i) == 'm') {
userWord.at(i) = 'M';
 }
 if(userWord.at(i) == 'B') {
userWord.at(i) = '8';
 }
 if(userWord.at(i) == 's') {
userWord.at(i) = '$';
 }
 userWord.push_back('!');
  }
  cout << userWord << endl;
   return 0;
}
"""

b="""
#include 
#include 
using namespace std;
int main() {
   string userWord;
   unsigned int i;
  cin >> userWord;
  userWord.push_back('!');
  
  for(i = 0; i < userWord.size(); i++) {
 if(userWord.at(i) == 'i') {
userWord.at(i) = '1';
 }
 if(userWord.at(i) == 'a') {
userWord.at(i) = '@'; 
 }
 if(userWord.at(i) == 'm') {
userWord.at(i) = 'M';
 }
 if(userWord.at(i) == 'B') {
userWord.at(i) = '8';
 }
 if(userWord.at(i) == 's') {
userWord.at(i) = '$';
 }
   
  }
  cout << userWord << endl;
   return 0;
}
"""

--
components: Library (Lib)
messages: 401683
nosy: nalza001
priority: normal
severity: normal
status: open
title: possible wrong result for difflib.SequenceMatcher.ratio()
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue45126] [sqlite3] cleanup and harden Connection and Cursor __init__

2021-09-12 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset aa6dd54d43dffbdf883c083e361f6ccf8642d66e by Erlend Egeberg 
Aasland in branch '3.10':
[3.10] bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231). 
(GH-28298)
https://github.com/python/cpython/commit/aa6dd54d43dffbdf883c083e361f6ccf8642d66e


--

___
Python tracker 

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



[issue45126] [sqlite3] cleanup and harden Connection and Cursor __init__

2021-09-12 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45179] List.sort ERROR

2021-09-12 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Wait, are you talking about the list appearing to be empty during the sort? 
That's expected behaviour and not a bug:

https://docs.python.org/3/library/stdtypes.html#list.sort

I'm going to close this issue as Not A Bug. If the problem is something else, 
please re-open it with:

- an explanation of what you think the bug is;

- why you think it is a bug;

- a simple test case;

- the output you expect;

- and the actual output.


It is not enough to give the actual output with no explanation for why you 
think it is wrong.

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

___
Python tracker 

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



[issue45179] List.sort ERROR

2021-09-12 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Sorry, it is not clear what you think is the bug. What output do you expect?

When I run the code, F and G are correctly sorted.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue45179] List.sort ERROR

2021-09-12 Thread meng_xiaohui

New submission from meng_xiaohui <1294886...@qq.com>:

There is a bug in this method:

L.sort(key=None, reverse=False) -> None
L is an instance of list.

Argument key is a function. If L is in the body of argument key, L is always an 
empty list in test case, which is wrong

=
Run this:

F = ['2', '3', '1']
G = ['7', '9', '8']

def key(i):
print(F)
print(G)
res = int(i) + len(F) + len(G)
return res

G.sort(key=key)
F.sort(key=key)

=
Actual output:
['2', '3', '1']
[]
['2', '3', '1']
[]
['2', '3', '1']
[]
[]
['7', '8', '9']
[]
['7', '8', '9']
[]
['7', '8', '9']

--
components: Interpreter Core
messages: 401679
nosy: meng_xiaohui
priority: normal
severity: normal
status: open
title: List.sort ERROR
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



[issue45078] test_importlib: test_read_bytes() fails on AMD64 Windows8.1 Non-Debug 3.x

2021-09-12 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

The builder is now passing after the buildbot owner reset the checkout.

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

___
Python tracker 

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



[issue44771] Adopt changes from importlib_resources 5.2

2021-09-12 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Reported concern can be addressed in the new issue.

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



[issue29521] Minor warning messages when compiling documentation

2021-09-12 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue45178] Support for linking unnamed temporary files into filesystem on Linux

2021-09-12 Thread WGH


New submission from WGH :

In Linux, it's possible to create an unnamed temporary file in a specified 
directory by using open with O_TMPFILE flag (as if it was created with random 
name and immediately unlinked, but atomically). Unless O_EXCL is specified, the 
file can be then linked into filesystem using linkat syscall.

It would be neat if it was possible in Python.

There're a couple of things missing:

1) tempfile.TemporaryFile creates a file with O_EXCL flag, which prevents 
linking it into filesystem.

2) linkat must be called with AT_SYMLINK_FOLLOW flag (otherwise EXDEV is 
returned), which is broken right now (#37612)

--
components: Library (Lib)
messages: 401676
nosy: WGH
priority: normal
severity: normal
status: open
title: Support for linking unnamed temporary files into filesystem on Linux
type: enhancement

___
Python tracker 

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2021-09-12 Thread WGH


WGH  added the comment:

> My patch uses O_EXCL. It makes possible to use linkat() to create a path for 
> the temporary file (I didn't try it, but I read that it's possible). I don't 
> know if using O_EXCL should be the default.

I think it is the other way around. From the manual: "If O_EXCL is not 
specified, then linkat(2) can ..."

--
nosy: +WGH

___
Python tracker 

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



[issue45177] Use shared test loader when possible when running test suite

2021-09-12 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue45177] Use shared test loader when possible when running test suite

2021-09-12 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Use unittest.defaultTestLoader instead of unittest.TestLoader() when possible, 
to avoid creating unnecessary many instances.

--
components: Tests
messages: 401674
nosy: erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use shared test loader when possible when running test suite
versions: Python 3.11

___
Python tracker 

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



[issue42560] Improve Tkinter Documentation

2021-09-12 Thread Mark Roseman


Mark Roseman  added the comment:

Would like to throw an idea out for feedback regarding the API reference.

I've done some preliminary work auto-generating documentation via widget 
introspection. It's missing a lot, has many bugs, but is far enough along to 
give a sense of what this approach could offer.  

Temporary snapshot is at https://tkdocs.com/tmp-pyref/ (you may need to 
force-refresh if your browser cached the site's stylesheet). Note that 
generating .rst files this way shouldn't be much of a stretch so as to fully 
integrate into the official Python docs.

Thoughts?

--

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-12 Thread Ian Good


Ian Good  added the comment:

Julian,

That is certainly a workaround, however the behavior you are describing is 
inconsistent with PEP-544 in both word and intention. From the PEP:

> To explicitly declare that a certain class implements a given protocol, it 
> can be used as a regular base class.

It further describes the semantics of inheriting as "unchanged" from a "regular 
base class". If the semantics are "unchanged" then it should follow that 
super().__init__() would pass through the protocol to the object.__init__, just 
like a "regular base class" would if it does not override __init__.

Furthermore, the intention of inheriting a Protocol as described in the PEP:

> Static analysis tools are expected to automatically detect that a class 
> implements a given protocol. So while it's possible to subclass a protocol 
> explicitly, it's not necessary to do so for the sake of type-checking.

The purpose of adding a Protocol sub-class as an explicit base class is thus 
only to improve static analysis, it should *not* to modify the runtime 
semantics.

Consider the case where a package maintainer wants to enhance the flexibility 
of their types by transitioning from using an ABC to using structural 
sub-typing. That simple typing change would be a breaking change to the package 
consumers, who must now remove a super().__init__() call.

Ian

--

___
Python tracker 

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



[issue45156] mock.seal has infinite recursion with int class attributes

2021-09-12 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 3.0 -> 4.0
pull_requests: +26714
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28300

___
Python tracker 

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



[issue5846] Deprecate obsolete functions in unittest

2021-09-12 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +26713
pull_request: https://github.com/python/cpython/pull/28299

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-12 Thread Julian Fortune


Julian Fortune  added the comment:

Ian,

`MyProtocol` does not provide an `__init__()`, and thus
```
super().__init__()
```
is calling the `__init__()` from `Protocol`. This results in the `TypeError`.

Simply remove `super().__init__()` to resolve your issue.

This behavior was changed in https://github.com/python/cpython/pull/27545 (see 
`Lib/typing.py:1384`); I don't see what you are reporting as a regression, I 
see it as correct behavior that I would expect. Apologies if you feel 
differently.

Cheers,
Julian

--

___
Python tracker 

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



[issue45156] mock.seal has infinite recursion with int class attributes

2021-09-12 Thread Irit Katriel


Irit Katriel  added the comment:

Pdb) list
2916if m._mock_new_parent is mock:
2917  try:
2918seal(m)
2919  except:
2920breakpoint()
2921 -> raise
2922
2923
2924class _AsyncIterator:
2925"""
2926Wraps an iterator in an asynchronous iterator.
(Pdb) p m


--

___
Python tracker 

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



[issue45156] mock.seal has infinite recursion with int class attributes

2021-09-12 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11:

>>> foo = mock.create_autospec(Foo)
>>> mock.seal(foo)

^CTraceback (most recent call last):
  File "", line 1, in 
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/mock.py", line 2917, in 
seal
seal(m)
^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/mock.py", line 2917, in 
seal
seal(m)
^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/mock.py", line 2917, in 
seal
seal(m)
^^^
  [Previous line repeated 645 more times]
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/mock.py", line 2911, in 
seal
m = getattr(mock, attr)
^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/mock.py", line 662, in 
__getattr__
result = create_autospec(
 
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/mock.py", line 2672, in 
create_autospec
mock = Klass(parent=_parent, _new_parent=_parent, _new_name=_new_name,
   ^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/mock.py", line 416, in 
__new__
new = type(cls.__name__, bases, {'__doc__': cls.__doc__})
  ^^^
KeyboardInterrupt

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue45126] [sqlite3] cleanup and harden Connection and Cursor __init__

2021-09-12 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +26712
pull_request: https://github.com/python/cpython/pull/28298

___
Python tracker 

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



[issue42119] Error when debugging logging.FileHandler subclass __init__ method

2021-09-12 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Changing from not a bug to duplicate of #20853.

--
resolution: not a bug -> duplicate
superseder:  -> pdb "args" crashes when an arg is not printable

___
Python tracker 

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



[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Eryk Sun


Eryk Sun  added the comment:

> FWIW, I did test with "-X utf8" option

I was suggesting to modify the tests to use the UTF-8 mode option in the 
spawn_python() command line. It doesn't help to run the parent process in UTF-8 
mode since it isn't inherited. It could be inherited via PYTHONUTF8, but it 
turns out that environment variables won't help in this case due to the use of 
the -E and -I command-line options.

--

___
Python tracker 

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



[issue45126] [sqlite3] cleanup and harden Connection and Cursor __init__

2021-09-12 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset c78d5ca3806d02e26f9f3fa92ff567f0805eac4c by Erlend Egeberg 
Aasland in branch 'main':
bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231)
https://github.com/python/cpython/commit/c78d5ca3806d02e26f9f3fa92ff567f0805eac4c


--
nosy: +corona10

___
Python tracker 

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



[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Ming Hua


Ming Hua  added the comment:

Eryk Sun (eryksun) posted:
> Python's default can be overridden to UTF-8 for standard I/O via 
> PYTHONIOENCODING, or for all I/O via PYTHONUTF8 or "-X utf8=1".

FWIW, I did test with "-X utf8" option and it wasn't any better.  Just tested 
"python.exe -X utf8=1 -m test -W test_cmd_line_script" with 3.10.0 rc2 again, 
and got 6 errors and 2 failures this way (1 more error than without "-X 
utf8=1").  There is also this new error message:

0:00:01 [1/1] test_cmd_line_script
Warning -- Uncaught thread exception: UnicodeDecodeError
Exception in thread Thread-60 (_readerthread):
Traceback (most recent call last):
  File "C:\Programs\Python\python310\lib\threading.py", line 1009, in 
_bootstrap_inner
self.run()
  File "C:\Programs\Python\python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
  File "C:\Programs\Python\python310\lib\subprocess.py", line 1494, in 
_readerthread
buffer.append(fh.read())
  File "C:\Programs\Python\python310\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 69: 
invalid start byte

--

___
Python tracker 

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Perhaps it is because "little" is checked first. One call of 
_PyUnicode_EqualToASCIIId() for "little" and two for "big".

--

___
Python tracker 

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



[issue30212] test_ssl.py is broken in Centos7

2021-09-12 Thread Irit Katriel


Change by Irit Katriel :


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



[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Eryk Sun


Eryk Sun  added the comment:

In Windows, the standard I/O encoding of the spawn_python() child defaults to 
the process active code page, i.e. GetACP(). In Windows 10, the active code 
page can be set to UTF-8 at the system or application level, but most systems 
and applications still use a legacy code page. Python's default can be 
overridden to UTF-8 for standard I/O via PYTHONIOENCODING, or for all I/O via 
PYTHONUTF8 or "-X utf8=1". I would recommend using one of these UTF-8 options 
instead of trying to make a test work with the legacy code page. There is no 
guarantee, and should be no guarantee, that a filesystem path, which is 
Unicode, can be encoded using a legacy code page.

--
nosy: +eryksun

___
Python tracker 

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



[issue25853] Compile error with pytime.h - struct timespec declared inside parameter list

2021-09-12 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as there isn't enough information here for us to do anything about it 
and there has been no response from the OP to follow-up questions.

--
nosy: +iritkatriel
resolution:  -> works for me
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



[issue45155] Add default arguments for int.to_bytes()

2021-09-12 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Interestingly, "little" is faster than "big".

$ python3.10 -m timeit -r11 -s 'x=3452452454524' 'x.to_bytes(10, "little")'
500 loops, best of 11: 82.7 nsec per loop
$ python3.10 -m timeit -r11 -s 'x=3452452454524' 'x.to_bytes(10, "big")'
500 loops, best of 11: 90.6 nsec per loop

--

___
Python tracker 

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



[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue43413] tuple subclasses allow arbitrary kwargs

2021-09-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue43413] tuple subclasses allow arbitrary kwargs

2021-09-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 92bf8691fb78f3484bf2daba836c416efedb1d8d by Serhiy Storchaka in 
branch 'main':
bpo-43413: Fix handling keyword arguments in subclasses of some buitin classes 
(GH-26456)
https://github.com/python/cpython/commit/92bf8691fb78f3484bf2daba836c416efedb1d8d


--

___
Python tracker 

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



[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Unicode
nosy: +ezio.melotti, serhiy.storchaka, vstinner
type:  -> behavior
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Ming Hua


New submission from Ming Hua :

Background:
Since at least Windows 8, it is possible to invoke the input method engine 
(IME) when installing Windows and creating accounts.  So at least among 
simplified Chinese users, it's not uncommon to have a Chinese account name.

Issue:
After successful installation using the 64-bit .exe installer for Windows, just 
to be paranoid (and to get familiar with Python's test framework), I decided to 
run the bundled regression tests.  To my surprise I got many failures.  The 
following is the summary of "python.exe -m test" with 3.8 some months ago 
(likely 3.8.6):

371 tests OK.

11 tests failed:
test_cmd_line_script test_compileall test_distutils test_doctest
test_locale test_mimetypes test_py_compile test_tabnanny
test_urllib test_venv test_zipimport_support

43 tests skipped:
test_asdl_parser test_check_c_globals test_clinic test_curses
test_dbm_gnu test_dbm_ndbm test_devpoll test_epoll test_fcntl
test_fork1 test_gdb test_grp test_ioctl test_kqueue
test_multiprocessing_fork test_multiprocessing_forkserver test_nis
test_openpty test_ossaudiodev test_pipes test_poll test_posix
test_pty test_pwd test_readline test_resource test_smtpnet
test_socketserver test_spwd test_syslog test_threadsignals
test_timeout test_tix test_tk test_ttk_guionly test_urllib2net
test_urllibnet test_wait3 test_wait4 test_winsound test_xmlrpc_net
test_xxtestfuzz test_zipfile64

Total duration: 59 min 49 sec
Tests result: FAILURE

The failures all look similar though, it seems Python on Windows assumes the 
home directory of the user, "C:\Users\\", is either in ASCII or UTF-8 
encoding, while it is actually in Windows native codepage, in my case cp936 for 
simplified Chinese (zh-CN).

To take a couple of examples (these are from recent testing with 3.10.0 rc2):

> python.exe -m test -W test_cmd_line_script
0:00:03 Run tests sequentially
0:00:03 [1/1] test_cmd_line_script
[...]
test_consistent_sys_path_for_direct_execution 
(test.test_cmd_line_script.CmdLineTest) ... ERROR
[...]
test_directory_error (test.test_cmd_line_script.CmdLineTest) ... FAIL
[...]
ERROR: test_consistent_sys_path_for_direct_execution 
(test.test_cmd_line_script.CmdLineTest)
--
Traceback (most recent call last):
  File "C:\Programs\Python\python310\lib\test\test_cmd_line_script.py", line 
677, in test_consistent_sys_path_for_direct_execution
out_by_name = kill_python(p).decode().splitlines()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 9: invalid 
start byte
[...]
FAIL: test_directory_error (test.test_cmd_line_script.CmdLineTest)
--
Traceback (most recent call last):
  File "C:\Programs\Python\python310\lib\test\test_cmd_line_script.py", line 
268, in test_directory_error
self._check_import_error(script_dir, msg)
  File "C:\Programs\Python\python310\lib\test\test_cmd_line_script.py", line 
151, in _check_import_error
self.assertIn(expected_msg.encode('utf-8'), err)
AssertionError: b"can't find '__main__' module in 'C:Users\xe5<5 bytes 
redacted>AppDataLocalTemptmpcwkfn9ct'" not found in 
b"C:\\Programs\\Python\\python310\\python.exe: can't find '__main__' module in 
'C:Users\xbb<3 bytes 
redacted>AppDataLocalTemptmpcwkfn9ct'\r\n"
[...]
--
Ran 44 tests in 29.769s

FAILED (failures=2, errors=5)
test test_cmd_line_script failed
test_cmd_line_script failed (5 errors, 2 failures) in 30.4 sec

== Tests result: FAILURE ==

In the above test_directory_error AssertionError message I redacted part of the 
path as my account name is my real name.  Hope the issue is clear enough 
despite the redaction, since the "\xe5<5 bytes redacted>" part is 6 bytes and 
apparently in UTF-8 (for two Chinese characters) and the "\xbb<3 bytes 
redacted>" part is 4 bytes and apparently in cp936.

Postscript:
As I've said above, I discovered this issue some time ago, but only have time 
now to report it.  I believe I've see these failures in 3.8.2/6, 3.9.7, and 
3.10.0 rc2.  It shouldn't be hard to reproduce for people with ways to create 
account with non-ASCII name on Windows.  If reproducing turns out to be 
difficult though, I'm happy to provide more information and/or run more tests.

--
components: Tests
messages: 401659
nosy: minghua
priority: normal
severity: normal
status: open
title: Many regtest failures on Windows with non-ASCII account name
versions: Python 3.10, 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



[issue45105] Incorrect handling of unicode character \U00010900

2021-09-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

We recently discussed the RTLO attack on Python sources (sorry, I don't 
remember on what resource) and decided that we should do something with this. I 
think this is a related issue.

--

___
Python tracker 

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

In the stdlib, there is only one use of to_bytes() with sys.byteorder (2 in 
tests), 16 uses of to_bytes()/from_bytes() with 'little' (22 in tests) and 22 
uses with 'big' (33 in tests). So making sys.byteorder the default will help 
almost nobody, and the advantage of 'big' over 'litte' is so small, that making 
any of them the default may only help in a half of cases and confuse in the 
other half.

--

___
Python tracker 

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



[issue45105] Incorrect handling of unicode character \U00010900

2021-09-12 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

@Steven: the difference between indexing and the repr of list() is also 
explained by Eryk's explanation.

s = ... # (value from msg401078)
for x in repr(list(s)):
   print(x)

The output shows characters in the expected order.

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The struct module has 4 different modes. By default it uses not only native 
byte order, but native sizes and alignments which depend on OS and compiler. 
You need to know all these details just to understand the format codes. I think 
that the struct module user is more prepared to work with different word sizes 
and therefore with different byte ordering.

--

___
Python tracker 

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



[issue45155] Add default arguments for int.to_bytes()

2021-09-12 Thread Vedran Čačić

Vedran Čačić  added the comment:

My sensibilities are irrelevant here. I'm just saying we already have a 
standard byte order for data in transit, and it was introduced long before this 
thing called internet (it was with capital I back then:) started to interest me.

--

___
Python tracker 

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