Commit 07bd182
pythongh-139103: Use borrowed references for positional args in _PyStack_UnpackDict (pythongh-144407)
The positional arguments passed to _PyStack_UnpackDict are already
kept alive by the caller, so we can avoid the extra reference count
operations by using borrowed references instead of creating new ones.
This reduces reference count contention in the free-threaded build
when calling functions with keyword arguments. In particular, this
avoids contention on the type argument to `__new__` when instantiating
namedtuples with keyword arguments.1 parent cb651ae commit 07bd182
2 files changed
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
938 | 942 | | |
939 | 943 | | |
940 | 944 | | |
| |||
970 | 974 | | |
971 | 975 | | |
972 | 976 | | |
973 | | - | |
| 977 | + | |
974 | 978 | | |
975 | | - | |
| 979 | + | |
976 | 980 | | |
977 | 981 | | |
978 | 982 | | |
| |||
1009 | 1013 | | |
1010 | 1014 | | |
1011 | 1015 | | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
1015 | 1020 | | |
1016 | 1021 | | |
1017 | 1022 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2000 | 2000 | | |
2001 | 2001 | | |
2002 | 2002 | | |
2003 | | - | |
| 2003 | + | |
2004 | 2004 | | |
2005 | 2005 | | |
2006 | | - | |
2007 | | - | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
2008 | 2013 | | |
2009 | 2014 | | |
2010 | 2015 | | |
| |||
0 commit comments