From f303639e3ac96cfe6c1438f1c594226941f46216 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Sun, 15 Apr 2018 16:12:29 -0600 Subject: bpo-33270: Intern names for all anonymous code objects (#6472) --- .../Core and Builtins/2018-04-14-13-12-50.bpo-33270.UmVV6i.rst | 1 + Python/compile.c | 8 ++++---- Python/importlib.h | 2 +- Python/importlib_external.h | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2018-04-14-13-12-50.bpo-33270.UmVV6i.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-04-14-13-12-50.bpo-33270.UmVV6i.rst b/Misc/NEWS.d/next/Core and Builtins/2018-04-14-13-12-50.bpo-33270.UmVV6i.rst new file mode 100644 index 0000000..4dbc4a3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-04-14-13-12-50.bpo-33270.UmVV6i.rst @@ -0,0 +1 @@ +Intern the names for all anonymous code objects. Patch by Zackery Spytz. diff --git a/Python/compile.c b/Python/compile.c index 03b703d..62fe971 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -4145,7 +4145,7 @@ compiler_genexp(struct compiler *c, expr_ty e) { static identifier name; if (!name) { - name = PyUnicode_FromString(""); + name = PyUnicode_InternFromString(""); if (!name) return 0; } @@ -4160,7 +4160,7 @@ compiler_listcomp(struct compiler *c, expr_ty e) { static identifier name; if (!name) { - name = PyUnicode_FromString(""); + name = PyUnicode_InternFromString(""); if (!name) return 0; } @@ -4175,7 +4175,7 @@ compiler_setcomp(struct compiler *c, expr_ty e) { static identifier name; if (!name) { - name = PyUnicode_FromString(""); + name = PyUnicode_InternFromString(""); if (!name) return 0; } @@ -4191,7 +4191,7 @@ compiler_dictcomp(struct compiler *c, expr_ty e) { static identifier name; if (!name) { - name = PyUnicode_FromString(""); + name = PyUnicode_InternFromString(""); if (!name) return 0; } diff --git a/Python/importlib.h b/Python/importlib.h index 032ad45..3120faf 100644 --- a/Python/importlib.h +++ b/Python/importlib.h @@ -561,7 +561,7 @@ const unsigned char _Py_M__importlib[] = { 1,100,0,107,9,86,0,1,0,113,2,100,0,83,0,41, 1,78,114,10,0,0,0,41,2,90,2,46,48,90,3,97, 114,103,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,250,9,60,103,101,110,101,120,112,114,62,65,1,0,0, + 0,218,9,60,103,101,110,101,120,112,114,62,65,1,0,0, 115,2,0,0,0,4,0,122,45,95,105,110,115,116,97,108, 108,101,100,95,115,97,102,101,108,121,46,95,95,101,120,105, 116,95,95,46,60,108,111,99,97,108,115,62,46,60,103,101, diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 930755d..70dfe54 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -132,7 +132,7 @@ const unsigned char _Py_M__importlib_external[] = { 116,114,105,112,218,15,112,97,116,104,95,115,101,112,97,114, 97,116,111,114,115,41,2,218,2,46,48,218,4,112,97,114, 116,114,2,0,0,0,114,2,0,0,0,114,4,0,0,0, - 250,10,60,108,105,115,116,99,111,109,112,62,58,0,0,0, + 218,10,60,108,105,115,116,99,111,109,112,62,58,0,0,0, 115,2,0,0,0,6,1,122,30,95,112,97,116,104,95,106, 111,105,110,46,60,108,111,99,97,108,115,62,46,60,108,105, 115,116,99,111,109,112,62,41,2,218,8,112,97,116,104,95, @@ -1678,7 +1678,7 @@ const unsigned char _Py_M__importlib_external[] = { 2,86,0,1,0,113,2,100,1,83,0,41,2,114,186,0, 0,0,78,114,2,0,0,0,41,2,114,22,0,0,0,218, 6,115,117,102,102,105,120,41,1,218,9,102,105,108,101,95, - 110,97,109,101,114,2,0,0,0,114,4,0,0,0,250,9, + 110,97,109,101,114,2,0,0,0,114,4,0,0,0,218,9, 60,103,101,110,101,120,112,114,62,33,4,0,0,115,2,0, 0,0,4,1,122,49,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,105,115,95,112,97,99, @@ -2350,7 +2350,7 @@ const unsigned char _Py_M__importlib_external[] = { 0,104,0,124,0,93,12,125,1,124,1,160,0,161,0,146, 2,113,4,83,0,114,2,0,0,0,41,1,114,90,0,0, 0,41,2,114,22,0,0,0,90,2,102,110,114,2,0,0, - 0,114,2,0,0,0,114,4,0,0,0,250,9,60,115,101, + 0,114,2,0,0,0,114,4,0,0,0,218,9,60,115,101, 116,99,111,109,112,62,153,5,0,0,115,2,0,0,0,6, 0,122,41,70,105,108,101,70,105,110,100,101,114,46,95,102, 105,108,108,95,99,97,99,104,101,46,60,108,111,99,97,108, -- cgit v0.12