Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions Doc/library/idle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Go to Line

Show Completions
Open a scrollable list allowing selection of existing names. See
:ref:`Completions <completions>` in the Editing and navigation section below.
:ref:`Completions <completions>` in the Editing and Navigation section below.

Expand Word
Expand a prefix you have typed to match a full word in the same window;
Expand All @@ -167,7 +167,7 @@ Expand Word
Show Call Tip
After an unclosed parenthesis for a function, open a small window with
function parameter hints. See :ref:`Calltips <calltips>` in the
Editing and navigation section below.
Editing and Navigation section below.

Show Surrounding Parens
Highlight the surrounding parenthesis.
Expand All @@ -178,9 +178,9 @@ 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.
Rewrap the text block containing the text insert cursor.
Avoid code lines. See :ref:`Format block<format-block>` in the
Editing and Navigation section below.

Indent Region
Shift selected lines right by the indent width (default 4 spaces).
Expand Down Expand Up @@ -566,6 +566,20 @@ In an editor, import statements have no effect until one runs the file.
One might want to run a file after writing import statements, after
adding function definitions, or after opening an existing file.

.. _format-block:

Format block
^^^^^^^^^^^^

Reformat Paragraph rewraps a block ('paragraph') of contiguous equally
indented non-blank comments, a similar block of text within a multiline
string, or a selected subset of either.
If needed, add a blank line to separate string from code.
Partial lines in a selection expand to complete lines.
The resulting lines have the same indent as before
but have maximum total length of N columns (characters).
Change the default N of 72 on the Window tab of IDLE Settings.

.. _code-context:

Code Context
Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,12 @@ tkinter
using Tcl's ``-all`` and ``-overlap`` options.
(Contributed by Rihaan Meher in :gh:`130848`)

* Added new methods :meth:`!pack_content`, :meth:`!place_content` and
:meth:`!grid_content` which use Tk commands with new names (introduced
in Tk 8.6) instead of :meth:`!*_slaves` methods which use Tk commands
with outdated names.
(Contributed by Serhiy Storchaka in :gh:`143754`)

types
------

Expand Down
2 changes: 1 addition & 1 deletion Lib/dbm/dumb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- seems to contain a bug when updating...
- reclaim free space (currently, space once occupied by deleted or expanded
items is not reused exept if .reorganize() is called)
items is not reused except if .reorganize() is called)
- support concurrent access (currently, if two processes take turns making
updates, they can mess up the index)
Expand Down
25 changes: 18 additions & 7 deletions Lib/idlelib/help.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Lib/test/test_inspect/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,30 @@ def running_check_generator():
# Running after the first yield
next(self.generator)

def test_types_coroutine_wrapper_state(self):
def gen():
yield 1
yield 2

@types.coroutine
def wrapped_generator_coro():
# return a generator iterator so types.coroutine
# wraps it into types._GeneratorWrapper.
return gen()

g = wrapped_generator_coro()
self.addCleanup(g.close)
self.assertIs(type(g), types._GeneratorWrapper)

# _GeneratorWrapper must provide gi_suspended/cr_suspended
# so inspect.get*state() doesn't raise AttributeError.
self.assertEqual(inspect.getgeneratorstate(g), inspect.GEN_CREATED)
self.assertEqual(inspect.getcoroutinestate(g), inspect.CORO_CREATED)

next(g)
self.assertEqual(inspect.getgeneratorstate(g), inspect.GEN_SUSPENDED)
self.assertEqual(inspect.getcoroutinestate(g), inspect.CORO_SUSPENDED)

def test_easy_debugging(self):
# repr() and str() of a generator state should contain the state name
names = 'GEN_CREATED GEN_RUNNING GEN_SUSPENDED GEN_CLOSED'.split()
Expand Down
12 changes: 12 additions & 0 deletions Lib/test/test_os/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,18 @@ def test_fstat(self):
finally:
fp.close()

@unittest.skipUnless(hasattr(posix, 'stat'),
'test needs posix.stat()')
@unittest.skipUnless(os.stat in os.supports_follow_symlinks,
'test needs follow_symlinks support in os.stat()')
def test_stat_fd_zero_follow_symlinks(self):
with self.assertRaisesRegex(ValueError,
'cannot use fd and follow_symlinks together'):
posix.stat(0, follow_symlinks=False)
with self.assertRaisesRegex(ValueError,
'cannot use fd and follow_symlinks together'):
posix.stat(1, follow_symlinks=False)

def check_statlike_path(self, func):
self.assertTrue(func(os_helper.TESTFN))
self.assertTrue(func(os.fsencode(os_helper.TESTFN)))
Expand Down
66 changes: 50 additions & 16 deletions Lib/test/test_tkinter/test_geometry_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def test_pack_configure_after(self):
b.pack_configure(side='top')
c.pack_configure(side='top')
d.pack_configure(side='top')
self.assertEqual(pack.pack_slaves(), [a, b, c, d])
self.assertEqual(pack.pack_content(), [a, b, c, d])
a.pack_configure(after=b)
self.assertEqual(pack.pack_slaves(), [b, a, c, d])
self.assertEqual(pack.pack_content(), [b, a, c, d])
a.pack_configure(after=a)
self.assertEqual(pack.pack_slaves(), [b, a, c, d])
self.assertEqual(pack.pack_content(), [b, a, c, d])

def test_pack_configure_anchor(self):
pack, a, b, c, d = self.create2()
Expand Down Expand Up @@ -73,11 +73,11 @@ def test_pack_configure_before(self):
b.pack_configure(side='top')
c.pack_configure(side='top')
d.pack_configure(side='top')
self.assertEqual(pack.pack_slaves(), [a, b, c, d])
self.assertEqual(pack.pack_content(), [a, b, c, d])
a.pack_configure(before=d)
self.assertEqual(pack.pack_slaves(), [b, c, a, d])
self.assertEqual(pack.pack_content(), [b, c, a, d])
a.pack_configure(before=a)
self.assertEqual(pack.pack_slaves(), [b, c, a, d])
self.assertEqual(pack.pack_content(), [b, c, a, d])

def test_pack_configure_expand(self):
pack, a, b, c, d = self.create2()
Expand Down Expand Up @@ -110,10 +110,10 @@ def test_pack_configure_in(self):
c.pack_configure(side='top')
d.pack_configure(side='top')
a.pack_configure(in_=pack)
self.assertEqual(pack.pack_slaves(), [b, c, d, a])
self.assertEqual(pack.pack_content(), [b, c, d, a])
a.pack_configure(in_=c)
self.assertEqual(pack.pack_slaves(), [b, c, d])
self.assertEqual(c.pack_slaves(), [a])
self.assertEqual(pack.pack_content(), [b, c, d])
self.assertEqual(c.pack_content(), [a])
with self.assertRaisesRegex(
TclError, """can't pack "?%s"? inside itself""" % (a,)):
a.pack_configure(in_=a)
Expand Down Expand Up @@ -223,11 +223,11 @@ def test_pack_forget(self):
a.pack_configure()
b.pack_configure()
c.pack_configure()
self.assertEqual(pack.pack_slaves(), [a, b, c])
self.assertEqual(pack.pack_content(), [a, b, c])
b.pack_forget()
self.assertEqual(pack.pack_slaves(), [a, c])
self.assertEqual(pack.pack_content(), [a, c])
b.pack_forget()
self.assertEqual(pack.pack_slaves(), [a, c])
self.assertEqual(pack.pack_content(), [a, c])
d.pack_forget()

def test_pack_info(self):
Expand Down Expand Up @@ -273,6 +273,14 @@ def test_pack_propagate(self):
self.assertEqual(pack.winfo_reqwidth(), 20)
self.assertEqual(pack.winfo_reqheight(), 40)

def test_pack_content(self):
pack, a, b, c, d = self.create2()
self.assertEqual(pack.pack_content(), [])
a.pack_configure()
self.assertEqual(pack.pack_content(), [a])
b.pack_configure()
self.assertEqual(pack.pack_content(), [a, b])

def test_pack_slaves(self):
pack, a, b, c, d = self.create2()
self.assertEqual(pack.pack_slaves(), [])
Expand Down Expand Up @@ -477,6 +485,15 @@ def test_place_info(self):
with self.assertRaises(TypeError):
f2.place_info(0)

def test_place_content(self):
foo = tkinter.Frame(self.root)
bar = tkinter.Frame(self.root)
self.assertEqual(foo.place_content(), [])
bar.place_configure(in_=foo)
self.assertEqual(foo.place_content(), [bar])
with self.assertRaises(TypeError):
foo.place_content(0)

def test_place_slaves(self):
foo = tkinter.Frame(self.root)
bar = tkinter.Frame(self.root)
Expand Down Expand Up @@ -729,10 +746,10 @@ def test_grid_forget(self):
c = tkinter.Button(self.root)
b.grid_configure(row=2, column=2, rowspan=2, columnspan=2,
padx=3, pady=4, sticky='ns')
self.assertEqual(self.root.grid_slaves(), [b])
self.assertEqual(self.root.grid_content(), [b])
b.grid_forget()
c.grid_forget()
self.assertEqual(self.root.grid_slaves(), [])
self.assertEqual(self.root.grid_content(), [])
self.assertEqual(b.grid_info(), {})
b.grid_configure(row=0, column=0)
info = b.grid_info()
Expand All @@ -749,10 +766,10 @@ def test_grid_remove(self):
c = tkinter.Button(self.root)
b.grid_configure(row=2, column=2, rowspan=2, columnspan=2,
padx=3, pady=4, sticky='ns')
self.assertEqual(self.root.grid_slaves(), [b])
self.assertEqual(self.root.grid_content(), [b])
b.grid_remove()
c.grid_remove()
self.assertEqual(self.root.grid_slaves(), [])
self.assertEqual(self.root.grid_content(), [])
self.assertEqual(b.grid_info(), {})
b.grid_configure(row=0, column=0)
info = b.grid_info()
Expand Down Expand Up @@ -887,6 +904,23 @@ def test_grid_size(self):
f.grid_configure(row=4, column=5)
self.assertEqual(self.root.grid_size(), (6, 5))

def test_grid_content(self):
self.assertEqual(self.root.grid_content(), [])
a = tkinter.Label(self.root)
a.grid_configure(row=0, column=1)
b = tkinter.Label(self.root)
b.grid_configure(row=1, column=0)
c = tkinter.Label(self.root)
c.grid_configure(row=1, column=1)
d = tkinter.Label(self.root)
d.grid_configure(row=1, column=1)
self.assertEqual(self.root.grid_content(), [d, c, b, a])
self.assertEqual(self.root.grid_content(row=0), [a])
self.assertEqual(self.root.grid_content(row=1), [d, c, b])
self.assertEqual(self.root.grid_content(column=0), [b])
self.assertEqual(self.root.grid_content(column=1), [d, c, a])
self.assertEqual(self.root.grid_content(row=1, column=1), [d, c])

def test_grid_slaves(self):
self.assertEqual(self.root.grid_slaves(), [])
a = tkinter.Label(self.root)
Expand Down
Loading
Loading