[PR #22] fix: replace deprecated load_module() with exec_module() #16

Open
opened 2026-10-26 21:06:40 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepSeek-Prover-V1.5/pull/22
Author: @yurekami
Created: 12/25/2025
Status: 🔄 Open

Base: main ← Head: fix-deprecated-load-module


📝 Commits (1)

  • da2a54b fix: replace deprecated load_module() with exec_module()

📊 Changes

1 file changed (+5 additions, -1 deletions)

View changed files

📝 prover/utils.py (+5 -1)

📄 Description

Summary

Replace the deprecated load_module() method with the modern exec_module() approach in prover/utils.py.

Problem

The load_module() method from importlib.machinery.SourceFileLoader has been deprecated since Python 3.4 and shows a DeprecationWarning:

DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead

This warning appears when loading config files and will become an error in future Python versions.

Solution

Updated the load_config() function to use the recommended exec_module() pattern:

# Before (deprecated)
mod = SourceFileLoader(name, fname).load_module()

# After (modern approach)
loader = SourceFileLoader(name, fname)
spec = importlib.util.spec_from_loader(name, loader, origin=fname)
mod = importlib.util.module_from_spec(spec)
loader.exec_module(mod)

Test plan

  • Verify Python syntax with python3 -m py_compile
  • Test config loading functionality

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepSeek-Prover-V1.5/pull/22 **Author:** [@yurekami](https://github.com/yurekami) **Created:** 12/25/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-deprecated-load-module` --- ### 📝 Commits (1) - [`da2a54b`](https://github.com/deepseek-ai/DeepSeek-Prover-V1.5/commit/da2a54b47f264119cb46c097b6d0f41bd0a675ae) fix: replace deprecated load_module() with exec_module() ### 📊 Changes **1 file changed** (+5 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `prover/utils.py` (+5 -1) </details> ### 📄 Description ## Summary Replace the deprecated `load_module()` method with the modern `exec_module()` approach in `prover/utils.py`. ## Problem The `load_module()` method from `importlib.machinery.SourceFileLoader` has been deprecated since Python 3.4 and shows a `DeprecationWarning`: ``` DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead ``` This warning appears when loading config files and will become an error in future Python versions. ## Solution Updated the `load_config()` function to use the recommended `exec_module()` pattern: ```python # Before (deprecated) mod = SourceFileLoader(name, fname).load_module() # After (modern approach) loader = SourceFileLoader(name, fname) spec = importlib.util.spec_from_loader(name, loader, origin=fname) mod = importlib.util.module_from_spec(spec) loader.exec_module(mod) ``` ## Test plan - [x] Verify Python syntax with `python3 -m py_compile` - [ ] Test config loading functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-Prover-V1.5#16
No description provided.