Skip to content

gh-151059: Use PyObject_CallMethodOneArg in datetime call_tzinfo_method#151062

Merged
sobolevn merged 1 commit into
python:mainfrom
eendebakpt:datetime_call_tzinfo_onearg
Jun 8, 2026
Merged

gh-151059: Use PyObject_CallMethodOneArg in datetime call_tzinfo_method#151062
sobolevn merged 1 commit into
python:mainfrom
eendebakpt:datetime_call_tzinfo_onearg

Conversation

@eendebakpt
Copy link
Copy Markdown
Contributor

@eendebakpt eendebakpt commented Jun 7, 2026

See corresponding issue for details.

…o_method

Call tzinfo.utcoffset()/dst() via PyObject_CallMethodOneArg with the
interned &_Py_ID(utcoffset)/&_Py_ID(dst) names instead of
PyObject_CallMethod(name, "O", arg), matching call_tzname() in the same
file. Drops the format-string parse, the temporary tuple, and the
per-call method-name string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eendebakpt eendebakpt changed the title gh-150942: Use PyObject_CallMethodOneArg in datetime call_tzinfo_method gh-151059: Use PyObject_CallMethodOneArg in datetime call_tzinfo_method Jun 7, 2026
Copy link
Copy Markdown
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you! I am wondering if there are other similar cases 🤔

I'll have a look!
No backports, since this is a new perf feature :)

@sobolevn sobolevn merged commit 537702d into python:main Jun 8, 2026
60 checks passed
@StanFromIreland
Copy link
Copy Markdown
Member

I wanted to give Paul a few days in case he wants to comment, but this is a small change so there's not much to discuss ;-)

@eendebakpt
Copy link
Copy Markdown
Contributor Author

Awesome! Thank you! I am wondering if there are other similar cases 🤔

I'll have a look! No backports, since this is a new perf feature :)

Yes, many. But most not with the same obvious performance impact. I can create a mechanical change for them, but it might be rejected as churn.

@sobolevn
Copy link
Copy Markdown
Member

sobolevn commented Jun 8, 2026

Please, provide perf metrics, so we can decide :)

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.

3 participants