Skip to content

Conversation

@Viicos
Copy link
Member

@Viicos Viicos commented Jan 28, 2025

Change Summary

Fixes #1605

Related issue number

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

@Viicos
Copy link
Member Author

Viicos commented Jan 28, 2025

Hum, stubtest works even though I commented out the stub __new__ and added the pyo3 signature 🤔

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 28, 2025

CodSpeed Performance Report

Merging #1611 will not alter performance

Comparing tz-info-new (86e8421) with main (1defe62)

Summary

✅ 157 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 with one possible simplification!

#[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

@davidhewitt
Copy link
Contributor

Oh stubtest doesn't catch this? Hmm I wonder if it doesn't check __new__ just __init__. PyO3 really needs to improve things here 🤔

@Viicos Viicos enabled auto-merge (squash) March 14, 2025 15:38
@Viicos Viicos merged commit f3fa016 into main Mar 14, 2025
27 checks passed
@Viicos Viicos deleted the tz-info-new branch March 14, 2025 15:43
davidhewitt pushed a commit to pydantic/pydantic that referenced this pull request Oct 20, 2025
davidhewitt pushed a commit to pydantic/pydantic that referenced this pull request Oct 22, 2025
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.

Wrong type annotation for pydantic_core.TzInfo(0)

3 participants