Skip to content

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

Closed
@marcdm

Description

@marcdm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions