Message277027
As requested by Nick [0], this is a usability issue against CPython 3.6 to provide a better chained TypeError in this case:
class _TokenType(tuple):
parent = None
def __getattr__(self, name):
new = _TokenType(self + (name,))
setattr(self, name, new)
new.parent = self
return new
Token = _TokenType()
Keyword = Token.Keyword
class KeywordCaseFilter(object):
ttype = Keyword
Traceback (most recent call last):
File "test.py", line 14, in <module>
class KeywordCaseFilter(object):
TypeError: '_TokenType' object is not callable
The exception should report the specific object with the problematic __set_name__ attribute (rather than just passing along the underlying exception), as well as supporting __set_name__ = None to explicitly disable further lookup processing.
Follow up to #27366.
[0] https://github.com/andialbrecht/sqlparse/issues/286#issuecomment-248208900 |
|
Date |
User |
Action |
Args |
2016-09-20 12:38:42 | Tim.Graham | set | recipients:
+ Tim.Graham, ncoghlan |
2016-09-20 12:38:42 | Tim.Graham | set | messageid: <1474375122.62.0.719507311947.issue28214@psf.upfronthosting.co.za> |
2016-09-20 12:38:42 | Tim.Graham | link | issue28214 messages |
2016-09-20 12:38:42 | Tim.Graham | create | |
|