[issue45615] Missing test for type of error when printing traceback for non-exception

2022-01-02 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue45615] Missing test for type of error when printing traceback for non-exception

2022-01-02 Thread Irit Katriel
Irit Katriel added the comment: New changeset a82baed0e9e61c0d8dc5c12fc08de7fc172c1a38 by Irit Katriel in branch 'main': bpo-45615: Add missing test for printing traceback for non-exception. Fix traceback.py (GH-30091)

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-12-13 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch pull_requests: +28314 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30091 ___ Python tracker ___

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-07 Thread Irit Katriel
Irit Katriel added the comment: I see what you mean. I think it's ok in traceback.py to reject an exception clone which is not an instance of BaseException. I agree this should not be backported. You could make that explicit by adding a few words to this sentence in the doc, to make it about

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-07 Thread Nikita Sobolev
Nikita Sobolev added the comment: 1. Thanks! Yes, this is exactly the case I am talking about. Right now, this test won't pass: ``` def test_print_exception_bad_type_python(self): with self.assertRaises(TypeError): traceback.print_exception(42) ``` Why? Because we

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-07 Thread Irit Katriel
Irit Katriel added the comment: 1. I don't think we need such a clone of exception. We just need something like these two tests: @cpython_only def test_print_exception_bad_type_ct(self): with self.assertRaises(TypeError): from _testcapi import exception_print

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-06 Thread Nikita Sobolev
Nikita Sobolev added the comment: Couple of thoughts. 1. You have to create quite complex structural "clone" of `Exception` for python-based `traceback`: ```python def test_non_exception_subtype(self): class RegularObject: __traceback__ = None

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-05 Thread Nikita Sobolev
Nikita Sobolev added the comment: Thanks! пт, 5 нояб. 2021 г. в 12:47, Irit Katriel : > > Irit Katriel added the comment: > > It's been merged now, so go ahead. > > Note that there are two traceback printing functions - in the interpreter > in traceback.c and in the library in traceback.py.

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-05 Thread Irit Katriel
Irit Katriel added the comment: It's been merged now, so go ahead. Note that there are two traceback printing functions - in the interpreter in traceback.c and in the library in traceback.py. They are expected to work the same as much as possible. If you add a test to

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-04 Thread Nikita Sobolev
Nikita Sobolev added the comment: Yes, I would love to! Thanks :) I will wait for GH-29207 to be merged first. чт, 4 нояб. 2021 г. в 14:02, Irit Katriel : > > Irit Katriel added the comment: > > Nikita, if you want to work on this go head, but I would wait until PR > 29207 is merged. > > I

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-04 Thread Irit Katriel
Irit Katriel added the comment: Nikita, if you want to work on this go head, but I would wait until PR 29207 is merged. I think in the C code what we need to do is remove the check in _testcapi - this is a test utility, it doesn't need to verify input types. --

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-04 Thread Irit Katriel
Irit Katriel added the comment: You're right Nikita, that's what main currently does. My output was from a branch where I started fixing it. Sorry about the confusion. -- ___ Python tracker

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-04 Thread Nikita Sobolev
Nikita Sobolev added the comment: For me something different happens now: ``` Python 3.11.0a1+ (heads/main-dirty:e03e50377d, Nov 4 2021, 13:09:20) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import traceback >>>

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-03 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-10-26 Thread Erlend E. Aasland
Change by Erlend E. Aasland : -- nosy: +erlendaasland ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45615] Missing test for type of error when printing traceback for non-exception

2021-10-26 Thread Irit Katriel
New submission from Irit Katriel : In C code, there is a check in print_exception that the value passed in is of type exception, and it raises TypeError otherwise. This check is not covered by tests, and indeed it is hard to reach it with tests because the _testcapi module has this check as