cool-RR / PySnooper

Never use print for debugging again
MIT License
16.31k stars 954 forks source link

compatiblity with python 3.12 #236

Closed keszybz closed 1 year ago

keszybz commented 1 year ago

Hi, in Fedora, we're starting to test compatiblity of packages with Python 3.12. pysnooper tests fail, see https://bugzilla.redhat.com/show_bug.cgi?id=2196749 for some logs and reproduction information. It seems to be related to traceback details.

=========================== short test summary info ============================                                  
FAILED tests/test_pysnooper.py::test_relative_time - tests.utils.OutputFailure:                                   
FAILED tests/test_pysnooper.py::test_watch[True] - tests.utils.OutputFailure:                                     
FAILED tests/test_pysnooper.py::test_watch[False] - tests.utils.OutputFailure:                                    
FAILED tests/test_pysnooper.py::test_watch_explode[True] - tests.utils.Output...                                  
FAILED tests/test_pysnooper.py::test_watch_explode[False] - tests.utils.Outpu...                                  
FAILED tests/test_pysnooper.py::test_variables_classes[True] - tests.utils.Ou...                                  
FAILED tests/test_pysnooper.py::test_variables_classes[False] - tests.utils.O...                                  
FAILED tests/test_pysnooper.py::test_single_watch_no_comma[True] - tests.util...                                  
FAILED tests/test_pysnooper.py::test_single_watch_no_comma[False] - tests.uti...                                  
FAILED tests/test_pysnooper.py::test_repr_exception[True] - tests.utils.Outpu...                                  
FAILED tests/test_pysnooper.py::test_repr_exception[False] - tests.utils.Outp...                                  
FAILED tests/test_pysnooper.py::test_with_block[True] - tests.utils.OutputFai...                                  
FAILED tests/test_pysnooper.py::test_with_block[False] - tests.utils.OutputFa...                                  
FAILED tests/test_pysnooper.py::test_var_order[True] - tests.utils.OutputFail...                                  
FAILED tests/test_pysnooper.py::test_var_order[False] - tests.utils.OutputFai...                                  FAILED tests/test_pysnooper.py::test_indentation - AssertionError: assert 'So...                                  FAILED tests/test_pysnooper.py::test_generator - tests.utils.OutputFailure:                                       FAILED tests/test_pysnooper.py::test_class[True] - tests.utils.OutputFailure:                                     FAILED tests/test_pysnooper.py::test_class[False] - tests.utils.OutputFailure:                                    FAILED tests/test_pysnooper.py::test_class_with_decorated_method[True] - test...                                  FAILED tests/test_pysnooper.py::test_class_with_decorated_method[False] - tes...                                  FAILED tests/test_pysnooper.py::test_class_with_decorated_method_and_snoop_applied_to_method[True]                
FAILED tests/test_pysnooper.py::test_class_with_decorated_method_and_snoop_applied_to_method[False]               
FAILED tests/test_pysnooper.py::test_class_with_property[True] - tests.utils....                                  
FAILED tests/test_pysnooper.py::test_class_with_property[False] - tests.utils...                                  
FAILED tests/test_pysnooper.py::test_snooping_on_class_does_not_cause_base_class_to_be_snooped[True]              
FAILED tests/test_pysnooper.py::test_snooping_on_class_does_not_cause_base_class_to_be_snooped[False]             
================== 27 failed, 51 passed, 20 warnings in 2.74s ==================                                  

Note that Python 3.11 works without any issue.

cool-RR commented 1 year ago

Thank you @keszybz , I'll check it out.

@alexmojaki I investigated a bit and found that the problem might be caused by code you added here: https://github.com/cool-RR/PySnooper/blob/1.1.1/pysnooper/tracer.py#L527

It's possible that this ended_by_exception logic doesn't work anymore in Python 3.12. What happens in practice is that we get the "ended by exception" message even when there was no exception, like this line here.

Do you know anything about that?

cool-RR commented 1 year ago

@keszybz What's the timeline for this feature?

keszybz commented 1 year ago

https://peps.python.org/pep-0693/: 3.12.0 beta 1: Monday, 2023-05-22 (No new features beyond this point.) 3.12.0 final: Monday, 2023-10-02 (expected)

frenzymadness commented 1 year ago

In Fedora, we now have 3.12 beta 3 and it's already merged in rawhide. Good news is that pysnooper is a leaf package (no other packages depend on it) so it doesn't block anything else but it's not installable for users.

cool-RR commented 1 year ago

I'll get to work on it, thank you for letting me know.

On Tue, Jul 11, 2023 at 8:55 AM frenzymadness @.***> wrote:

In Fedora, we now have 3.12 beta 3 and it's already merged in rawhide. Good news is that pysnooper is a leaf package (no other packages depend on it) so it doesn't block anything else but it's not installable for users.

— Reply to this email directly, view it on GitHub https://github.com/cool-RR/PySnooper/issues/236#issuecomment-1630186313, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN3SS7FP2VWNGG5IQDAWLXPTTFFANCNFSM6AAAAAAX75F7GA . You are receiving this because you commented.Message ID: @.***>

cool-RR commented 1 year ago

I believe I fixed the bug in PySnooper 1.2.0, @keszybz can you please confirm?

keszybz commented 1 year ago

Yep, it all seems fine with Python 3.12.0b4. Thanks!