You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
symtable.symtable doesn't accept bytes which leads to a mismatch from compile() #81182
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/DinoV'closed_at=<Date2019-05-28.23:22:09.353>created_at=<Date2019-05-21.21:01:35.251>labels= ['3.8', 'library']
title="symtable.symtable doesn't accept bytes which leads to a mismatch from compile()"updated_at=<Date2019-05-28.23:22:09.353>user='https://github.com/DinoV'
symtable is useful when combined with compile() to AST to understand what the names bind to. But symtable.symtable() doesn't accept a bytes object, while compile does. Ultimately these feed down to the same API, and could easily lead to subtle mismatches due to encodings.
The workaround seems to be to use the tokenize.detect_encoding to discover the encoding and then do the encoding from Python, but this seems wasteful.
Activity
DinoV commentedon May 21, 2019
symtable is useful when combined with compile() to AST to understand what the names bind to. But symtable.symtable() doesn't accept a bytes object, while compile does. Ultimately these feed down to the same API, and could easily lead to subtle mismatches due to encodings.
The workaround seems to be to use the tokenize.detect_encoding to discover the encoding and then do the encoding from Python, but this seems wasteful.
DinoV commentedon May 28, 2019
New changeset 4154069 by Dino Viehland in branch 'master':
bpo-37001: Makes symtable.symtable have parity with compile for input (bpo-13483)
4154069