Close history database during shell shutdown by karinakbataeva · Pull Request #15273 · ipython/ipython · GitHub
Skip to content

Close history database during shell shutdown#15273

Open
karinakbataeva wants to merge 1 commit into
ipython:mainfrom
karinakbataeva:fix-14985-history-cleanup
Open

Close history database during shell shutdown#15273
karinakbataeva wants to merge 1 commit into
ipython:mainfrom
karinakbataeva:fix-14985-history-cleanup

Conversation

@karinakbataeva

@karinakbataeva karinakbataeva commented Jun 26, 2026

Copy link
Copy Markdown

Fixes #14985.

When IPython is started via start_ipython() inside an existing Python interpreter on Windows, the temporary history SQLite database may remain open during shutdown. Since Windows does not allow deletion of open files, cleanup of temporary history files can fail with:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process

This change explicitly stops the history-saving thread (if present) and closes the history database during _atexit_once() before temporary files are removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PermissionError during atexit of IPython on Windows 11

2 participants