Skip to content

gh-135273: Unify ZoneInfo.from_file signatures #135274

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

Merged

Conversation

hrimov
Copy link
Contributor

@hrimov hrimov commented Jun 8, 2025

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

Technically, this is a positional-only argument, so the name of it shouldn't actually matter. But I think we might as well be consistent, especially if this is causing problems in typeshed.

@picnixz
Copy link
Member

picnixz commented Jun 13, 2025

Can you also update the docs: https://docs.python.org/3/library/zoneinfo.html#zoneinfo.ZoneInfo.from_file? fobj is not necessarily better than file_obj (at least there is no ambiguity with f being for file)

@hrimov
Copy link
Contributor Author

hrimov commented Jun 13, 2025

I agree that there's no inherent advantage of file_obj over fobj and vice versa in terms of clarity - both are unambiguous. The change is primarily motivated by the need for signature unification, nothing more.

I've updated the docs, thanks!

@picnixz picnixz enabled auto-merge (squash) June 19, 2025 11:02
@picnixz picnixz disabled auto-merge June 19, 2025 11:03
@picnixz
Copy link
Member

picnixz commented Jun 19, 2025

Actually, I'm thinking about something: wouldn't it be easier if we were to use fobj in C and revert the typeshed stuff? We can use fobj as file_obj in C so that we minimize the C changes as well.

@hrimov
Copy link
Contributor Author

hrimov commented Jun 19, 2025

Sure, as I mentioned in the typeshed PR - the desynchronization came only because C implementation was different (just not specified alias).

Re would it be easier or not - we will just need to update the typeshed stubs for it, depending whether we gonna backport it or not.

So if you think it will be better - I can update this PR with these changes, If you don't mind.

@picnixz
Copy link
Member

picnixz commented Jun 19, 2025

file_obj would be more explicit, but fobj would take less work. But actually, now that I think about, if the change has been made in 3.12, we won't be able to backport it, so let's continue with file_obj for the rest of Python.

@picnixz picnixz merged commit 7cc8949 into python:main Jun 19, 2025
40 checks passed
@picnixz picnixz added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jun 19, 2025
@miss-islington-app
Copy link

Thanks @hrimov for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @hrimov for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 19, 2025
Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
(cherry picked from commit 7cc8949)

Co-authored-by: Andrii Hrimov <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 19, 2025

GH-135715 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 19, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 19, 2025
Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
(cherry picked from commit 7cc8949)

Co-authored-by: Andrii Hrimov <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 19, 2025

GH-135716 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 19, 2025
@hrimov hrimov deleted the fix/zoneinfo-from-file-python-fallback-signature branch June 19, 2025 14:58
picnixz pushed a commit that referenced this pull request Jun 19, 2025
…135715)

gh-135273: Unify `ZoneInfo.from_file` signatures (GH-135274)

Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
(cherry picked from commit 7cc8949)

Co-authored-by: Andrii Hrimov <[email protected]>
picnixz pushed a commit that referenced this pull request Jun 19, 2025
…135716)

gh-135273: Unify `ZoneInfo.from_file` signatures (GH-135274)

Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
(cherry picked from commit 7cc8949)

Co-authored-by: Andrii Hrimov <[email protected]>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Fedora Stable Clang 3.x (tier-2) has failed when building commit 7cc8949.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/234/builds/7857) and take a look at the build logs.
  4. Check if the failure is related to this commit (7cc8949) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/234/builds/7857

Failed tests:

  • test_perf_profiler

Failed subtests:

  • test_python_calls_appear_in_the_stack_if_perf_activated - test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/test_perf_profiler.py", line 373, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertEqual(stderr, "")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
AssertionError: 'Warning:\nProcessed 431 events and lost 3[34 chars]\n\n' != ''
- Warning:
- Processed 431 events and lost 3 chunks!
- 
- Check IO/CPU overload!
- 


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/test_perf_profiler.py", line 373, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertEqual(stderr, "")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
AssertionError: 'Warning:\nProcessed 457 events and lost 1[34 chars]\n\n' != ''
- Warning:
- Processed 457 events and lost 1 chunks!
- 
- Check IO/CPU overload!
- 

lkollar pushed a commit to lkollar/cpython that referenced this pull request Jun 19, 2025
Align `ZoneInfo.from_file` pure-Python signature with Argument Clinic signature.
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.

4 participants