Kanika Kapoor c048ec9faf Fix context manager __exit__ not being called on exception (#395)
Problem: When an exception occurs in a WITH block, __exit__ was not called,
preventing proper cleanup of context managers.

Solution:
1. Wrap WITH block body in try-except structure
2. On normal exit: call __exit__(None, None, None)
3. On exception: call __exit__ with exception info before re-raising

Changes:
- compiler.c: Wrap WITH body in try-except, ensure __exit__ called in both paths
- ceval.c: Update OP_WITH_EXIT to accept three arguments (exc_type, exc_val, exc_tb)
- tests/520_context.py: Add test to verify __exit__ called on exceptions
2025-12-27 01:12:15 +05:30
..
2025-10-08 21:09:14 +08:00
2025-12-16 17:31:07 +08:00
2025-12-02 22:04:42 +08:00
2025-12-19 16:36:43 +08:00
2025-08-28 16:47:53 +08:00
2025-12-09 13:43:33 +08:00