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

Fix regression when contents_pillar/contents_grains is a list. #31026

Merged
merged 1 commit into from Feb 9, 2016

Conversation

terminalmage
Copy link
Contributor

Resolves #30934.

if isinstance(item, six.string_types):
ret.append(item)
else:
ret.append(str(item))
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change? is calling str() on every item too expensive, or does it have side effects we don't like? Mostly curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It throws exceptions in Python 2 if the string is unicode and contains unicode characters which can't be decoded to ascii.

WORKS FINE

>>> str(u'foo')
'foo'

KILLS KITTENS

>>> str(u'Д')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0414' in position 0: ordinal not in range(128)
>>>

Copy link
Contributor

Choose a reason for hiding this comment

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

fascinating. Good to know, thanks.

basepi added a commit that referenced this pull request Feb 9, 2016
Fix regression when contents_pillar/contents_grains is a list.
@basepi basepi merged commit 2b8f7a1 into saltstack:2015.8 Feb 9, 2016
@terminalmage terminalmage deleted the issue30934 branch April 6, 2016 23:27
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

2 participants