human
Solve the following python programming problem given the following code:
def build(self) : 
    'Invokes the build program.' 
    if self._built : 
        raise RuntimeError ('This build program was already used.') 
self._built = True 
    self.produce_artifacts () 
    sub_artifacts = [] 
    failures = [] 
    gen = self.build_state.builder 
    def _build(artifact, build_func) : 
        ctx = gen.build_artifact (artifact, build_func) 
        if (ctx is not None) : 
            if (ctx.exc_info is not None) : 
                failures.append (ctx.exc_info) 
else : 
                sub_artifacts.extend (ctx.sub_artifacts) 
for artifact in self.artifacts : 
        _build (artifact, self.build_artifact) 
while (sub_artifacts and (not self)) : 
        (artifact, build_func) = sub_artifacts.pop () 
        _build (artifact, build_func) 
if failures : 
        for artifact in self.artifacts : 
            artifact.set_dirty_flag () 

    
    

    Fix the buggy line: while (sub_artifacts and (not self)) :
assistant
#Here is Python program to fix the buggy line: while (sub_artifacts and (not self)) :
.

while (sub_artifacts and (not failures)) :