STINNER Victor <vstin...@python.org> added the comment:

I understand that os.fsencode() was modified to support the fspath protocol to 
be consistent with the C implementation PyUnicode_FSConverter() which calls 
PyOS_FSPath().

I agree that at least in C, we need two functions: one which accepts (str, 
bytes), another which also supports the fspath protocol.

IMHO PyUnicode_FSConverter() was modified to support fspath because it was 
convenient to only modify one function. But this change wasn't designed to 
decide in each function if fspath should be accepted or not.

For me, os.putenv() should not accept fspath neither.

This issue is not specific to os.environ. It's more general about the PEP 519 
implementation. IMHO the implementation should be "adjusted".

I like the deprecation idea ;-) We did something similar with functions 
accepting float by mistake. First a deprecation warning was emited, and then it 
became a hard error (exception).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39461>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to