[issue43002] Exception chaining accepts exception classes

2021-04-11 Thread miss-islington
Change by miss-islington : -- pull_requests: +24076 pull_request: https://github.com/python/cpython/pull/25342 ___ Python tracker ___

[issue43002] Exception chaining accepts exception classes

2021-04-11 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 3.0 -> 4.0 pull_requests: +24075 pull_request: https://github.com/python/cpython/pull/25341 ___ Python tracker

[issue43002] Exception chaining accepts exception classes

2021-01-23 Thread Mark Dickinson
Change by Mark Dickinson : -- pull_requests: +23124 pull_request: https://github.com/python/cpython/pull/24303 ___ Python tracker ___

[issue43002] Exception chaining accepts exception classes

2021-01-23 Thread Mark Dickinson
Mark Dickinson added the comment: Ram: I think you're conflating two separate things, here: (1) The ability to use an exception *class* instead of an exception *instance* in the "from" clause - that is, the ability to do "raise ValueError from TypeError" in place of "raise ValueError from

[issue43002] Exception chaining accepts exception classes

2021-01-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: How do you "the wrong message" to implicitly chain exceptions rather than explicitly? The difference between: try: len(1) except TypeError as e: raise ValueError(msg) from e and try: len(1) except TypeError

[issue43002] Exception chaining accepts exception classes

2021-01-22 Thread Ram Rachum
Ram Rachum added the comment: People barely know how to use the right form of this feature. Providing them with a wrong form that's confusingly similar to the right form and fails silently is an unfortunate choice. "Or just don't do anything. A `raise exception` inside an except block will

[issue43002] Exception chaining accepts exception classes

2021-01-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: It is intended behaviour. `raise ... from` is a general mechanism that you can call anywhere, it is not just limited to raising from the previous exception. It is designed for explicitly setting the chained exception to some arbitrary exception. See the

[issue43002] Exception chaining accepts exception classes

2021-01-22 Thread Ram Rachum
New submission from Ram Rachum : I saw this line of code today: https://github.com/hyperledger/sawtooth-sdk-python/commit/c27b962541c9ae68fd1e6dc691ddee883234f112#diff-eb008203eae2160c5e14c42e5fd2eee164709a93bf5136fa79cc256d4e46eaffR92 I was about to tell this guy that his code is bad since