Skip to content

Commit efd4193

Browse files
bonzinijpakkane
authored andcommitted
arglist: post is only appended to, make it a list
self.post is only ever appended to on the right hand. However, it is then reversed twice in flush_pre_post(), by using "for a in reversed.post()" and appendleft() within the loop. It would be tempting to use appendleft() in __iadd__ to avoid the call to reversed(), but that is not a good idea because the loop of flush_pre_post() is part of a slow path. It's rather more important to use a fast extend-with-list-argument in the fast path where needs_override_check if False. For clarity, and to remove the temptation, make "post" a list instead of a deque. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 0ce21ac commit efd4193

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mesonbuild/arglist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def __init__(self, compiler: T.Union['Compiler', 'StaticLinker'],
106106
self._container: T.List[str] = list(iterable) if iterable is not None else []
107107

108108
self.pre: T.Deque[str] = collections.deque()
109-
self.post: T.Deque[str] = collections.deque()
109+
self.post: T.List[str] = []
110110
self.needs_override_check: bool = False
111111

112112
# Flush the saved pre and post list into the _container list

0 commit comments

Comments
 (0)