Page MenuHomeSoftware Heritage

Initialize 'status' before try block
ClosedPublic

Authored by vlorentz on Aug 8 2022, 10:33 AM.

Details

Reviewers
anlambert
Group Reviewers
Reviewers
Maniphest Tasks
Restricted Maniphest Task
Commits
rDLDBASE43597c480640: Initialize 'status' before try block
Summary

It seems that despite setting it in the 'except BaseException' block,
it is still occasionally undefined in the 'finally' block when
triggered by a SystemExit exception.

This should hopefully prevent UnboundLocalError from
being raised from the 'finally' block from now on

Resolves T4236.

Diff Detail

Repository
rDLDBASE Generic VCS/Package Loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8207 (id=29606)

Rebasing onto 0913e11f69...

Current branch diff-target is up to date.
Changes applied before test
commit 43597c480640f885d7b7ab83a97452bcf6436404
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Aug 8 10:32:55 2022 +0200

    Initialize 'status' before try block
    
    It seems that despite setting it in the 'except BaseException' block,
    it is still occasionally undefined in the 'finally' block when
    triggered by a SystemExit exception.
    
    This should hopefully prevent UnboundLocalError from
    being raised from the 'finally' block from now on

See https://jenkins.softwareheritage.org/job/DLDBASE/job/tests-on-diff/817/ for more details.

This revision is now accepted and ready to land.Aug 8 2022, 10:56 AM
This revision was automatically updated to reflect the committed changes.