Skip to content

Handle out-of-range timestamps in _format_data#343

Open
SAY-5 wants to merge 1 commit into
dpguthrie:masterfrom
SAY-5:fix-format-data-out-of-range-timestamp
Open

Handle out-of-range timestamps in _format_data#343
SAY-5 wants to merge 1 commit into
dpguthrie:masterfrom
SAY-5:fix-format-data-out-of-range-timestamp

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 18, 2026

Copy link
Copy Markdown

Fixes #342. Some Yahoo responses (e.g. Ticker("CONCORD.BO").asset_profile) return epoch values whose year is past datetime.MAXYEAR, and datetime.fromtimestamp raises ValueError for those. The existing guard in _format_data only caught TypeError/OSError, so the call propagated and crashed instead of falling back to the raw value. Added ValueError to that except clause and a small test covering both the out-of-range and the normal case.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValueError: year is out of range

1 participant