Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/pydantic_core/_pydantic_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,9 @@ def list_all_errors() -> list[ErrorTypeInfo]:
"""
@final
class TzInfo(datetime.tzinfo):
"""An `pydantic-core` implementation of the abstract [`datetime.tzinfo`] class."""
"""An `pydantic-core` implementation of the abstract [`datetime.tzinfo`][] class."""

# def __new__(cls, seconds: float) -> Self: ...

# Docstrings for attributes sourced from the abstract base class, [`datetime.tzinfo`](https://docs.python.org/3/library/datetime.html#datetime.tzinfo).

Expand Down
1 change: 1 addition & 0 deletions src/input/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ pub struct TzInfo {
#[pymethods]
impl TzInfo {
#[new]
#[pyo3(signature = (seconds))]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be autogenerated, does the subtest still pass if you remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

>>> TzInfo.__new__.__text_signature__
'($type, *args, **kwargs)'

Seems like pyo3 doesn't handle __new__ signatures correctly?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that'll be PyO3/pyo3#4326

fn py_new(seconds: f32) -> PyResult<Self> {
Self::try_from(seconds.trunc() as i32)
}
Expand Down