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

2022-03-26 Thread Eryk Sun
Eryk Sun added the comment: > I've got in mind a PyListObject subclass with calls to PyOS_FSPath > before insert, append, extend and __getitem__. The sys module doesn't prevent rebinding sys.path. Most code I think is careful to update sys.path. But surely some code replaces it with a new li

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

2022-03-26 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 26.03.2022 08:59, Nick Coghlan wrote: > > The import system is already complex, so I think the hesitation about > allowing arbitrary Path-like objects is warranted. (For example: are > importlib's caching semantics really valid for *arbitrary* path-li

[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

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

2022-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: pkgutil just skips non-string elements in sys.path. for dir in search_path: if not isinstance(dir, str): continue -- ___ Python tracker __

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

2022-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think you are trying to solve a wrong problem. > This wasn't obvious because Path objects appear as strings in normal debug > output, etc. How is it? >>> pathlib.Path('/usr/lib') PosixPath('/usr/lib') >>> [pathlib.Path('/usr/lib')] [PosixPath('/usr/lib'

[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? -- _

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

2022-03-26 Thread Nick Coghlan
Nick Coghlan added the comment: The import system is already complex, so I think the hesitation about allowing arbitrary Path-like objects is warranted. (For example: are importlib's caching semantics really valid for *arbitrary* path-like objects? An object can be path-like without being im

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

2022-03-25 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

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

2022-03-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Are there any problems with converting a Path to string before adding it to sys.path? You do this one time, and any users of sys.path will not need to bother about conversion. It is better even for performance. Otherwise we will need to revise and update e

[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 ___ _

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

2022-03-12 Thread Chih-Hsuan Yen
Change by Chih-Hsuan Yen : -- nosy: -yan12125 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

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

2022-03-12 Thread Jason R. Coombs
Jason R. Coombs added the comment: I'm in support of adding Path support for sys.path, but I also agree with Eric, there are innumerable consumers of sys.path beyond importlib. and since pathlib.Path isn't a str, it would likely introduce incompatibility. On the other hand, users introducing

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

2022-01-04 Thread Éric Araujo
Éric Araujo added the comment: I’m not an import expert but would have misgivings about having fancy types in sys.path too! It seems so fundamental, and used from C and Python, with a simple interface of a direct list (plus importers and finders etc), that I would understand it pure strings

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

2020-08-29 Thread Roundup Robot
Change by Roundup Robot : -- nosy: +python-dev nosy_count: 6.0 -> 7.0 pull_requests: +21106 pull_request: https://github.com/python/cpython/pull/22000 ___ Python tracker ___ __

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

2019-04-27 Thread Brett Cannon
Brett Cannon added the comment: This seems fine to me and I can't think of any negatives. Can anyone think of why this might be a bad idea? (Messing with how sys.path is used is just so fundamental I'm being paranoid. :) -- nosy: +eric.snow, ncoghlan

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

2018-03-18 Thread Jay Yin
Jay Yin added the comment: srry I opened another issue bpo-33099 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

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

2018-03-15 Thread Brett Cannon
Brett Cannon added the comment: Please open a separate issue for the test_poplib issue. -- ___ Python tracker ___ ___ Python-bugs-li

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

2018-03-15 Thread Jay Yin
Jay Yin added the comment: it seems to me like the issue in my tests is that some SSL thing is failing?, anyone have any experience with this? -- ___ Python tracker ___ __

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

2018-03-15 Thread Jay Yin
Jay Yin added the comment: https://pastebin.com/q4FKnPZH the trace for the test_poplib -- ___ Python tracker ___ ___ Python-bugs-li

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

2018-03-15 Thread Jay Yin
Jay Yin added the comment: I'm having issues with my local changes for my PR, I'm unsure why my local machine takes a seemingly infinite amount of time on test_poplib, so again I think something to do with my local environment is causing issues again, any help would be appreciated... ---

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

2018-03-08 Thread Jay Yin
Jay Yin added the comment: The issue was resolved by updating my version of the rest of the package apparently and remaking the whole thing, must have been some outdated stuff on my end causing the issue -- ___ Python tracker

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

2018-03-07 Thread Jay Yin
Jay Yin added the comment: I've been stuck on "test_poplib" for over 149661 sec now, that's about 41 hours... I don't think this is working correctly, although I'm unsure what test_poplib is doing that has been affected by what I've changed here. -- _

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

2018-03-06 Thread Brett Cannon
Brett Cannon added the comment: 'make regen-all' should do it (but so will just running 'make -s -j' like any old build of CPython). On Mon, Mar 5, 2018, 12:43 Jay Yin, wrote: > > Jay Yin added the comment: > > I'm unsure how to regenerate the files that interact with the code for > sys.path

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

2018-03-05 Thread Jay Yin
Jay Yin added the comment: I'm unsure how to regenerate the files that interact with the code for sys.path as travisCI states " Generated files not up to date M Python/importlib_external.h " since my code changes some of how the importing is handled -- ___

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

2018-02-14 Thread Jay Yin
Change by Jay Yin : -- keywords: +patch pull_requests: +5484 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mail

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

2018-02-12 Thread Jay Yin
Jay Yin added the comment: https://github.com/python/cpython/blob/3c34aad4e7a95913ec7db8e5e948a8fc69047bf7/Lib/importlib/_bootstrap_external.py#L1069-L1090 those are the particular class and lines I'm referring to -- ___ Python tracker

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

2018-02-12 Thread Jay Yin
Jay Yin added the comment: ok, so I found the PathFinder class you referenced, just making sure, this issue pertains to changing "self.path"'s usage and declaration to be a path-like object instead of the hard coded 'sys', 'path' returns? or is that part of it already?, also since this uses a

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

2018-02-11 Thread Jay Yin
Jay Yin added the comment: Thanks for the reply -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

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

2018-02-09 Thread Chih-Hsuan Yen
Chih-Hsuan Yen added the comment: > what file(s) is/are the sys.path code located in? If I understand it correctly, sys.path is handled in importlib._bootstrap_external.PathFinder.find_spec(). I can patch PathFinder for handling path-like objects: https://github.com/yan12125/cpython/commit/e

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

2018-02-08 Thread Jay Yin
Jay Yin added the comment: what file(s) is/are the sys.path code located in? -- ___ Python tracker ___ ___ Python-bugs-list mailing

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

2018-02-05 Thread Jay Yin
Jay Yin added the comment: This looks a lot like https://bugs.python.org/issue32446, I'd like to tackle this, if we are going through with it. -- nosy: +jayyin11043 ___ Python tracker ___

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

2018-01-23 Thread Chris Jerdonek
New submission from Chris Jerdonek : This issue is to suggest enhancing sys.path to recognize path-like objects, per PEP 519. I recently ran into an issue where a path was getting added to sys.path, but the corresponding imports weren't working as they should, even though sys.path showed the