mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-106970: Fix Argument Clinic 'destination <name> clear' command (#106972)
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().
This commit is contained in:
parent
cdeb1a6caa
commit
3372bcba98
4 changed files with 77 additions and 8 deletions
|
|
@ -1983,7 +1983,7 @@ class BufferSeries:
|
|||
|
||||
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]
|
||||
|
|
@ -4487,13 +4487,13 @@ class DSLParser:
|
|||
command: str,
|
||||
*args
|
||||
) -> None:
|
||||
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))
|
||||
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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue