This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mcleonard
Recipients ezio.melotti, mcleonard, vstinner
Date 2018-05-20.21:51:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526853111.38.0.682650639539.issue33588@psf.upfronthosting.co.za>
In-reply-to
Content
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 (ε, α, γ, φ)>
History
Date User Action Args
2018-05-20 21:51:51mcleonardsetrecipients: + mcleonard, vstinner, ezio.melotti
2018-05-20 21:51:51mcleonardsetmessageid: <1526853111.38.0.682650639539.issue33588@psf.upfronthosting.co.za>
2018-05-20 21:51:51mcleonardlinkissue33588 messages
2018-05-20 21:51:51mcleonardcreate