You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "akashchamp (via GitHub)" <gi...@apache.org> on 2026/09/11 18:25:59 UTC
[PR] GH-51301: [Python] Fix NumPy and pandas nightly warnings [arrow]
akashchamp opened a new pull request, #51309:
URL: https://github.com/apache/arrow/pull/51309
### Rationale for this change
Fixes: #51301.
NumPy and pandas nightly builds emit deprecation warnings from PyArrow tests, which obscures compatibility signals.
### What changes are included in this PR?
This updates pandas datetime accessors and Timestamp parsing, requests versioned DLPack exports outside legacy-behavior coverage, captures the expected warning where legacy DLPack behavior is intentionally tested, scopes intentional generic NumPy-unit warnings, and makes the pandas comparison and timedelta inputs explicit.
### Are these changes tested?
- Manually exercised the affected NumPy/Pandas conversions and DLPack exports with warnings treated as errors, including versioned and legacy DLPack behavior.
- Focused affected tests: 21 passed under NumPy 2.6.0.dev0 and pandas 3.1.0.dev0.
- The unfiltered focused run passed and reported only the existing timezone `Series.values` Pandas4Warning tracked separately in #51302. That exact warning was filtered solely for the `-W error` validation command; this PR does not suppress it.
### Are there any user-facing changes?
No.
used codex with pr development
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-51301: [Python] Fix NumPy and pandas nightly warnings [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #51309:
URL: https://github.com/apache/arrow/pull/51309#issuecomment-5749311322
:warning: GitHub issue #51301 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-51301: [Python] Fix NumPy and pandas nightly warnings [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #51309:
URL: https://github.com/apache/arrow/pull/51309#issuecomment-5638940155
:warning: GitHub issue #51301 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-51301: [Python] Fix NumPy and pandas nightly warnings [arrow]
Posted by "akashchamp (via GitHub)" <gi...@apache.org>.
akashchamp commented on code in PR #51309:
URL: https://github.com/apache/arrow/pull/51309#discussion_r4056757796
##########
python/pyarrow/tests/test_dlpack.py:
##########
@@ -270,10 +270,11 @@ def immutable_tensor():
@pytest.mark.parametrize('max_version', [None, (0, 8)])
def test_dlpack_legacy_capsule_immutable_tensor(max_version):
tensor = immutable_tensor()
- with pytest.raises(NotImplementedError,
- match="Legacy DLPack support is not implemented "
- "for immutable tensors"):
- tensor.__dlpack__(max_version=max_version)
+ with pytest.warns(DeprecationWarning, match="unversioned DLPack capsule"):
+ with pytest.raises(NotImplementedError,
+ match="Legacy DLPack support is not implemented "
+ "for immutable tensors"):
+ tensor.__dlpack__(max_version=max_version)
Review Comment:
Good catch, this was our own code warning and then failing. I included the fix here rather than a separate PR: in array.pxi and tensor.pxi the legacy tensor is now created first and the DeprecationWarning is only emitted after that succeeds, so the immutable tensor test is back to expecting just the NotImplementedError.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-51301: [Python] Fix NumPy and pandas nightly warnings [arrow]
Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on code in PR #51309:
URL: https://github.com/apache/arrow/pull/51309#discussion_r4002984053
##########
python/pyarrow/tests/test_dlpack.py:
##########
@@ -270,10 +270,11 @@ def immutable_tensor():
@pytest.mark.parametrize('max_version', [None, (0, 8)])
def test_dlpack_legacy_capsule_immutable_tensor(max_version):
tensor = immutable_tensor()
- with pytest.raises(NotImplementedError,
- match="Legacy DLPack support is not implemented "
- "for immutable tensors"):
- tensor.__dlpack__(max_version=max_version)
+ with pytest.warns(DeprecationWarning, match="unversioned DLPack capsule"):
+ with pytest.raises(NotImplementedError,
+ match="Legacy DLPack support is not implemented "
+ "for immutable tensors"):
+ tensor.__dlpack__(max_version=max_version)
Review Comment:
This seems to be an issue with our own implementation? (we should not be raising both a warning an error at the same time? assuming they both from our code)
cc @AlenkaF
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-51301: [Python] Fix NumPy and pandas nightly warnings [arrow]
Posted by "AlenkaF (via GitHub)" <gi...@apache.org>.
AlenkaF commented on code in PR #51309:
URL: https://github.com/apache/arrow/pull/51309#discussion_r4005944140
##########
python/pyarrow/tests/test_dlpack.py:
##########
@@ -270,10 +270,11 @@ def immutable_tensor():
@pytest.mark.parametrize('max_version', [None, (0, 8)])
def test_dlpack_legacy_capsule_immutable_tensor(max_version):
tensor = immutable_tensor()
- with pytest.raises(NotImplementedError,
- match="Legacy DLPack support is not implemented "
- "for immutable tensors"):
- tensor.__dlpack__(max_version=max_version)
+ with pytest.warns(DeprecationWarning, match="unversioned DLPack capsule"):
+ with pytest.raises(NotImplementedError,
+ match="Legacy DLPack support is not implemented "
+ "for immutable tensors"):
+ tensor.__dlpack__(max_version=max_version)
Review Comment:
Ha, this is coming from our code, yes.
`DeprecationWarning` is triggered in Cython, `NotImplementedError` is triggered in C++. I think we only need to change the order here:
https://github.com/apache/arrow/blob/9ae25f1a9213ada1bcea2398e9d40d45eece8146/python/pyarrow/array.pxi#L2375-L2379
where the warning is triggered only after `legacy_tensor` is successfully created. Same in tensor.pxi.
I can create a separate PR tomorrow, if this change is out of scope for this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org