Skip to content

Ensure interned strings can not be referenced after InternString.Shutdown #1394

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/runtime/intern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ public static void Initialize()

public static void Shutdown()
{
foreach (var ptr in _intern2strings.Keys)
foreach (var entry in _intern2strings)
{
Runtime.XDecref(ptr);
Runtime.XDecref(entry.Key);
typeof(PyIdentifier).GetField(entry.Value).SetValue(null, IntPtr.Zero);
}
_string2interns = null;
_intern2strings = null;
Expand Down