This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch script/canonical-parser-df
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/script/canonical-parser-df by 
this push:
     new 430fa8776a [Script] Match context-manager errors across Python versions
430fa8776a is described below

commit 430fa8776a4ac7f63c664a6e4872c41438ad976d
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed Sep 23 19:32:18 2026 +0000

    [Script] Match context-manager errors across Python versions
---
 tests/python/tvmscript/test_tvmscript_error_report.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/python/tvmscript/test_tvmscript_error_report.py 
b/tests/python/tvmscript/test_tvmscript_error_report.py
index a59c6f83b6..e80ec3d446 100644
--- a/tests/python/tvmscript/test_tvmscript_error_report.py
+++ b/tests/python/tvmscript/test_tvmscript_error_report.py
@@ -18,6 +18,7 @@
 import ast
 import inspect
 import re
+import sys
 import traceback
 
 import pytest
@@ -113,7 +114,9 @@ def test_invalid_block_function():
         with T.evaluate(0.0):  # error
             T.evaluate(1.0)
 
-    check_error(invalid_block_function, 4, TypeError)
+    # Ordinary Python reports a missing context-manager protocol differently 
before 3.11.
+    error_type = AttributeError if sys.version_info < (3, 11) else TypeError
+    check_error(invalid_block_function, 4, error_type)
 
 
 def test_return_not_allowed():

Reply via email to