Skip to content

Use of six.text type for comparison in treewalker._base #63

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

Closed
marcdm opened this issue Jun 16, 2013 · 0 comments
Closed

Use of six.text type for comparison in treewalker._base #63

marcdm opened this issue Jun 16, 2013 · 0 comments
Labels
Milestone

Comments

@marcdm
Copy link

marcdm commented Jun 16, 2013

all over the in the file html5lib/treewalkers/_base.py there are places where isinstance is used and the variable is compared to six.text_type instead of six.string_types

On Python 2, six.text_type = unicode, this means that if an attribute of value passed in is str, then there will be an assertion error.

on Python 2:

  • six.string_types = (basestring,)
  • six.text_type = unicode

on Python 3:

  • six.string_types = (builtins.str, )
  • six.text_type = builtins.str

So I think the values should be compared against six.string_types and then six.text_type be used to coerce them for output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant