classification
Title: symtable.symtable doesn't accept bytes which leads to a mismatch from compile()
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: dino.viehland Nosy List: dino.viehland
Priority: normal Keywords: patch

Created on 2019-05-21 21:01 by dino.viehland, last changed 2019-05-28 23:22 by dino.viehland. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13483 merged dino.viehland, 2019-05-22 04:04
Messages (2)
msg343096 - (view) Author: Dino Viehland (dino.viehland) * (Python committer) Date: 2019-05-21 21:01
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.
msg343829 - (view) Author: Dino Viehland (dino.viehland) * (Python committer) Date: 2019-05-28 23:21
New changeset 415406999d7c09af9f3dcacfb4578b9e97b2ce77 by Dino Viehland in branch 'master':
bpo-37001: Makes symtable.symtable have parity with compile for input (#13483)
https://github.com/python/cpython/commit/415406999d7c09af9f3dcacfb4578b9e97b2ce77
History
Date User Action Args
2019-05-28 23:22:09dino.viehlandsetstatus: open -> closed
stage: patch review -> resolved
2019-05-28 23:21:21dino.viehlandsetmessages: + msg343829
2019-05-22 04:04:26dino.viehlandsetkeywords: + patch
stage: patch review
pull_requests: + pull_request13395
2019-05-21 21:01:35dino.viehlandcreate