Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-12656: Replace bare except with except Exception #46

Merged
merged 1 commit into from Nov 17, 2017
Merged

Conversation

timj
Copy link
Member

@timj timj commented Nov 15, 2017

No description provided.

Copy link
Contributor

@r-owen r-owen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with one question about existing code

@@ -237,7 +237,7 @@ def ProductDir(env, product):
global _productDirs
try:
_productDirs
except:
except Exception:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is fine but I'm puzzled what the try is for. When the module is first loaded _productDirs is sure to be undefined so the try is sure to run, attempting to compute _productDirs. Naively I would expect the outer try/except block to do nothing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First time through it's not set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First time through the try/except fires. How is that different than getting rid of the outer try/except and just setting _productDirs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is 6 years old. We could work around it by setting the variable to none at module scope and then checking for is None rather than doing the try block. I'm inclined to leave it alone for the moment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I guess. I am just trying to understand if the try/except is actually doing anything at all. Have you tried removing it to see if it still works?

@RobertLuptonTheGood
Copy link
Member

RobertLuptonTheGood commented Nov 17, 2017 via email

@timj timj merged commit 0c873b3 into master Nov 17, 2017
@ktlim ktlim deleted the tickets/DM-12656 branch August 25, 2018 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants