New submission from Mat Leonard <leonard....@gmail.com>: Unicode symbols used as function arguments aren't preserved in the variable names available from .__code__.co_varnames. Example shown below.
def func(ϵ, α, γ, ϕ): pass varnames = func.__code__.co_varnames print(varnames) print('ϵ' == varnames[0]) print('α' == varnames[1]) print('γ' == varnames[2]) print('ϕ' == varnames[3]) >> ('ε', 'α', 'γ', 'φ') >> False >> True >> True >> False I wrote some code dependent on using function arguments obtained from .__code__.co_varnames in a dictionary. Since the unicode arguments aren't preserved from defining the function and .__code__.co_varnames, the lookup in the dictionary fails. Looks like same thing happens with the inspect module (maybe .__code__.co_varnames comes from inspect) inspect.signature(func) >> <Signature (ε, α, γ, φ)> ---------- components: Unicode files: Screen Shot 2018-05-20 at 2.32.05 PM.png messages: 317201 nosy: ezio.melotti, mcleonard, vstinner priority: normal severity: normal status: open title: Unicode function arguments aren't preserved type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47608/Screen Shot 2018-05-20 at 2.32.05 PM.png _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33588> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com