mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.
Fix two bugs in 'destination <name> clear' command:
1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
instead of proceeding directly to the fail().
(cherry picked from commit 3372bcba98)
This commit is contained in:
parent
b71144193b
commit
63c945a3f5
3 changed files with 74 additions and 9 deletions
|
|
@ -1798,7 +1798,7 @@ def __getitem__(self, i):
|
|||
|
||||
def clear(self):
|
||||
for ta in self._array:
|
||||
ta._text.clear()
|
||||
ta.text.clear()
|
||||
|
||||
def dump(self):
|
||||
texts = [ta.output() for ta in self._array]
|
||||
|
|
@ -4121,14 +4121,19 @@ def directive_set(self, name, value):
|
|||
|
||||
self.clinic.__dict__[name] = value
|
||||
|
||||
def directive_destination(self, name, command, *args):
|
||||
if command == 'new':
|
||||
self.clinic.add_destination(name, *args)
|
||||
return
|
||||
|
||||
if command == 'clear':
|
||||
self.clinic.get_destination(name).clear()
|
||||
fail("unknown destination command", repr(command))
|
||||
def directive_destination(
|
||||
self,
|
||||
name: str,
|
||||
command: str,
|
||||
*args
|
||||
) -> None:
|
||||
match command:
|
||||
case "new":
|
||||
self.clinic.add_destination(name, *args)
|
||||
case "clear":
|
||||
self.clinic.get_destination(name).clear()
|
||||
case _:
|
||||
fail("unknown destination command", repr(command))
|
||||
|
||||
|
||||
def directive_output(self, command_or_name, destination=''):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue