[issue32642] add support for path-like objects in sys.path

2022-03-26 Thread Noam Cohen


Noam Cohen  added the comment:

that's why pre-insert conversion was suggested.
path-like objects could still be added to sys.path, while converting to str 
upon insert, preserving sys.path's bytes and strings only policy.

--

___
Python tracker 
<https://bugs.python.org/issue32642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32642] add support for path-like objects in sys.path

2022-03-26 Thread Noam Cohen


Noam Cohen  added the comment:

So I've got in mind a PyListObject subclass with calls to PyOS_FSPath before 
insert, append, extend and __getitem__.

But I feel like this is an overkill; also, extend function might be trickier to 
implement.
Do any of you have better idea?

--

___
Python tracker 
<https://bugs.python.org/issue32642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32642] add support for path-like objects in sys.path

2022-03-26 Thread Noam Cohen


Noam Cohen  added the comment:

You've got a point.
But in my opinion path-like object usage should be intuitive and users should 
not worry about converting it into string in some of the places.

What do you feel about sub-classing list for sys.path and converting path-like 
objects upon setting items / reading?

--

___
Python tracker 
<https://bugs.python.org/issue32642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32642] add support for path-like objects in sys.path

2022-03-25 Thread Noam Cohen


Change by Noam Cohen :


--
nosy: +ncohen
nosy_count: 8.0 -> 9.0
pull_requests: +30196
pull_request: https://github.com/python/cpython/pull/32118

___
Python tracker 
<https://bugs.python.org/issue32642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com