FEAT: Add arrow fetch support #354
Merged
Azure Pipelines / MSSQL-Python-PR-Validation
succeeded
Apr 2, 2026 in 18m 40s
Build #pr-validation-pipeline had test failures
Details
- Failed: 1 (0.00%)
- Passed: 27,828 (97.21%)
- Other: 799 (2.79%)
- Total: 28,628
- 6587 of 8375 lines covered (78.65%)
Annotations
Check failure on line 1 in test_dbc_handle_cleanup_at_shutdown
azure-pipelines / MSSQL-Python-PR-Validation
test_dbc_handle_cleanup_at_shutdown
AssertionError: Process crashed. stderr:
assert -11 == 0
+ where -11 = CompletedProcess(args=['/opt/venv/bin/python', '-c', '\nimport sys\nfrom mssql_python import connect\n\n# Create multiple connections (DBC handles)\nconnections = []\nfor i in range(3):\n conn = connect("Server=172.17.0.4;Database=TestDB;Uid=SA;Pwd=Azure@123!;TrustServerCertificate=yes")\n cursor = conn.cursor()\n cursor.execute(f"SELECT {i} AS test_value")\n result = cursor.fetchall()\n cursor.close() # Close cursor, but keep connection\n connections.append(conn)\n print(f"Connection {i}: created and cursor closed")\n\n# Intentionally skip connection cleanup\n# This will trigger SqlHandle::free() for DBC handles during shutdown\n# Type 2 (DBC) handles should be skipped when pythonShuttingDown=true\nprint("DBC handle cleanup test: Exiting without explicit connection cleanup")\nsys.exit(0)\n'], returncode=-11, stdout='', stderr='').returncode
Raw output
self = <test_013_SqlHandle_free_shutdown.TestHandleFreeShutdown object at 0x5506e60cd0>
conn_str = 'Server=172.17.0.4;Database=TestDB;Uid=SA;Pwd=Azure@123!;TrustServerCertificate=yes'
def test_dbc_handle_cleanup_at_shutdown(self, conn_str):
"""
Test DBC handle (Type 2) cleanup during Python shutdown.
Scenario:
1. Create multiple connections (multiple DBC handles)
2. Close cursors but leave connections open
3. Let Python shutdown without closing connections
4. DBC handles' __del__ should skip SQLFreeHandle during shutdown
Expected: No segfault, clean exit
"""
script = textwrap.dedent(f"""
import sys
from mssql_python import connect
# Create multiple connections (DBC handles)
connections = []
for i in range(3):
conn = connect("{conn_str}")
cursor = conn.cursor()
cursor.execute(f"SELECT {{i}} AS test_value")
result = cursor.fetchall()
cursor.close() # Close cursor, but keep connection
connections.append(conn)
print(f"Connection {{i}}: created and cursor closed")
# Intentionally skip connection cleanup
# This will trigger SqlHandle::free() for DBC handles during shutdown
# Type 2 (DBC) handles should be skipped when pythonShuttingDown=true
print("DBC handle cleanup test: Exiting without explicit connection cleanup")
sys.exit(0)
""")
result = subprocess.run(
[sys.executable, "-c", script], capture_output=True, text=True, timeout=5
)
> assert result.returncode == 0, f"Process crashed. stderr: {result.stderr}"
E AssertionError: Process crashed. stderr:
E assert -11 == 0
E + where -11 = CompletedProcess(args=['/opt/venv/bin/python', '-c', '\nimport sys\nfrom mssql_python import connect\n\n# Create multiple connections (DBC handles)\nconnections = []\nfor i in range(3):\n conn = connect("Server=172.17.0.4;Database=TestDB;Uid=SA;Pwd=Azure@123!;TrustServerCertificate=yes")\n cursor = conn.cursor()\n cursor.execute(f"SELECT {i} AS test_value")\n result = cursor.fetchall()\n cursor.close() # Close cursor, but keep connection\n connections.append(conn)\n print(f"Connection {i}: created and cursor closed")\n\n# Intentionally skip connection cleanup\n# This will trigger SqlHandle::free() for DBC handles during shutdown\n# Type 2 (DBC) handles should be skipped when pythonShuttingDown=true\nprint("DBC handle cleanup test: Exiting without explicit connection cleanup")\nsys.exit(0)\n'], returncode=-11, stdout='', stderr='').returncode
tests/test_013_SqlHandle_free_shutdown.py:296: AssertionError
Loading