Fix -Wcast-align warning by using new Python API
This should also be slightly more performant as Python doesn't have to convert to a different unicode format first.
REVIEW: 127043