Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-113993: Allow interned strings to be mortal, and fix related issues#120520

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 79 commits intopython:mainfromencukou:immortal-interned
Jun 21, 2024
Merged
Changes from1 commit
Commits
Show all changes
79 commits
Select commitHold shift + click to select a range
2b74021
Declare explicit interning routines
encukouJun 10, 2024
0aedb83
Use _PyUnicode_InternStatic for the statically allocated stuff
encukouJun 10, 2024
aad79b2
Add _PyUnicode_InternStatic and extra checks
encukouJun 10, 2024
5413223
Check against immortalizing un-interned strings
encukouJun 10, 2024
23845fb
Add _PyUnicode_InternImmortal & make `marshal` use it
encukouJun 10, 2024
9ece220
Remove special case that makes previously-immortal strings STATIC
encukouJun 10, 2024
7c62641
Split _PyUnicode_InternMortal and _PyUnicode_InternImmortal
encukouJun 10, 2024
62a35a1
Do the refcnt dance in _PyUnicode_InternMortal & _PyUnicode_ClearInte…
encukouJun 10, 2024
ac55a05
Deallocate mortal interned strings
encukouJun 10, 2024
2466ae9
Use _PyUnicode_InternMortal in codecs
encukouJun 10, 2024
032ac17
Start a notes document
encukouJun 10, 2024
198d9c6
Handle attempts to "overwrite" interned heap types by static ones
encukouJun 10, 2024
86ccb08
Intern statically allocated non-identifier strings at init
encukouJun 11, 2024
e34b8da
Parenthesize the LATIN1 macro argument
encukouJun 11, 2024
66338fe
Don't create the per-interp interned_dict until after InitStaticStrings
encukouJun 11, 2024
9f16cb0
Move hashmap destroy to _PyUnicode_ClearInterned (symmetry with creat…
encukouJun 14, 2024
e27abfc
Special-case short string singletons
encukouJun 11, 2024
89f24df
Verify we don't add process-global entries after a per-interp dict ex…
encukouJun 11, 2024
b965acf
More editing of the InternalDocs write-up
encukouJun 11, 2024
4b69712
Only readjust refleak tests for *immortal* interned strings
encukouJun 12, 2024
b2c9865
Be pedantic with the ref total
encukouJun 12, 2024
cf7cb72
Split InternInPlace in sysmodule
encukouJun 12, 2024
85f9fe0
Split InternInPlace in import
encukouJun 12, 2024
a288389
Split InternInPlace in getargs
encukouJun 12, 2024
6036cb1
Use mortal strings in type_setattro
encukouJun 12, 2024
01f2dbf
Use mortal string in type_module
encukouJun 12, 2024
73f7fb3
Use mortal strings for object attributes
encukouJun 12, 2024
13be4e7
Use mortal strings for code object names
encukouJun 12, 2024
1930919
Use mortal strings for code constants
encukouJun 12, 2024
d45f20b
Use mortals in pickle
encukouJun 12, 2024
348d95c
Use mortals for PyDict_SetItemString keys
encukouJun 12, 2024
04f080e
Use mortals in operator: methodcaller_new
encukouJun 12, 2024
afe5400
Use mortals in operator: attrgetter_new
encukouJun 12, 2024
fe0b8c5
Simplify logic in _PyUnicode_InternImmortal
encukouJun 12, 2024
1116191
Immortalize ill interned strings in the free-threaded build
encukouJun 12, 2024
f10e521
Rewrite the write-up
encukouJun 12, 2024
0787f8f
Restore immortalization for PyDict_SetItemString.
encukouJun 12, 2024
0d56eba
Intern single-byte (latin1) strings at startup in free-threaded build
encukouJun 12, 2024
8b32762
Make the three sets of singletons disjoint
encukouJun 12, 2024
24bf76a
One more single-char string in _Py_STR
encukouJun 13, 2024
2fb04fd
Use a less unwieldy name
encukouJun 14, 2024
26fa26e
Adjust comments & writeup
encukouJun 14, 2024
9b14dbb
Don't call _Py_SetImmortal on strings.
encukouJun 14, 2024
ac6dfae
Beef up the tests
encukouJun 14, 2024
a9e91b1
Fix comment
encukouJun 14, 2024
ee0f068
A bit more thought-through error handling for failed PyDict_Pop
encukouJun 14, 2024
61bf404
Switch parser to PyUnicode_InternImmortal
encukouJun 14, 2024
80ce95b
Touch up comments
encukouJun 14, 2024
70aa294
Switch public PyUnicode API to _PyUnicode_InternImmortal
encukouJun 14, 2024
de2ff7f
Add an assert to _PyUnicode_EqualToASCIIId
encukouJun 14, 2024
0e6744e
Remove #ifdef Py_DEBUG from the body of _PyUnicode_ClearInterned.
encukouJun 14, 2024
c50e151
Consolidate the interning logic
encukouJun 14, 2024
08798d0
Fix the free-threading initialization
encukouJun 14, 2024
62959cd
Typo in comments
encukouJun 14, 2024
f62ccc6
Add blurb
encukouJun 14, 2024
86cf124
Guard call to debug function
encukouJun 14, 2024
f2e857e
Avoid -bb warnings in tests
encukouJun 14, 2024
6011c05
Add typing to a clinic function
encukouJun 14, 2024
7e8d727
Work around build failure on macOS clang
encukouJun 14, 2024
ccb7f42
Silence a mypy error
encukouJun 17, 2024
e0bb1c2
_PyCodec_Lookup: Immortalize key on success
encukouJun 17, 2024
975e4ba
getargs.c: Immortalize the kwtuple keys
encukouJun 17, 2024
1c05a60
Don't re-mortalize interned immortals at interpreter shutdown (in non…
encukouJun 17, 2024
5ac3c5f
Avoid `case` label on a declaration (invalid in standard C and, fortu…
encukouJun 17, 2024
686d2b6
Merge in the main branch
encukouJun 18, 2024
7d79d10
Remove PyUnicode_InternImmortal from the header
encukouJun 19, 2024
d4eb879
Move _Py_LATIN1_CHR to pycore_global_strings.h
encukouJun 19, 2024
f7df09a
Remove mistaken check in _pickle.c
encukouJun 19, 2024
fe7fb13
Comment/doc clarifications, rewordings; PEP-7 style
encukouJun 19, 2024
7a75099
Add a pedantic DECREF
encukouJun 19, 2024
ac402d8
Use more straightforward signatures for the internal functions
encukouJun 19, 2024
aa58c01
Group _PyUnicode_Intern funcs in the header
encukouJun 19, 2024
929d0bc
Break out init_global_interned_strings & clear_global_interned_strings
encukouJun 19, 2024
44c0192
Merge in the main branch
encukouJun 19, 2024
9e3ce44
Fix function declaration
encukouJun 20, 2024
2ebf8a0
Fix return value
encukouJun 20, 2024
bf49f61
Convert check to assert
encukouJun 20, 2024
6d668e6
Limit _PyUnicode_InternStatic to runtime initialization
encukouJun 20, 2024
fd8ca83
Add a comment for _Py_hashtable_new_full destroys
encukouJun 20, 2024
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
PrevPrevious commit
NextNext commit
Use _PyUnicode_InternMortal in codecs
  • Loading branch information
@encukou
encukou committedJun 14, 2024
commit2466ae926259e8ecf88a9f1b9baa0da44f66ddda
7 changes: 6 additions & 1 deletionPython/codecs.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -147,7 +147,12 @@ PyObject *_PyCodec_Lookup(const char *encoding)
if (v == NULL) {
return NULL;
}
PyUnicode_InternInPlace(&v);

/* Intern the string.
A successful lookup will insert `v` in the codecs search cache,
effectively immortalizing it. We don't want to immortalize the key
when lookup fails. */
_PyUnicode_InternMortal(interp, &v);

/* First, try to lookup the name in the registry dictionary */
PyObject *result;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp