diff options
author | Steve Dower <steve.dower@microsoft.com> | 2016-12-03 11:24:02 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2016-12-03 11:24:02 -0800 |
commit | 9ca70643e30ef19ceb39644dde496b7dfc7fa6e6 (patch) | |
tree | 9dbef5e103e88ce6c36477306f285c16813e0866 /Python/future.c | |
parent | e724fe060b189a4879fd9713a24bbfe6c9eb008e (diff) | |
parent | 43ebbf7db2d3d3297e96693fd91ac8a654631438 (diff) | |
download | cpython-9ca70643e30ef19ceb39644dde496b7dfc7fa6e6.tar.gz |
Issue #28846: Various installer fixes
Diffstat (limited to 'Python/future.c')
-rw-r--r-- | Python/future.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/future.c b/Python/future.c index 4de801bfc0..9c1f43032a 100644 --- a/Python/future.c +++ b/Python/future.c @@ -21,7 +21,7 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename) names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { alias_ty name = (alias_ty)asdl_seq_GET(names, i); - const char *feature = _PyUnicode_AsString(name->name); + const char *feature = PyUnicode_AsUTF8(name->name); if (!feature) return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { @@ -79,7 +79,10 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename) i = 0; first = (stmt_ty)asdl_seq_GET(mod->v.Module.body, i); - if (first->kind == Expr_kind && first->v.Expr.value->kind == Str_kind) + if (first->kind == Expr_kind + && (first->v.Expr.value->kind == Str_kind + || (first->v.Expr.value->kind == Constant_kind + && PyUnicode_CheckExact(first->v.Expr.value->v.Constant.value)))) i++; |