Skip to content

fix: support pycapsule methods with arguments - #1675

Open
BharatDeva wants to merge 1 commit into
apache:mainfrom
BharatDeva:fix/pycapsule-macro-call-args-1669
Open

fix: support pycapsule methods with arguments#1675
BharatDeva wants to merge 1 commit into
apache:mainfrom
BharatDeva:fix/pycapsule-macro-call-args-1669

Conversation

@BharatDeva

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #1669.

Rationale for this change

register_table_factory accepts FFI table-provider-factory exporters whose __datafusion_table_provider_factory__ method needs the logical extension codec capsule as an argument. The shared from_pycapsule! helper only supported zero-argument dunder methods, so this call site had to keep its own PyCapsule decoding logic.

What changes are included in this PR?

This adds an argument-aware arm to from_pycapsule! and uses it to expose table_provider_factory_from_pycapsule. SessionContext.register_table_factory now uses that shared helper for raw table-provider-factory capsules and exportable objects, while keeping the existing Python-wrapper path for plain Python table factories.

Are there any user-facing changes?

No API change is intended. This is an internal cleanup that lets the existing FFI table-provider-factory path use the same capsule validation/conversion helper as the other FFI capsule paths.

Testing

  • cargo fmt --check
  • git diff --check
  • wsl bash -lc "cd /mnt/c/Users/bhara/OneDrive/Desktop/Python/datafusion-python && cargo check -p datafusion-python"
  • wsl bash -lc "cd /mnt/c/Users/bhara/OneDrive/Desktop/Python/datafusion-python && cargo test -p datafusion-python-util"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

from_pycapsule! / try_from_pycapsule! macros don't support dunder methods that take arguments

1 participant