Commit bdec157
Fix profiler on cpython-3.13 (pytorch#154037)
Fix profiler on cpython-3.13 (pytorch#153848)
Per [PEP 667](https://peps.python.org/pep-0667/) `PyFrame_GetLocals` no longer returns dict, but rather instance of `PyFrameLocalsProxy_Type`, so calling `PyDict_GetItemString` is no longer valid(it will always return None) and must be replaced with `PyMapping_GetItemString`
Tested by partially reverting pytorch#141674 full revert will be done in the followup PR
Fixes pytorch#148273
Pull Request resolved: pytorch#153848
Approved by: https://github.com/Skylion007
(cherry picked from commit c0343b1)
Co-authored-by: Nikita Shulga <[email protected]>1 parent a159920 commit bdec157
File tree
2 files changed
+11
-2
lines changed- test/profiler
- torch/csrc/autograd
2 files changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | 229 | | |
231 | 230 | | |
232 | 231 | | |
| |||
2308 | 2307 | | |
2309 | 2308 | | |
2310 | 2309 | | |
2311 | | - | |
2312 | 2310 | | |
2313 | 2311 | | |
2314 | 2312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
862 | 862 | | |
863 | 863 | | |
864 | 864 | | |
| 865 | + | |
| 866 | + | |
865 | 867 | | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
866 | 873 | | |
867 | 874 | | |
868 | 875 | | |
869 | 876 | | |
870 | 877 | | |
871 | 878 | | |
872 | 879 | | |
| 880 | + | |
873 | 881 | | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
874 | 885 | | |
875 | 886 | | |
876 | 887 | | |
| |||
0 commit comments