Hello, I am using `emacs-28.2` and after updating my packages today, I have been experiencing this issue. I am not able to pinpoint the culprit package here.
EDIT: `emacs -Q` will give you the same result.
EDIT 2: This does NOT persist in `emacs-28.1` tag and `master` branch. Only persists in `emacs-28.2` tag and `emacs-28` branch.
### Steps to reproduce
1. Upgrade packages
2. restart-emacs
3. M-x `toggle-debug-on-error`
4. M-x `toggle-debug-on-quit`
5. M-x `profiler-start`
6. M-x `pyvenv-workon` (only if you have it)
7. Open a python file in a directory
8. Emacs freezes
9. Open terminal and run `pkill -SIGUSR2 emacs`
10. you will see stack-trace in emacs, `profiler-stop` and `profiler-report` will give you results like below
# error
Debugger entered--entering a function:
* #f(compiled-function () #<bytecode 0x8a317955ffa9e7e>)()
syntax-ppss()
python-nav-end-of-statement()
python-nav-end-of-block()
python-info-statement-ends-block-p()
python-nav--forward-sexp(-1 nil nil)
python-nav-forward-sexp(-1 nil nil)
python-nav-backward-sexp()
python-info-docstring-p((0 nil 690 34 nil nil 0 nil 699 nil nil))
python-font-lock-syntactic-face-function((0 nil 690 34 nil nil 0 nil 699 nil nil))
font-lock-fontify-syntactically-region(1 1527 nil)
font-lock-default-fontify-region(1 1501 nil)
font-lock-fontify-region(1 1501)
#f(compiled-function (fun) #<bytecode 0x19d0e7baba08cf7d>)(font-lock-fontify-region)
jit-lock--run-functions(1 1501)
jit-lock-fontify-now(1 1501)
jit-lock-function(1)
redisplay_internal\ \(C\ function\)()
# part of profiler report
74,785,659 93% - redisplay_internal (C function)
74,515,935 93% - jit-lock-function
74,515,935 93% - jit-lock-fontify-now
74,515,935 93% - jit-lock--run-functions
74,515,935 93% - #<compiled 0x19d0e7baba08cf7d>
74,515,935 93% - font-lock-fontify-region
74,515,935 93% - font-lock-default-fontify-region
74,515,935 93% - font-lock-fontify-syntactically-region
74,514,890 93% - python-font-lock-syntactic-face-function
74,512,026 93% - python-info-docstring-p
74,501,690 93% - python-nav-backward-sexp
74,501,690 93% - python-nav-forward-sexp
74,497,546 93% - python-nav--forward-sexp
74,453,034 93% - python-info-statement-ends-block-p
66,684,154 83% - python-nav-end-of-block
66,678,666 83% - python-nav-end-of-statement
60,299,610 75% - syntax-ppss
44,359,226 55% - #<compiled 0x8a317213f10367e>
44,354,842 55% - debug
34,863,559 43% - recursive-edit
31,921,033 39% - command-execute
31,921,033 39% - apply
31,921,033 39% - ad-Advice-command-execute
31,921,033 39% - #<subr command-execute>
31,920,953 39% - funcall-interactively
24,406,156 30% - dashboard-return
24,406,156 30% - widget-button-press
24,406,156 30% - widget-apply-action
24,406,156 30% - #<lambda -0x10b6ad937a6672fa>
24,406,156 30% - find-file-existing
24,406,156 30% - find-file
24,406,156 30% - apply
24,406,156 30% - ad-Advice-find-file
24,406,156 30% - #<subr find-file>
24,348,820 30% - find-file-noselect
24,348,820 30% - apply
24,348,820 30% - editorconfig--advice-find-file-noselect
24,347,668 30% - apply
24,347,668 30% - #<subr find-file-noselect>
24,338,311 30% - find-file-noselect-1
24,265,479 30% - after-find-file
16,786,860 20% - normal-mode
16,597,805 20% - set-auto-mode
16,597,805 20% - apply
16,597,805 20% - so-long--set-auto-mode
16,529,430 20% - #<subr set-auto-mode>
16,358,501 20% - set-auto-mode--apply-alist
16,229,961 20% - set-auto-mode-0
16,229,521 20% - python-mode
16,188,034 20% - run-mode-hooks
10,854,815 13% - run-hooks
6,530,299 8% - yas-global-mode-enable-in-buffers
6,530,299 8% - yas-minor-mode-on
6,530,299 8% - yas-minor-mode
6,529,377 8% - yas--load-pending-jits
6,529,377 8% - #<compiled -0x1a65afa0cea585ac>
6,529,377 8% - apply
6,529,377 8% - yas--load-directory-1
6,527,329 8% - yas--load-directory-2
4,334,886 5% - insert-file-contents
4,334,886 5% - apply
3,720,566 4% - editorconfig--advice-insert-file-contents
1,549,624 1% - #<subr insert-file-contents>
1,453,368 1% - set-auto-coding
1,453,368 1% - find-auto-coding
505,832 0% - auto-coding-regexp-alist-lookup
505,832 0% - search-forward-regexp
505,832 0% - apply
505,832 0% ad-Advice-search-forward-regexp
114,032 0% - sgml-html-meta-auto-coding-function
112,624 0% - search-forward-regexp
112,624 0% - apply
112,624 0% ad-Advice-search-forward-regexp
1,408 0% - forward-line
1,408 0% - apply
1,408 0% ad-Advice-forward-line