[issue45756] mock raises exception when using a spec with an attribute that raises exception on access

2021-12-03 Thread Nikita Sobolev
Change by Nikita Sobolev : -- keywords: +patch nosy: +sobolevn nosy_count: 3.0 -> 4.0 pull_requests: +28125 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29901 ___ Python tracker __

[issue41768] unittest.mock spec calls class properties

2021-12-03 Thread Nikita Sobolev
Nikita Sobolev added the comment: Related PR: https://github.com/python/cpython/pull/29901 -- nosy: +sobolevn ___ Python tracker ___ __

[issue41768] unittest.mock spec calls class properties

2021-12-03 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +lukasz.langa ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Erik Montnemery
New submission from Erik Montnemery : typing.NamedTuple behaves in surprising ways when it has default arguments which lack type annotations: >>> from typing import NamedTuple >>> class MyTuple(NamedTuple): ... a = 1000 ... >>> tmp = MyTuple() >>> tmp.a 1000 >>> len(tmp) 0 >>> bool(tmp) Fa

[issue45756] mock raises exception when using a spec with an attribute that raises exception on access

2021-12-03 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +lukasz.langa ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Christian Heimes
Change by Christian Heimes : -- nosy: +christian.heimes nosy_count: 5.0 -> 6.0 pull_requests: +28126 pull_request: https://github.com/python/cpython/pull/29902 ___ Python tracker _

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Alex Waygood
Change by Alex Waygood : -- components: +Library (Lib) nosy: +AlexWaygood, gvanrossum, kj ___ Python tracker ___ ___ Python-bugs-lis

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Spencer Brown
Spencer Brown added the comment: What's happening is that typing.NamedTuple ignores non-annotated attributes entirely when computing the names it passes along to namedtuple(), so here "a" is just a class attribute. You're accessing it from there, but the tuple itself is entirely empty. Perha

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Eric V. Smith
Eric V. Smith added the comment: I don't think we'd want to prohibit zero-length namedtuples (or NamedTuples). I've used them, especially when I'm dynamically creating them. This is just a side effect of how Python works. I don't think there's anything to do here, except maybe mention it in

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Alex Waygood
Alex Waygood added the comment: I agree that prohibiting zero-length NamedTuples seems like a bad idea, and also agree that this probably doesn't need to be documented. The behaviour here definitely looks weird at first glance, but it's probably not a good idea to tamper with the __bool__()

[issue45967] Tkinter.ttk.Treeview does not clear after opening and reopening another using same code block

2021-12-03 Thread E. Paine
E. Paine added the comment: This is because your code isn't clearing the Treeview, it's hiding it by setting the parent Frame's width and height to 0. When this parent Frame is reshown, because you want to put a new TreeView on it, the old one is still there. The easiest way to solve this i

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Erik Montnemery
Erik Montnemery added the comment: I think elaborating in the documentation that only annotated attributes make it to the underlying namedtuple() would be helpful, it's not obvious that they are instead just class attributes. -- ___ Python tracker

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Alex Waygood
Alex Waygood added the comment: To me, the fact that NamedTuple uses class attributes to provide field defaults feels like an implementation detail that is only relevant to an unusual edge case. Where do you think the documentation should be improved, and what is your suggested wording? :)

[issue45654] Freeze the runpy module.

2021-12-03 Thread Kumar Aditya
Change by Kumar Aditya : -- keywords: +patch nosy: +kumaraditya303 nosy_count: 2.0 -> 3.0 pull_requests: +28127 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/29903 ___ Python tracker

[issue45885] Specialize COMPARE_OP

2021-12-03 Thread Mark Shannon
Mark Shannon added the comment: New changeset 03768c4d139df46212a091ed931aad03bec18b57 by Dennis Sweeney in branch 'main': bpo-45885: Specialize COMPARE_OP (GH-29734) https://github.com/python/cpython/commit/03768c4d139df46212a091ed931aad03bec18b57 -- __

[issue20750] Roundtrip-test tokenize.untokenize(iterable_of_5_tuples)

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: The 7 tests are still removed and need to be checked: https://github.com/python/cpython/blob/03768c4d139df46212a091ed931aad03bec18b57/Lib/test/test_tokenize.py#L1620 -- nosy: +iritkatriel versions: +Python 3.11 -Python 3.3, Python 3.4 _

[issue45972] typing.NamedTuple with default arguments without type annotations is falsy

2021-12-03 Thread Erik Montnemery
Erik Montnemery added the comment: Maybe something like this: diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 735d477db4..8de913d8db 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1291,7 +1291,8 @@ These are not used in annotations. They are building b

[issue7727] xmlrpc library returns string which contain null ( \x00 )

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: 2.7 is no longer relevant, and it looks like these examples are working now: >>> xmlrpc.client.dumps(('\u20ac',), encoding='iso-8859-1') '\n\n€\n\n\n' >>> xmlrpc.client.dumps((u'\u20ac',), encoding='iso-8859-1') '\n\n€\n\n\n' There is possibly still a documentat

[issue23538] New Windows installer in 3.5.0a1 breaks compatibility with Wine

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: There doesn't seem to be information here that can help do anything about it, and version 3.5 is no longer maintained. Please create a new issue if you are still having this problem with current versions (>= 3.9). -- nosy: +iritkatriel resolution: ->

[issue27946] elementtree calls PyDict_GetItem without owning a reference to the dict

2021-12-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Concur with Irit. We should patch the caller of PyDict_GetItem, not PyDict_GetItem. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue20970] [doc] contradictory documentation for prog option of argparse

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +easy -patch title: contradictory documentation for prog option of argparse -> [doc] contradictory documentation for prog option of argparse type: -> behavior versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 3.5 __

[issue30214] make_zip.py lacks command a few line options.

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: Tools/msi/make_zip.py does not exist since 3.7. -- nosy: +iritkatriel resolution: -> out of date stage: -> resolved status: open -> closed type: -> enhancement ___ Python tracker

[issue45957] _tkinter.TclError: expected boolean value but got ""

2021-12-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It looks like a bug in Tk 8.6.11. It is expected that the implementation of "wm overrideredirect" returns an empty string if pass the boolean argument. The returned value is an empty string, but its type is not cleared. Seems it keeps the type of previous

[issue45957] _tkinter.TclError: expected boolean value but got ""

2021-12-03 Thread Alex Waygood
Change by Alex Waygood : -- type: crash -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Christian Heimes
Change by Christian Heimes : -- keywords: +patch pull_requests: +28128 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/29904 ___ Python tracker

[issue45957] _tkinter.TclError: expected boolean value but got ""

2021-12-03 Thread E. Paine
E. Paine added the comment: > Do we still use Tk 8.6.11 on any platform with Python 3.9+ No, none of the python.org installers include it now. On Linux, according to https://pkgs.org/download/tk, several distros still use 8.6.11 (most notably Ubuntu 21.04). I'll see if I can reproduce it on

[issue45971] calendar module issue

2021-12-03 Thread Christian Heimes
Christian Heimes added the comment: > Note: Sep. 1752 had only 19 days. ( 11 days skipped ) That statement is only correct for countries where the Church of England was predominant: Great Britain and colonies of the British Empire in e.g, North America (later known as US of A). Alaska change

[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Christian Heimes
Christian Heimes added the comment: New changeset ccb73a0d50dd03bc8455fe210cb83e41a6dc91d8 by Christian Heimes in branch 'main': bpo-45582: Fix out-of-tree build issues with new getpath (GH-29902) https://github.com/python/cpython/commit/ccb73a0d50dd03bc8455fe210cb83e41a6dc91d8 --

[issue45962] Clarify that PyModule_AddString{Constant, Macro} use utf-8

2021-12-03 Thread Alex Waygood
Change by Alex Waygood : -- type: -> enhancement ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue45964] 3.10.0 tests fail in test_pdb_breakpoints_preserved_across_interactive_sessions

2021-12-03 Thread Alex Waygood
Change by Alex Waygood : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue45964] gdb test fails when packaging Python 3.10 for openSUSE/Linux

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- title: 3.10.0 tests fail in test_pdb_breakpoints_preserved_across_interactive_sessions -> gdb test fails when packaging Python 3.10 for openSUSE/Linux ___ Python tracker

[issue45964] 3.10.0 tests fail in test_pdb_breakpoints_preserved_across_interactive_sessions

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: > Happens when packaging Python 3.10 for openSUSE/Linux. Can you give full details of what you're doing? -- ___ Python tracker ___ ___

[issue45635] Tidy up error handling in traceback.c / python run.c

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch pull_requests: +28129 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29905 ___ Python tracker ___ ___

[issue20741] Documentation archives should be available also in tar.xz format

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: Those archives seem to go only up to 3.9. Is this still relevant? -- nosy: +iritkatriel ___ Python tracker ___

[issue45973] Not possible to clear PyImport_Inittab after PyImport_AppendInittab

2021-12-03 Thread Daniel
New submission from Daniel : Hello, When embedding Python into a C application and not using Py_RunMain it is not possible to remove a module added to PyImport_Inittab even if the interpreter is finalized and a new is created. One reason for not using Py_RunMain is to use python as a subproc

[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Christian Heimes
Christian Heimes added the comment: Good news: I got a test case for OOT build with read-only sources Bad news: 15 test cases are failing and testing takes much longer because pyc files are missing. 15 re-run tests: test__xxsubinterpreters test_ast test_bdb test_capi test_doctest tes

[issue20751] Misleading descriptor protocol documentation: direct call, super binding

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- type: -> behavior versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker ___ _

[issue45950] Reintroduce bootstrap_python for freezing

2021-12-03 Thread Christian Heimes
Christian Heimes added the comment: New changeset 84ca1232b0f1e4be368e89550a9ceb46f64a0eff by Christian Heimes in branch 'main': bpo-45950: Introduce Bootstrap Python again (#29859) https://github.com/python/cpython/commit/84ca1232b0f1e4be368e89550a9ceb46f64a0eff -- ___

[issue45964] gdb test fails when packaging Python 3.10 for openSUSE/Linux

2021-12-03 Thread Christian Heimes
Christian Heimes added the comment: This looks like a problem on your side. Line 94 is the correct line for the function in 3.10.0 release. $ git checkout v3.10.0 $ sed -n '94p' Lib/pdb.py def find_function(funcname, filename): Matej, does your build system perhaps strip off the shebang of

[issue20751] Misleading descriptor protocol documentation: direct call, super binding

2021-12-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- title: Misleading descriptor protocol documentation: direct call, super binding -> Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs ___ Python tracker

[issue27582] Mispositioned SyntaxError caret for unknown code points

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- stage: needs patch -> resolved status: pending -> closed ___ Python tracker ___ ___ Python-bugs-list mai

[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Gregory P. Smith
Gregory P. Smith added the comment: Nice trick with that RO bind mount. tests... yes we do have some writable source tree messes in there to be dealt with. -- ___ Python tracker ___

[issue45695] Out-of-tree builds are not tested.

2021-12-03 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: FWIW, it is also impossible to build the docs OOT without cluttering the source tree. $ cd ../build $ make -C ../cpython.git/Doc venv $ make -C ../cpython.git/Doc html # <= modifies Doc/build in the source tree -- nosy: +erlendaaslan

[issue45967] Tkinter.ttk.Treeview does not clear after opening and reopening another using same code block

2021-12-03 Thread Ned Deily
Change by Ned Deily : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs

[issue45967] Tkinter.ttk.Treeview does not clear after opening and reopening another using same code block

2021-12-03 Thread Harold Meneley
Harold Meneley added the comment: Some times , I forget the program languages differences. Sorry. Thanks for your time. Harold On Fri, Dec 3, 2021, 12:48 PM Ned Deily wrote: > > Change by Ned Deily : > > > -- > resolution: -> not a bug > stage: -> resolved > status: open -> closed

[issue45711] Simplify the interpreter's (type, val, tb) exception representation

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: New changeset 2ff758bd1a144ee712e96ae1db91f476c3b252bb by Irit Katriel in branch 'main': bpo-45711: [asyncio] Normalize exceptions immediately after Fetch, before they are stored as StackItem, which should be normalized (GH-29890) https://github.com/python/cpy

[issue45960] bullseye arm/v7 time.time() Operation not permitted

2021-12-03 Thread Christian Heimes
Christian Heimes added the comment: time.time() is a wrapper for libc function call clock_gettime() with CLOCK_REALTIME. This is either a problem with the container build or a Kernel ABI issue between the container build and your operating system. I suggest that you report the issue to https

[issue45816] Python does not support standalone MSVC v143 (VS 2022) Build Tools

2021-12-03 Thread Steve Dower
Steve Dower added the comment: New changeset d9301703fb1086cafbd730c17e3d450a192485d6 by Crowthebird in branch 'main': bpo-45816: Support building with VS 2022 (v143 toolset) on Windows (GH-29577) https://github.com/python/cpython/commit/d9301703fb1086cafbd730c17e3d450a192485d6 --

[issue45816] Python does not support standalone MSVC v143 (VS 2022) Build Tools

2021-12-03 Thread Steve Dower
Change by Steve Dower : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue44530] Propagate qualname from the compiler unit to code objects for finer grained profiling data

2021-12-03 Thread Steve Dower
Change by Steve Dower : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue39529] Deprecate get_event_loop()

2021-12-03 Thread Ben Darnell
Ben Darnell added the comment: > In IPython, I think you could use new_event_loop() for getting a new loop > instance. > Then, save the loop reference somewhere as a direct attribute, > threading.local or ContextVar. > Calling loop.run_until_complete() looks pretty normal in your situation.

[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread neonene
Change by neonene : -- nosy: +neonene nosy_count: 6.0 -> 7.0 pull_requests: +28130 pull_request: https://github.com/python/cpython/pull/29906 ___ Python tracker ___ ___

[issue35419] Thread.is_alive while running Process.is_alive causes either premature termination or never-terminating.

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: Use this queue for multithreaded applications: https://docs.python.org/3/library/queue.html Mixing multiprocessing with multithreading often doesn't work. -- nosy: +iritkatriel resolution: -> not a bug stage: -> resolved status: open -> closed

[issue45877] Inconsistency in minimal supported version of Microsoft Visual Studio

2021-12-03 Thread Steve Dower
Steve Dower added the comment: It probably all needs straightening out: * Microsoft Visual Studio 2015 *or later* can be used to build the project files * Microsoft Visual C++ 14.3 is what we use to build the official releases for the main branch (3.11) * earlier branches may still be using p

[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: See also Issue20751 -- nosy: +iritkatriel, rhettinger ___ Python tracker ___ ___ Python-bugs-list m

[issue12384] difflib.SequenceMatcher and Match: code and doc bugs

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.2, Python 3.3 ___ Python tracker ___

[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread neonene
neonene added the comment: PGO-instrumented binary seems not to specify the stdlib directory on PR29041. I can run it with PYTHONPATH set. Python path configuration: PYTHONHOME = 'C:\Py311\' PYTHONPATH = (not set) program name = 'C:\Py311\PCbuild\amd64\instrumented\python.exe' isolat

[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker ___

[issue23317] Incorrect description of descriptor invocation in Python Language Reference

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: See also issue20751. -- nosy: +iritkatriel, rhettinger ___ Python tracker ___ ___ Python-bugs-list

[issue31441] Descriptor example in documentation is confusing, possibly wrong

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: see also issue20751. -- nosy: +iritkatriel ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue45607] Make it possible to enrich an exception's error message

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: New changeset 5bb7ef2768be5979b306e4c7552862b1746c251d by Irit Katriel in branch 'main': bpo-45607: Make it possible to enrich exception displays via setting their __note__ field (GH-29880) https://github.com/python/cpython/commit/5bb7ef2768be5979b306e4c755286

[issue45607] Make it possible to enrich an exception's error message

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.11 ___ Python tracker ___ _

[issue28953] Use `raise from` when raising new IncompleteRead

2021-12-03 Thread Irit Katriel
Irit Katriel added the comment: I just pushed a new feature which may provide a simpler way to do this: https://bugs.python.org/issue45607 -- nosy: +iritkatriel ___ Python tracker __

[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Steve Dower
Steve Dower added the comment: New changeset 7d7c91a8e8c0bb04105a21a17d1061ffc1c04d80 by neonene in branch 'main': bpo-45582: Add a NOT operator to the condition in getpath_isxfile (GH-29906) https://github.com/python/cpython/commit/7d7c91a8e8c0bb04105a21a17d1061ffc1c04d80 -- _

[issue45974] Using walrus produces different/unoptimized bytecode

2021-12-03 Thread Fatih Kilic
New submission from Fatih Kilic : So, what I mean by unoptimized bytecode is, for example when you type `a = 10 * 10`, the resulting bytecode is the following: ``` LOAD_CONST 0 (100) STORE_NAME 0 (a) ... ``` However, when you type, `(a := 10 * 10) == None`, the resulting bytecode is the foll

[issue45974] Using walrus produces different/unoptimized bytecode

2021-12-03 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: See: https://bugs.python.org/issue42282 and the reason for not backporting this: https://bugs.python.org/issue42282#msg380506 -- components: +Interpreter Core -Parser nosy: +BTaskaya resolution: -> duplicate stage: -> resolved status: open -> clos

[issue45974] Using walrus produces different/unoptimized bytecode

2021-12-03 Thread Fatih Kilic
Fatih Kilic added the comment: Ah, I see. Thanks! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue44844] The command line of launching Edge on Linux hangs

2021-12-03 Thread Steve Dower
Change by Steve Dower : -- pull_requests: -27916 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread Benjamin Peterson
Change by Benjamin Peterson : -- nosy: +benjamin.peterson nosy_count: 7.0 -> 8.0 pull_requests: +28131 pull_request: https://github.com/python/cpython/pull/29907 ___ Python tracker ___

[issue31441] Descriptor example in documentation is confusing, possibly wrong

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: This example was removed and replaced with better examples. -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker _

[issue44844] The command line of launching Edge on Linux hangs

2021-12-03 Thread Steve Dower
Change by Steve Dower : -- pull_requests: +28132 pull_request: https://github.com/python/cpython/pull/29908 ___ Python tracker ___ _

[issue44844] The command line of launching Edge on Linux hangs

2021-12-03 Thread Steve Dower
Steve Dower added the comment: @Ray I posted a PR that works fine on Windows, would you be able to try it on Linux? The executables seem to have different names, so I'm a little concerned about the change, but I think it should be alright. -- ___

[issue33909] PyObject_CallFinalizerFromDealloc is not referenced in any documentation

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- nosy: +pitrou versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker ___ __

[issue45975] Simplify some while-loops with walrus operator

2021-12-03 Thread Nick Drozd
New submission from Nick Drozd : The following pattern occurs a few times in the codebase: while 1: data = conn.recv(blocksize) if not data: break ... There is an unbounded while loop in which some kind of input is read. If the input is there, it is processed and

[issue45582] Rewrite getpath.c in Python

2021-12-03 Thread miss-islington
miss-islington added the comment: New changeset 0ae4e0c959bbc90ec18180ef3cc957759d346ced by Benjamin Peterson in branch 'main': bpo-45582 Fix prototype of _Py_Get_Getpath_CodeObject. (GH-29907) https://github.com/python/cpython/commit/0ae4e0c959bbc90ec18180ef3cc957759d346ced -- nosy

[issue26160] [doc] Tutorial incorrectly claims that (explicit) relative imports don't work in the main module

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- title: Tutorial incorrectly claims that (explicit) relative imports don't work in the main module -> [doc] Tutorial incorrectly claims that (explicit) relative imports don't work in the main module versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Regarding comment #1, The wording is correct and there was a reason for using a method. While super() can be used for attribute lookup, use cases are almost entirely dominated by method lookups. For many users, an attribute lookup with super() is unconv

[issue9544] [doc] xdrlib.Packer().pack_fstring throws a TypeError when called with a str()

2021-12-03 Thread Irit Katriel
Change by Irit Katriel : -- title: xdrlib.Packer().pack_fstring throws a TypeError when called with a str() -> [doc] xdrlib.Packer().pack_fstring throws a TypeError when called with a str() versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.5, Python 3.6, Python 3.7 _

[issue24709] Unix build uses '-Wno-unused-result', which icc doesn't recognize

2021-12-03 Thread Ammar Askar
Ammar Askar added the comment: Looks like the latest versions of icc support this flag: https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/compiler-diagnostic-options/wunused-v

[issue45885] Specialize COMPARE_OP

2021-12-03 Thread Dennis Sweeney
Change by Dennis Sweeney : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue45975] Simplify some while-loops with walrus operator

2021-12-03 Thread Zachary Ware
Zachary Ware added the comment: As a general rule, refactorings like this tend to be rejected as the risk of inadvertently adding a new bug outweighs the benefit of subjectively cleaner code ("if it ain't broke, don't fix it!"). Is there any measurable performance benefit from this? Reducing

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +28134 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/29909 ___ Python tracker ___

[issue20907] behavioral differences between shutil.unpack_archive and ZipFile.extractall

2021-12-03 Thread Andrei Kulakov
Change by Andrei Kulakov : -- nosy: +andrei.avk nosy_count: 6.0 -> 7.0 pull_requests: +28135 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/29910 ___ Python tracker __

[issue20907] behavioral differences between shutil.unpack_archive and ZipFile.extractall

2021-12-03 Thread Andrei Kulakov
Andrei Kulakov added the comment: I think it may be good enough to add a warning on skipped files in _unpack_zipfile(). - this way we keep backwards compatibility (especially since behavior in both modules differed for such a long time.) - it's not clear that ZipFile behavior is superior

[issue27831] Python 3.4.5 leaks memory when attempting to load non-existent file

2021-12-03 Thread Ammar Askar
Ammar Askar added the comment: Looks like this got fixed somewhere along between 3.5 and 3.6 --- 3.5 --- ./python: can't open file 'id:000109': [Errno 2] No such file or directory = ==28078==ERROR: LeakSanitizer: detected memor

[issue20907] behavioral differences between shutil.unpack_archive and ZipFile.extractall

2021-12-03 Thread Andrei Kulakov
Andrei Kulakov added the comment: I forgot to add this: - we may not want to follow the behavior of command line unzip - it's interactive so considerations are somewhat different. For example, it will warn if file is being overwritten and show a prompt on whether to skip, overwrite, abort,

[issue31735] Documentation incorrectly states how descriptors are invoked

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: > it should have > > d.__get__(obj, type(obj)) instead of d.__get__(obj) The objtype argument is optional as shown in all of the examples. The call from object.__getattribute__() always passes in both parameters, even though only the first is required.

[issue23317] Incorrect description of descriptor invocation in Python Language Reference

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: I think we can leave this as-is. It does a reasonable job of communicating where the descriptor is found and the arguments used when it is called. Marking this as out of date because later in the howto guide there is a precise pure python equivalent for

[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Andrew Lin
New submission from Andrew Lin : This PR obtains a performance improvement in the random module by removing a cached attribute lookup in Random._randbelow_with_getrandbits() that costs time on average. In the best cases (on my machine) I get 10% improvement for randrange(), 7% for shuffle(),

[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch nosy: +python-dev nosy_count: 1.0 -> 2.0 pull_requests: +28136 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29911 ___ Python tracker _

[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the suggestion. I'll try this out on various builds and machines to see how it works out. The speed of locals is consistently fast, but the speed of method calls has varied over the last few versions of Python (generally getting faster). Whe

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 135ecc3492cee259090fd4aaed9056c130cd2eba by Raymond Hettinger in branch 'main': bpo-20751: Replace method example with attribute example, matching the descriptor howto (GH-29909) https://github.com/python/cpython/commit/135ecc3492cee259090f

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list

[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: * If you post a timing script, it will make it easier for me to verify this across versions and across machine and for various input sizes. * If you have time, do run some benchmarks for _randbelow_without_getrandbits() * Try your change with and without

[issue45975] Simplify some while-loops with walrus operator

2021-12-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: The general rule as stated by Zachary is correct; however, I'm in mildly favor of this PR because these are the use cases that the walrus operator was specifically designed for. That said, it would be nice to verify that timings don't get worse and to ca

[issue45976] Random._randbelow() loses time by caching an attribute lookup

2021-12-03 Thread Andrew Lin
Andrew Lin added the comment: Timings are unaffected by updating to non-walrus, so I'll do so in the PR. Using _randbelow_without_getrandbits() I get 5% improvement to sample([None] * 2047, 50); 6% to shuffle([None] * 2000); and approximately 6% to randrange() for any number significantly le

[issue43799] OpenSSL 3.0.0: define OPENSSL_API_COMPAT 1.1.1

2021-12-03 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: @christian.heimes https://github.com/python/cpython/pull/25481 also needs backporting to 3.9 and 3.8. A Pyenv user has been affected by the "implicit declaration of function ‘SSLv3_method’" compliation error that it fixes in 3.9.9: https://github.com/pyenv/pye

[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-03 Thread Andrei Kulakov
New submission from Andrei Kulakov : Setting sys.pycache_prefix = "", re-creates CWD structure under current directory, e.g. if run from /Users/foo/test, will create /Users/foo/test/Users/foo/test/myfile.pyc . Is that intentional? It seems a little weird. At least it might be good to document

  1   2   >