Commit 292eb32
CLN: Remove None check in attrs property lookup (#54364)
`self._attrs` is always initialized to an empty dict per
https://github.com/pandas-dev/pandas/blob/c93e8034a13d3dbe2358b1b2f868a0d54d1034a7/pandas/core/generic.py#L275
The attribute `_attrs` is only witten to in two other places
a) in the attrs.setter property (which enforces dict as well)
b) in __setstate__, which takes whatever the state is:
https://github.com/pandas-dev/pandas/blob/c93e8034a13d3dbe2358b1b2f868a0d54d1034a7/pandas/core/generic.py#L2129C24-L2129C24
AFAICS (including code history) I do not see a reason that this could be None.
But if we want to be very defensive, we should do the dict enforcing here.
Co-authored-by: Tim Hoffmann <tim.hoffmann@zeiss.com>1 parent fb6f704 commit 292eb32
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
385 | | - | |
386 | 384 | | |
387 | 385 | | |
388 | 386 | | |
| |||
2126 | 2124 | | |
2127 | 2125 | | |
2128 | 2126 | | |
| 2127 | + | |
| 2128 | + | |
2129 | 2129 | | |
2130 | 2130 | | |
2131 | 2131 | | |
| |||
0 commit comments