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

shunping pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 3636a23d634 Catch alternate exception type in NumpyBatchConverter 
(#40553)
3636a23d634 is described below

commit 3636a23d634e093033cd45fc32407fbcddf3dc23
Author: Jack McCluskey <[email protected]>
AuthorDate: Tue Oct 13 15:57:54 2026 -0400

    Catch alternate exception type in NumpyBatchConverter (#40553)
---
 sdks/python/apache_beam/typehints/batch.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sdks/python/apache_beam/typehints/batch.py 
b/sdks/python/apache_beam/typehints/batch.py
index b193c590bec..5e18e748808 100644
--- a/sdks/python/apache_beam/typehints/batch.py
+++ b/sdks/python/apache_beam/typehints/batch.py
@@ -188,7 +188,9 @@ class NumpyBatchConverter(BatchConverter):
     if not isinstance(element_type, NumpyTypeHint.NumpyTypeConstraint):
       try:
         element_type = NumpyArray[element_type, ()]
-      except TypeError as e:
+      # NumPy 2.4.6+ can also raise a value error if given a dtype that cannot
+      # be converted into a numpy dtype.
+      except (TypeError, ValueError) as e:
         raise TypeError("Element type is not a dtype") from e
 
     if not isinstance(batch_type, NumpyTypeHint.NumpyTypeConstraint):

Reply via email to