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

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

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

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

[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

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

[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

[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

[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

[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

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

[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

[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

[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

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

[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

[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

[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

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

[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

[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""" 2926

[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

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

[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

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

[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

[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

[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

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

[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

[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

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

[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

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

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

[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

[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

[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

[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

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

[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

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