Commit 46496f9
authored
The types.FunctionType constructor now inherits the current builtins
if the globals dictionary has no "__builtins__" key, rather than
using {"None": None} as builtins: same behavior as eval() and exec()
functions.
Defining a function with "def function(...): ..." in Python is not
affected, globals cannot be overriden with this syntax: it also
inherits the current builtins.
PyFrame_New(), PyEval_EvalCode(), PyEval_EvalCodeEx(),
PyFunction_New() and PyFunction_NewWithQualName() now inherits the
current builtins namespace if the globals dictionary has no
"__builtins__" key.
* Add _PyEval_GetBuiltins() function.
* _PyEval_BuiltinsFromGlobals() now uses _PyEval_GetBuiltins() if
builtins cannot be found in globals.
* Add tstate parameter to _PyEval_BuiltinsFromGlobals().
1 parent 4233ff3 commit 46496f9
File tree
7 files changed
+74
-31
lines changed- Doc/whatsnew
- Include/internal
- Lib/test
- Misc/NEWS.d/next/Core and Builtins
- Objects
- Python
7 files changed
+74
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
| 286 | + | |
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
| |||
789 | 790 | | |
790 | 791 | | |
791 | 792 | | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
792 | 801 | | |
793 | 802 | | |
794 | 803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
81 | 108 | | |
82 | 109 | | |
83 | 110 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
850 | | - | |
| 850 | + | |
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| |||
862 | 862 | | |
863 | 863 | | |
864 | 864 | | |
865 | | - | |
866 | 865 | | |
867 | 866 | | |
868 | 867 | | |
| |||
1163 | 1162 | | |
1164 | 1163 | | |
1165 | 1164 | | |
1166 | | - | |
| 1165 | + | |
1167 | 1166 | | |
1168 | 1167 | | |
1169 | 1168 | | |
1170 | 1169 | | |
1171 | 1170 | | |
1172 | 1171 | | |
1173 | 1172 | | |
1174 | | - | |
| 1173 | + | |
1175 | 1174 | | |
1176 | | - | |
1177 | 1175 | | |
1178 | 1176 | | |
1179 | 1177 | | |
1180 | 1178 | | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
| 1179 | + | |
1191 | 1180 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
50 | | - | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
| 892 | + | |
892 | 893 | | |
893 | 894 | | |
894 | 895 | | |
895 | | - | |
| 896 | + | |
896 | 897 | | |
897 | 898 | | |
898 | 899 | | |
| |||
906 | 907 | | |
907 | 908 | | |
908 | 909 | | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
| 910 | + | |
913 | 911 | | |
914 | 912 | | |
915 | 913 | | |
| |||
4733 | 4731 | | |
4734 | 4732 | | |
4735 | 4733 | | |
| 4734 | + | |
4736 | 4735 | | |
4737 | 4736 | | |
4738 | 4737 | | |
4739 | 4738 | | |
4740 | 4739 | | |
4741 | | - | |
| 4740 | + | |
4742 | 4741 | | |
4743 | 4742 | | |
4744 | 4743 | | |
| |||
4797 | 4796 | | |
4798 | 4797 | | |
4799 | 4798 | | |
4800 | | - | |
4801 | 4799 | | |
4802 | 4800 | | |
4803 | 4801 | | |
| |||
5315 | 5313 | | |
5316 | 5314 | | |
5317 | 5315 | | |
| 5316 | + | |
| 5317 | + | |
| 5318 | + | |
| 5319 | + | |
| 5320 | + | |
| 5321 | + | |
| 5322 | + | |
| 5323 | + | |
| 5324 | + | |
| 5325 | + | |
5318 | 5326 | | |
5319 | 5327 | | |
5320 | 5328 | | |
5321 | 5329 | | |
5322 | | - | |
5323 | | - | |
5324 | | - | |
5325 | | - | |
5326 | | - | |
| 5330 | + | |
5327 | 5331 | | |
5328 | 5332 | | |
5329 | 5333 | | |
| |||
0 commit comments