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

Transactional rename on Windows #355

Merged
merged 1 commit into from
Dec 3, 2018
Merged

Transactional rename on Windows #355

merged 1 commit into from
Dec 3, 2018

Conversation

mehrdadn
Copy link
Contributor

No description provided.

success = True
except (NotImplementedError, OSError):
pass
if not success:
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense for this block to be inside the body of the except clause and the success = False; success = True bit go away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure I could do that if you'd like. The reason behind this was that I've gotten burned before in Python 2 when raising exceptions from except blocks, so I try to avoid it just in case it becomes an issue again (not sure if it's entirely fixed in Python 3 but I try to write code that'd work in Python 2 too).

Copy link
Member

Choose a reason for hiding this comment

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

ok-client should be python3 only, but I'm curious about that issue. There are issues raising different exceptions in an except block in python2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup! What would Python print? :-)

try:
	try: raise ValueError("ValueError")
	except:
		try: raise NotImplementedError("NotImplementedError")
		except: pass
		raise
except Exception as ex: print(ex)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I just removed success, see the updated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I just realized I don't raise NotImplementedError properly... let me fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok fixed.

@mehrdadn mehrdadn force-pushed the txf branch 2 times, most recently from f2955d6 to 6dda3d6 Compare December 3, 2018 17:46
Copy link
Member

@colinschoen colinschoen left a comment

Choose a reason for hiding this comment

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

LGTM

@colinschoen colinschoen merged commit 7e54ff4 into master Dec 3, 2018
@mehrdadn mehrdadn deleted the txf branch December 3, 2018 18:47
kavigupta added a commit that referenced this pull request Mar 4, 2019
kavigupta added a commit that referenced this pull request Mar 4, 2019
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.

2 participants