Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TzInfo.__new__ stub method #1611

Merged
merged 2 commits into from
Mar 14, 2025
Merged

Add TzInfo.__new__ stub method #1611

merged 2 commits into from
Mar 14, 2025

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

Sorry, something went wrong.

@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 🤔

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!

@@ -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

@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
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)
2 participants