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

CurtHagenlocher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-dotnet.git


The following commit(s) were added to refs/heads/main by this push:
     new 78625e2  Free the imported schemas in the C Data pyarrow import tests 
(#477)
78625e2 is described below

commit 78625e2da60f57e476b34cd35476943048a38da9
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Sun Oct 18 19:14:47 2026 -0700

    Free the imported schemas in the C Data pyarrow import tests (#477)
    
    ## What's Changed
    
    `ImportArray`, `ImportRecordBatch`, `ImportGuidArray` and
    `ImportBool8Array` in `CDataInterfacePythonTests.cs` allocate a
    `CArrowSchema`, have pyarrow export into it, and import it, but never
    call `CArrowSchema.Free`. The importer calls pyarrow's release callback,
    so what leaked was the `CArrowSchema` struct itself. They now free the
    schema right after importing it, as `ImportDictionaryOfGuidArray` does
    since #474, so a failing assertion can't skip the free.
    
    This only changes tests. Every `CArrowSchema.Create` in the test
    projects now has a matching `CArrowSchema.Free`.
    
    ## Tests
    
    The full `Apache.Arrow.Tests` suite passes on net8.0, net462 and net472,
    with the pyarrow tests enabled.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs 
b/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs
index 48db2b0..b41c743 100644
--- a/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs
+++ b/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs
@@ -463,6 +463,7 @@ namespace Apache.Arrow.Tests
             }
 
             ArrowType type = CArrowSchemaImporter.ImportType(cSchema);
+            CArrowSchema.Free(cSchema);
             StringArray importedArray = 
(StringArray)CArrowArrayImporter.ImportArray(cArray, type);
 
             Assert.Equal(5, importedArray.Length);
@@ -533,6 +534,7 @@ namespace Apache.Arrow.Tests
             }
 
             Schema schema = CArrowSchemaImporter.ImportSchema(cSchema);
+            CArrowSchema.Free(cSchema);
             RecordBatch recordBatch = 
CArrowArrayImporter.ImportRecordBatch(cArray, schema);
             CArrowArray.Free(cArray);
 
@@ -1160,6 +1162,7 @@ namespace Apache.Arrow.Tests
             registry.Register(GuidExtensionDefinition.Instance);
 
             Field field = CArrowSchemaImporter.ImportField(cSchema, registry);
+            CArrowSchema.Free(cSchema);
             Assert.IsType<GuidType>(field.DataType);
 
             IArrowArray importedArray = 
CArrowArrayImporter.ImportArray(cArray, field.DataType);
@@ -1411,6 +1414,7 @@ namespace Apache.Arrow.Tests
             registry.Register(Bool8ExtensionDefinition.Instance);
 
             Field field = CArrowSchemaImporter.ImportField(cSchema, registry);
+            CArrowSchema.Free(cSchema);
             Assert.IsType<Bool8Type>(field.DataType);
 
             IArrowArray importedArray = 
CArrowArrayImporter.ImportArray(cArray, field.DataType);

Reply via email to