Skip to content

Conversation

PrettyWood
Copy link
Collaborator

@PrettyWood PrettyWood commented Aug 4, 2025

Change Summary

Allow TzInfo() to be instantiated without arguments, defaulting to UTC (0 seconds offset). This provides convenience for creating UTC timezones and satisfies the Python datetime documentation requirement for tzinfo subclasses to support no-argument construction.

ℹ pickle already worked via pyo3 automatic __reduce__() implementation, but this improves API usability and ensures full compliance with datetime.tzinfo requirements.

Related issue number

fix #1745

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @davidhewitt

Allow TzInfo() to be instantiated without arguments, defaulting to UTC (0 seconds offset).
This provides convenience for creating UTC timezones and satisfies the Python datetime
documentation requirement for tzinfo subclasses to support no-argument construction.

fix #1745
@PrettyWood
Copy link
Collaborator Author

please review

Copy link

codspeed-hq bot commented Aug 4, 2025

CodSpeed Performance Report

Merging #1777 will not alter performance

Comparing tzinfo-no-arg (6888921) with main (1b3815c)

Summary

✅ 159 untouched benchmarks

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@davidhewitt davidhewitt merged commit 68a1e7b into main Aug 4, 2025
30 checks passed
@davidhewitt davidhewitt deleted the tzinfo-no-arg branch August 4, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TzInfo should be instantiable without any arguments

2 participants