New submission from Nick Coghlan <ncogh...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue33576>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to