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

Fixes Python 3 compatibility issue. #515

Merged
merged 2 commits into from
Aug 3, 2017
Merged

Conversation

sfermigier
Copy link
Contributor

Cf. issue #514

@codecov-io
Copy link

codecov-io commented Aug 3, 2017

Codecov Report

Merging #515 into master will decrease coverage by 0.08%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #515      +/-   ##
==========================================
- Coverage   90.25%   90.17%   -0.09%     
==========================================
  Files          24       24              
  Lines        4004     4009       +5     
==========================================
+ Hits         3614     3615       +1     
- Misses        390      394       +4
Impacted Files Coverage Δ
babel/dates.py 91.24% <33.33%> (-0.53%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df9111e...8f0feb1. Read the comment docs.

babel/dates.py Outdated
return self.pattern

def __str__(self):
self.__unicode__().encode('utf-8')
Copy link
Member

Choose a reason for hiding this comment

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

This statement is missing its return statement.

babel/dates.py Outdated
@@ -1215,8 +1214,16 @@ def __init__(self, pattern, format):
def __repr__(self):
return '<%s %r>' % (type(self).__name__, self.pattern)

def __unicode__(self):
return self.pattern
if PY2:
Copy link
Member

Choose a reason for hiding this comment

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

To be honest, I'd be more comfortable if the PY2 code lived within the functions instead of the class definition changing depending on interpreter version:

def __unicode__(self):
    return self.pattern

def __str__(self):
    pat = self.pattern
    if PY2:
        pat = pat.encode('utf-8')
    return pat

@gitmate-bot gitmate-bot added size/S and removed size/XS labels Aug 3, 2017
@akx akx merged commit 5f3b008 into python-babel:master Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants