File: fix-doc-build-basic-units.patch

package info (click to toggle)
matplotlib 3.10.1%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,340 kB
  • sloc: python: 147,118; cpp: 62,988; objc: 1,679; ansic: 1,426; javascript: 786; makefile: 92; sh: 53
file content (14 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Description: Add check if self.value if iterable in basic_units example
Author: Nilesh Patra <nilesh@debian.org>
Last-Update: 2025-05-31
--- a/galleries/examples/units/basic_units.py
+++ b/galleries/examples/units/basic_units.py
@@ -170,6 +170,8 @@
         # Return a generator expression rather than use `yield`, so that
         # TypeError is raised by iter(self) if appropriate when checking for
         # iterability.
+        if not hasattr(self.value, '__iter__'):
+            raise TypeError(f"Object of type {type(self.value).__name__} is not iterable")
         return (TaggedValue(inner, self.unit) for inner in self.value)
 
     def get_compressed_copy(self, mask):