Skip to content

gh-92356: Fix regression in ctypes function call overhead #92357

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
merged 1 commit into from
May 6, 2022

Conversation

mdboom
Copy link
Contributor

@mdboom mdboom commented May 5, 2022

38f331d introduced a delayed initialization routine to set up
ctypes formattable (_ctypes_init_fielddesc), but inadvertently
removed setting the initialization flag to 1 to avoid initting
each time.

Cc: @tiran

#92356

@ghost
Copy link

ghost commented May 5, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Every change to Python requires a NEWS entry.

Please, add it using the blurb_it Web app or the blurb command-line tool.

38f331d introduced a delayed initialization routine to set up
ctypes formattable (`_ctypes_init_fielddesc`), but inadvertently
removed setting the `initialization` flag to 1 to avoid initting
each time.
@mdboom mdboom force-pushed the fix-ctypes_init_fielddesc branch from 27b4aeb to 9486b1e Compare May 5, 2022 23:25
@brandtbucher
Copy link
Member

Nice find!

@AlexWaygood AlexWaygood added topic-ctypes type-bug An unexpected behavior, bug, or error performance Performance or resource usage labels May 5, 2022
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Good catch!

I wonder if this initialization will give us thread safety problems for subinterpreters and/or nogil. Seems like it would have data races.

@JelleZijlstra JelleZijlstra merged commit adcb6a6 into python:main May 6, 2022
@tiran
Copy link
Member

tiran commented May 6, 2022

Thanks, Mike!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage topic-ctypes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants