Unicode trait handling for those vtk methods returning unicode data#355
Merged
Conversation
First commit, needs well formed test and check on platform
Closed
| if default == '\x00': | ||
| t_def = 'traits.Unicode(u"", ' | ||
| elif default == '"': | ||
| t_def = "traits.Unicode(u'%(default)s', " % locals() |
Member
There was a problem hiding this comment.
if default == u'\x00':
default = u''
t_def = 'traits.Unicode({0!r}, enter_set=True, auto_set=False)'.format(default)
Member
There was a problem hiding this comment.
Don't .encode() or clean_special_chars(). {!r} takes care of everything.
Contributor
Author
There was a problem hiding this comment.
@rkern done. I also took care of the part handling String and removed the cleaning function.
Contributor
|
Verified that it works with the following tox.ini |
Contributor
Author
|
Failure seems due to a network problem. Restarting |
|
|
||
| elif PY_VER < 3 and typ is unicode: | ||
| if default == u'\x00': | ||
| default = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The generator code did not handle unicode, but some vtk routines do return them. Although never able to reproduce it, issue #354 shows a situation where it does matter.
I am unsure about potential side effects of this change on client code, but I am surprised it worked until now, and I expect the method was simply not generated, or it was but it returned an empty string.