[New-bugs-announce] [issue39759] os.getenv documentation is misleading

Rémi Lapeyre report at bugs.python.org
Wed Feb 26 06:44:26 EST 2020


New submission from Rémi Lapeyre <remi.lapeyre at henki.fr>:

The documentation states that "*key*, *default* and the result are str." at https://github.com/python/cpython/blame/3.8/Doc/library/os.rst#L224 but either I'm missing something or it's not actually true:

$ python -c 'import os; print(type(os.getenv("FOO")))'           
<class 'NoneType'>
$ python -c 'import os; print(type(os.getenv("FOO", default=1)))'
<class 'int'>

Only *key* needs to be a string as it is used to lookup the value in os.environ.

I think this can be fixed by a new contributor

----------
assignee: docs at python
components: Documentation
messages: 362689
nosy: docs at python, remi.lapeyre
priority: normal
severity: normal
status: open
title: os.getenv documentation is misleading
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39759>
_______________________________________


More information about the New-bugs-announce mailing list