[New-bugs-announce] [issue33576] Remove exception wrapping from __set_name__ calls

Nick Coghlan report at bugs.python.org
Sat May 19 01:41:19 EDT 2018


New submission from Nick Coghlan <ncoghlan at gmail.com>:

Type creation currently wraps all exceptions raised by __set_name__ calls with a generic RuntimeError: https://github.com/python/cpython/blob/master/Objects/typeobject.c#L7263

Unfortunately, this makes it difficult to use __set_name__ for descriptor validation operations, since it means the specific exception type gets lost, and it makes the traceback much harder to read (since the generic error messages appears at the end, while the actual error appears somewhere in the middle).

See https://bugs.python.org/issue21145#msg317097 for a specific example.

----------
components: Interpreter Core
messages: 317098
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Remove exception wrapping from __set_name__ calls
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33576>
_______________________________________


More information about the New-bugs-announce mailing list