feat: integrate JSON module for sys overrides

Prepares for built-in module overrides by explicitly importing the `json` module within the `prepare_builtin_overrides` function. This approach ensures that any modifications or custom logic applied to the system's version of JSON does not unintentionally conflict with the original module's functionality. The aliasing of the original JSON module under a new name allows for safe manipulation and extension of JSON handling capabilities without affecting the global namespace or existing dependencies that rely on the unmodified JSON module.

This strategic import and module aliasing facilitate future enhancements and potentially complex custom behaviors, ensuring that extensions or modifications are both isolated and reversible, safeguarding the integrity of the application's core functionalities.
This commit is contained in:
Kumi 2024-05-23 12:51:54 +02:00
parent fa8e744300
commit 5a69bb0c91
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -34,6 +34,7 @@ def parse_german_code(german_code):
def prepare_builtin_overrides():
import sys
import json # noqa: F401
original_json = sys.modules["json"]
sys.modules["sysjson"] = original_json