[New-bugs-announce] [issue39691] Allow passing Pathlike objects to io.open_code

Maor Kleinberger report at bugs.python.org
Wed Feb 19 18:02:30 EST 2020


New submission from Maor Kleinberger <kmaork at gmail.com>:

As in many functions in python3, io.open_code should probably accept pathlike objects and not just path strings.

Below is  open_code's docstring:
> Opens the provided file with the intent to import the contents.
> This may perform extra validation beyond open(), but is otherwise interchangeable with calling open(path, 'rb').

The second bit is not entirely true, as open accepts pathlike objects and open_code doesn't.
Fixing this will help solve future bugs and existing bugs like https://bugs.python.org/issue39517

I'd be happy to open a pull request if it is agreed that this should be changed.

----------
components: Library (Lib)
messages: 362292
nosy: kmaork
priority: normal
severity: normal
status: open
title: Allow passing Pathlike objects to io.open_code
type: enhancement
versions: Python 3.9

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


More information about the New-bugs-announce mailing list