-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
_PyStaticUnicode_Dealloc should not exist. #96458
Comments
Seems this was introduced in gh-32032. Maybe @kumaraditya303 understands why it is needed or how it could be avoided? It's only use seems to be |
"Dealloc" in the name is certainly misleading. "Fini" would be more appropriate (and follow convention). As to the function being unnecessary, it looks like you are right.
|
So is your proposal to just add the Re: safeguard, I'm not sure why we'd need that, given that this is all generated code. Nobody in their right mind statically initializes unicode objects (the deepfreeze.py script has no mind :-). |
I'm agreeing with Mark that we can eliminate
Yeah, keeping a safeguard doesn't seem that important. I'll strike that part of my earlier comment to reduce the noise. |
How? Just delete the function and its calls? There was a reason it was put in (see #91240), related to leak detection tools. |
tl;dr There are a couple changes to consider here:
When I tried building main on Windows with the This implies a number of possibilities:
I'm confident it is (1a). We are currently freezing 6 non-ascii strings. (Look for Thus we should be okay to drop |
As long as |
1a sounds good. Let’s delete this function. Who will make the PR? |
1a will leak memory. I have tried it on Linux. #96481 fixes this by statically initalizing utf8 representation. |
How are you checking? I did the following (after commenting out the
+1 |
Since |
Static data doesn't need to be freed. In fact, in cannot be freed.
It appears that the
utf
field is dynamically allocated on static strings. Since this field is only needed for non-ascii strings, it should be static as well.Then
_PyStaticUnicode_Dealloc
can be deleted.The text was updated successfully, but these errors were encountered: