Skip to content

Conversation

@LoSealL
Copy link

@LoSealL LoSealL commented Aug 11, 2025

Config file imports builtin module such as os, sys should be supported:

import os
import sys

d = dict(os=os.name, threads=os.cpu_count())
if sys.platform == "win32":
    d.update(is_windows=True)

However, Config object contains non-lazy module can not be pickled or copied.
We fix this issue by filtering out builtin modules, since no one wants to access os or sys through Config.

Config file imports builtin module such as `os`, `sys`
should be supported:
```python
import os
import sys

d = dict(os=os.name, threads=os.cpu_count())
if sys.platform == "win32":
    d.update(is_windows=True)
```

However, Config object contains non-lazy module can not
be pickled or copied.
We fix this issue by filtering out builtin modules, since
no one wants to access `os` or `sys` through Config.
Copilot AI review requested due to automatic review settings August 11, 2025 06:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a pickle error that occurs when config files import builtin modules like os and sys. The issue was that Config objects containing non-lazy builtin modules could not be pickled or copied.

  • Added filtering logic to exclude builtin modules from Config objects during parsing
  • Incremented version number to 0.10.11
  • Added comprehensive test coverage for the fix

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
mme/config/config.py Added module filtering in _parse_lazy_import to skip builtin modules
tests/test_config/test_import_builtin.py New test file validating builtin module handling and pickle compatibility
tests/data/config/lazy_module_config/test_mix_builtin.py Test config file importing builtin modules
mme/init.py Version bump from 0.10.10 to 0.10.11

@LoSealL LoSealL merged commit 7592bce into main Aug 11, 2025
9 checks passed
@LoSealL LoSealL deleted the dev branch August 11, 2025 06:48
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.

2 participants