From 1f48913db3ad35a73ae85717f579e2f0e7a5cc38 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 6 Aug 2022 09:55:49 -0700 Subject: gh-95251: IDLE - Add What's New section to README (GH-95688) (GH-95726) Document what I (TJR) currently do for 3.10/3.11. Co-authored-by: Erlend E. Aasland (cherry picked from commit a302a274892f2dad4e1fa492c4886d55e4df0a80) Co-authored-by: Terry Jan Reedy --- Lib/idlelib/README.txt | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 67de2be..779b51c 100644 --- a/Lib/idlelib/README.txt +++ b/Lib/idlelib/README.txt @@ -243,8 +243,8 @@ OTHER TOPICS Generally use PEP 8. -import ------- +import statements +----------------- Put imports at the top, unless there is a good reason otherwise. PEP 8 says to group stdlib, 3rd-party dependencies, and package imports. For idlelib, the groups are general stdlib, tkinter, and idlelib. @@ -259,3 +259,24 @@ htest function def or "if __name__ == '__main__'" clause. Within module imports like "from idlelib.mod import class" may cause circular imports to deadlock. Even without this, circular imports may require at least one of the imports to be delayed until a function call. + +What's New entries +------------------ + +Repository directory Doc/whatsnew/ has a file 3.n.rst for each 3.n +Python version. For the first entry in each file, add subsection +'IDLE and idlelib', in alphabetical position, to the 'Improved Modules' +section. For the rest of cpython, entries to 3.(n+1).rst begin with +the release of 3.n.0b1. For IDLE, entries for features backported from +'main' to '3.n' during its beta period do not got in 3.(n+1).rst. The +latter usually gets its first entry during the 3.n.0 candidate period +or after the 3.n.0 release. + +When, as per PEP 434, feature changes are backported, entries are placed +in the 3.n.rst file *in the main branch* for each Python version n that +gets the backport. (Note: the format of entries have varied between +versions.) Add a line "New in 3.n maintenance releases." before the +first back-ported feature after 3.n.0 is released. Since each older +version file gets a different number of backports, it is easiest to +make a separate PR for each file and label it with the backports +needed. -- cgit v0.12 From 11f7d41ccf369a6400fff9321955f17f5aa8d4ff Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 6 Aug 2022 10:01:10 -0700 Subject: gh-89362: Doc IDLE menu and search (GH-95697) (GH-95718) Update menu item position and capitalization. Add paragraph about search. For help.html, include save-as addition. (cherry picked from commit 834064c19a110dad425dc290c91c0545eaa24471) Co-authored-by: Terry Jan Reedy --- Doc/library/idle.rst | 42 +++++++++++++++++++++++++----------------- Lib/idlelib/help.html | 42 +++++++++++++++++++++++++++--------------- 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 2d52e53..f2ef72d 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -61,17 +61,17 @@ New File Open... Open an existing file with an Open dialog. -Recent Files - Open a list of recent files. Click one to open it. - Open Module... Open an existing module (searches sys.path). +Recent Files + Open a list of recent files. Click one to open it. + .. index:: - single: Class browser + single: Module browser single: Path browser -Class Browser +Module Browser Show functions, classes, and methods in the current Editor file in a tree structure. In the shell, open a module first. @@ -89,7 +89,7 @@ Save As... Save the current window with a Save As dialog. The file saved becomes the new associated file for the window. (If your file namager is set to hide extensions, the current extension will be omitted in the file name box. - If the new filename has no '.', '.py' and .'txt' will be added for Python + If the new filename has no '.', '.py' and '.txt' will be added for Python and text files, except that on macOS Aqua,'.py' is added for all files.) Save Copy As... @@ -117,6 +117,9 @@ Undo Redo Redo the last undone change to the current window. +Select All + Select the entire contents of the current window. + Cut Copy selection into the system-wide clipboard; then delete the selection. @@ -128,9 +131,6 @@ Paste The clipboard functions are also available in context menus. -Select All - Select the entire contents of the current window. - Find... Open a search dialog with many options @@ -159,12 +159,12 @@ Expand Word Expand a prefix you have typed to match a full word in the same window; repeat to get a different expansion. -Show call tip +Show Call Tip After an unclosed parenthesis for a function, open a small window with function parameter hints. See :ref:`Calltips ` in the Editing and navigation section below. -Show surrounding parens +Show Surrounding Parens Highlight the surrounding parenthesis. .. _format-menu: @@ -172,6 +172,11 @@ Show surrounding parens Format menu (Editor window only) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Format Paragraph + Reformat the current blank-line-delimited paragraph in comment block or + multiline string or selected line in a string. All lines in the + paragraph will be formatted to less than N columns, where N defaults to 72. + Indent Region Shift selected lines right by the indent width (default 4 spaces). @@ -198,12 +203,7 @@ New Indent Width Open a dialog to change indent width. The accepted default by the Python community is 4 spaces. -Format Paragraph - Reformat the current blank-line-delimited paragraph in comment block or - multiline string or selected line in a string. All lines in the - paragraph will be formatted to less than N columns, where N defaults to 72. - -Strip trailing whitespace +Strip Trailing Chitespace Remove trailing space and other whitespace characters after the last non-whitespace character of a line by applying str.rstrip to each line, including lines within multiline strings. Except for Shell windows, @@ -474,6 +474,14 @@ are restricted to four spaces due to Tcl/Tk limitations. See also the indent/dedent region commands on the :ref:`Format menu `. +Search and Replace +^^^^^^^^^^^^^^^^^^ + +Any selection becomes a search target. However, only selections within +a line work because searches are only performed within lines with the +terminal newline removed. If ``[x] Regular expresion`` is checked, the +target is interpreted according to the Python re module. + .. _completions: Completions diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index e8e7d28..ac38612 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -91,6 +91,7 @@
  • Editor windows
  • Key bindings
  • Automatic indentation
  • +
  • Search and Replace
  • Completions
  • Calltips
  • Code Context
  • @@ -237,13 +238,13 @@ described below are moved around to conform to Apple guidelines.

    Open…

    Open an existing file with an Open dialog.

    -
    Recent Files

    Open a list of recent files. Click one to open it.

    -
    Open Module…

    Open an existing module (searches sys.path).

    +
    Recent Files

    Open a list of recent files. Click one to open it.

    +
    -
    Class Browser

    Show functions, classes, and methods in the current Editor file in a +

    Module Browser

    Show functions, classes, and methods in the current Editor file in a tree structure. In the shell, open a module first.

    Path Browser

    Show sys.path directories, modules, functions, classes and methods in a @@ -255,10 +256,13 @@ and after the window title. If there is no associated file, do Save As instead.

    Save As…

    Save the current window with a Save As dialog. The file saved becomes the -new associated file for the window.

    +new associated file for the window. (If your file namager is set to hide +extensions, the current extension will be omitted in the file name box. +If the new filename has no ‘.’, ‘.py’ and ‘.txt’ will be added for Python +and text files, except that on macOS Aqua,’.py’ is added for all files.)

    Save Copy As…

    Save the current window to different file without changing the associated -file.

    +file. (See Save As note above about filename extensions.)

    Print Window

    Print the current window to the default printer.

    @@ -278,6 +282,8 @@ be undone.

    Redo

    Redo the last undone change to the current window.

    +
    Select All

    Select the entire contents of the current window.

    +
    Cut

    Copy selection into the system-wide clipboard; then delete the selection.

    Copy

    Copy selection into the system-wide clipboard.

    @@ -287,8 +293,6 @@ be undone.

    The clipboard functions are also available in context menus.

    -
    Select All

    Select the entire contents of the current window.

    -
    Find…

    Open a search dialog with many options

    Find Again

    Repeat the last search, if there is one.

    @@ -309,17 +313,21 @@ Clear any selection and update the line and column status.

    Expand Word

    Expand a prefix you have typed to match a full word in the same window; repeat to get a different expansion.

    -
    Show call tip

    After an unclosed parenthesis for a function, open a small window with +

    Show Call Tip

    After an unclosed parenthesis for a function, open a small window with function parameter hints. See Calltips in the Editing and navigation section below.

    -
    Show surrounding parens

    Highlight the surrounding parenthesis.

    +
    Show Surrounding Parens

    Highlight the surrounding parenthesis.

    Format menu (Editor window only)

    +
    Format Paragraph

    Reformat the current blank-line-delimited paragraph in comment block or +multiline string or selected line in a string. All lines in the +paragraph will be formatted to less than N columns, where N defaults to 72.

    +
    Indent Region

    Shift selected lines right by the indent width (default 4 spaces).

    Dedent Region

    Shift selected lines left by the indent width (default 4 spaces).

    @@ -338,11 +346,7 @@ Editing and navigation section below.

    New Indent Width

    Open a dialog to change indent width. The accepted default by the Python community is 4 spaces.

    -
    Format Paragraph

    Reformat the current blank-line-delimited paragraph in comment block or -multiline string or selected line in a string. All lines in the -paragraph will be formatted to less than N columns, where N defaults to 72.

    -
    -
    Strip trailing whitespace

    Remove trailing space and other whitespace characters after the last +

    Strip Trailing Chitespace

    Remove trailing space and other whitespace characters after the last non-whitespace character of a line by applying str.rstrip to each line, including lines within multiline strings. Except for Shell windows, remove extra newlines at the end of the file.

    @@ -565,6 +569,13 @@ are restricted to four spaces due to Tcl/Tk limitations.

    See also the indent/dedent region commands on the Format menu.

    +
    +

    Search and Replace

    +

    Any selection becomes a search target. However, only selections within +a line work because searches are only performed within lines with the +terminal newline removed. If [x] Regular expresion is checked, the +target is interpreted according to the Python re module.

    +

    Completions

    Completions are supplied, when requested and available, for module @@ -1021,6 +1032,7 @@ also used for testing.

  • Editor windows
  • Key bindings
  • Automatic indentation
  • +
  • Search and Replace
  • Completions
  • Calltips
  • Code Context
  • @@ -1141,7 +1153,7 @@ also used for testing.



    - Last updated on Jul 03, 2022. + Last updated on Aug 05, 2022. Found a bug?
    -- cgit v0.12 From 96c1f013b3ea142616979f0b02fee81a7b41eb70 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 6 Aug 2022 10:15:48 -0700 Subject: gh-95155: Update "Using Python on a Mac" documentation (GH-95284) (GH-95742) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Langa (cherry picked from commit d25ff1f61387edd65a91b3930b12bcf4d734e8a1) Co-authored-by: Howie Zhao --- Doc/using/mac.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/using/mac.rst b/Doc/using/mac.rst index f85b5bd..9ae0270 100644 --- a/Doc/using/mac.rst +++ b/Doc/using/mac.rst @@ -17,15 +17,16 @@ the IDE and the Package Manager that are worth pointing out. Getting and Installing MacPython ================================ -macOS since version 10.8 comes with Python 2.7 pre-installed by Apple. If you wish, you -are invited to install the most recent version of Python 3 from the Python +macOS used to come with Python 2.7 pre-installed between versions +10.8 and `12.3 `_. +You are invited to install the most recent version of Python 3 from the Python website (https://www.python.org). A current "universal binary" build of Python, which runs natively on the Mac's new Intel and legacy PPC CPU's, is available there. What you get after installing is a number of things: -* A :file:`Python 3.9` folder in your :file:`Applications` folder. In here +* A :file:`Python 3.12` folder in your :file:`Applications` folder. In here you find IDLE, the development environment that is a standard part of official Python distributions; and PythonLauncher, which handles double-clicking Python scripts from the Finder. -- cgit v0.12 From 08510324db019ea8bd3c54de6860aed06cb47af1 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 6 Aug 2022 10:30:46 -0700 Subject: gh-95395: Add argument type error test (GH-95412) (GH-95744) (cherry picked from commit 4703c158116bd157e20938bbf5356b79422470bb) Co-authored-by: Sion Kang <31057849+Yaminyam@users.noreply.github.com> --- Lib/test/test_grp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py index c7ec03e..e52e17b 100644 --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -49,10 +49,12 @@ class GroupDatabaseTestCase(unittest.TestCase): def test_errors(self): self.assertRaises(TypeError, grp.getgrgid) + self.assertRaises(TypeError, grp.getgrgid, 3.14) self.assertRaises(TypeError, grp.getgrnam) + self.assertRaises(TypeError, grp.getgrnam, 42) self.assertRaises(TypeError, grp.getgrall, 42) # embedded null character - self.assertRaises(ValueError, grp.getgrnam, 'a\x00b') + self.assertRaisesRegex(ValueError, 'null', grp.getgrnam, 'a\x00b') # try to get some errors bynames = {} -- cgit v0.12 From 6dffb5f1cfe4b1ae30ce726907161b87f915c87d Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 6 Aug 2022 10:31:58 -0700 Subject: gh-95376: Add test for names containing null (GH-GH-5394) (#GH-5746) Co-authored-by: Erlend Egeberg Aasland (cherry picked from commit a17cd47b614f8bc660788647a009a25e121221d7) Co-authored-by: Sion Kang <31057849+Yaminyam@users.noreply.github.com> --- Lib/test/test_pwd.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py index c789326..aa090b4 100644 --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -59,6 +59,8 @@ class PwdTest(unittest.TestCase): self.assertRaises(TypeError, pwd.getpwnam) self.assertRaises(TypeError, pwd.getpwnam, 42) self.assertRaises(TypeError, pwd.getpwall, 42) + # embedded null character + self.assertRaisesRegex(ValueError, 'null', pwd.getpwnam, 'a\x00b') # try to get some errors bynames = {} -- cgit v0.12