exaloop / codon

A high-performance, zero-overhead, extensible Python compiler using LLVM
https://docs.exaloop.io/codon
Other
15.14k stars 520 forks source link

`os.environ.setdefault` does not work #583

Closed Real-Gecko closed 2 days ago

Real-Gecko commented 2 months ago

Creating test file

# test.py
import os

os.environ.setdefault("lala", "tralala")

Running with codon

$ codon run test.py
test.py:3:1-41: error: 'EnvMap' object has no attribute 'setdefault'
$ codon build -release -exe test.py
test.py:3:1-41: error: 'EnvMap' object has no attribute 'setdefault'
avitkauskas commented 2 months ago

Codon has very limited native os module implementation yet. I sent a PR to implement this particular functionality.

Meanwhile, you can use python module:

from python import os

os.environ.setdefault("lala", "tralala")
inumanag commented 1 month ago

Hi @Real-Gecko ,

Yes, @avitkauskas is right---our os.environ implementation is pretty bare-bones at the moment. I'd also second using from python import for now.

inumanag commented 2 days ago

Merging into #608 .