swift
421ebd27 - [Python3] Fix "undefined symbol 'unicode'" from python_lint (#33146)

Commit
5 years ago
[Python3] Fix "undefined symbol 'unicode'" from python_lint (#33146) * [Python3] Fix "undefined symbol 'unicode'" from python_lint This is a little tricky. Python 2 "unicode" was renamed to "str" in Python 3. For Python 2 compatibility, we need to use "unicode" in a couple of places, but that's not defined on Python 3, which causes python_lint errors (even if the reference is never actually executed). To workaround this, when running in Python 3, define "unicode" as a synonym for "str". This defines the symbol (avoiding the "undefined symbol" error from python lint) while preserving the correct functionality on both Python 2 and Python 3. When we drop Python 2 support (which we should do as soon as possible), we can drop this workaround and globally replace "unicode" with "str" to get the right Python 3-only functionality.
Author
Parents
Loading