|
|
|
|
|
by oefrha
2214 days ago
|
|
Of course not, that would mean env vars are hard-coded into byte code at compile time, which would be completely crazy. A pyc file is just a parsed series of op codes that the interpreter could dispatch directly, so that it doesn't have to parse source files every single time. It's very easy to verify: secrets.py: import os
SECRET = os.getenv('SECRET')
Then $ python -m compileall secrets.py
$ uncompyle6 __pycache__/secrets.cpython-38.pyc
# uncompyle6 version 3.7.0
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.8.2 (default, Mar 10 2020, 12:58:02)
# [Clang 11.0.0 (clang-1100.0.33.17)]
# Embedded file name: secrets.py
# Compiled at: ...
# Size of source mod 2**32: 40 bytes
import os
SECRET = os.getenv('SECRET')
# okay decompiling __pycache__/secrets.cpython-38.pyc
|
|