Skip to content

Commit

Permalink
Specify exception on StringIO import.
Browse files Browse the repository at this point in the history
Leaving things better than I found it :)
  • Loading branch information
SethMMorton committed Aug 30, 2018
1 parent 85a3c9f commit e5688dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bumpversion/__init__.py
Expand Up @@ -12,7 +12,7 @@
try:
# Python 2
from StringIO import StringIO
except:
except ImportError:
# Python 3
from io import StringIO

Expand Down

3 comments on commit e5688dc

@jaap3
Copy link
Contributor

@jaap3 jaap3 commented on e5688dc Sep 24, 2018

Choose a reason for hiding this comment

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

Nitpick: I would reverse the logic, i.e. try the Python 3 import first and fall back to Python 2 compat

@SethMMorton
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That’s a fine idea, but this PR has been merged already... maybe you should make a PR to fix?

@jaap3
Copy link
Contributor

@jaap3 jaap3 commented on e5688dc Sep 24, 2018

Choose a reason for hiding this comment

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

Good point: #39 :D

Please sign in to comment.