Skip to content

Commit eee54dc

Browse files
committed
Refactor Mojo loading in vectoradd_v2 to use the current file's directory instead of a temporary directory
1 parent b9167f3 commit eee54dc

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎problems/pmpp_v2/vectoradd_py/solutions/correct/submission_mojo.py‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!POPCORN leaderboard vectoradd_v2
22
import importlib
3-
import sys
4-
import tempfile
53
from pathlib import Path
64

75
import mojo.importer # noqa: F401
@@ -93,9 +91,7 @@ def PyInit_mojo_vecadd_v2() abi("C") -> PythonObject:
9391
abort(t"Failed to initialize mojo_vecadd_v2: {e}")
9492
"""
9593

96-
_pkg = Path(tempfile.mkdtemp(prefix="mojo_vecadd_v2_"))
97-
(_pkg / "mojo_vecadd_v2.mojo").write_text(MOJO_SOURCE)
98-
sys.path.insert(0, str(_pkg))
94+
(Path(__file__).resolve().parent / "mojo_vecadd_v2.mojo").write_text(MOJO_SOURCE)
9995
mojo_vecadd_v2 = importlib.import_module("mojo_vecadd_v2")
10096

10197
_LAUNCH = mojo_vecadd_v2.Runner().launch

0 commit comments

Comments
 (0)