Commit 4e9624f
committed
fix: raise ValueError for an out-of-range epoch in to_datetime
to_datetime parses number-like values as millisecond epochs via
datetime.fromtimestamp(epoch / 1000). A non-finite value ('inf', '-inf') or one
large enough to be out of range (1e30, a huge millis integer) passes float()
but overflows fromtimestamp, leaking OverflowError or OSError. The function
documents ValueError as its failure mode (and to_timestamp / to_date wrap it),
so catch those and fall through to the existing ValueError.1 parent ad2d113 commit 4e9624f
2 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
44 | 55 | | |
45 | 56 | | |
46 | 57 | | |
| |||
0 commit comments