Skip to content

Conversation

KoykL
Copy link
Contributor

@KoykL KoykL commented Dec 22, 2015

I use isSubclass check if a given entry in sys.path is subclass of str or unicode and tried to allow both situations. If it is unicode, I also convert it to str with PyUnicode_AsEncodedString() with Py_FileSystemDefaultEncoding.

I also modified nullImporterInit to make it accept subclasses of str.

@kmod
Copy link
Collaborator

kmod commented Dec 24, 2015

Looks great! Can we get a test though? If you drop a file in test/tests/, it will get run and have its output compared against CPython's. Since we have a file called test/tests/test_package/import_target.py, we could test this with something like

import sys
sys.path.append(u"test_package")
import import_target

Add four separate tests with prefix of sys_path for four types of
sys.path entries: str, unicode, subclass of str, and subclass of
unicode.
@KoykL
Copy link
Contributor Author

KoykL commented Dec 24, 2015

Hi! I add four individual tests with prefix of sys_path_ for four possible types of entries in sys.path, namely str, unicode, subclass of str, and subclass of unicode.

undingen added a commit that referenced this pull request Jan 4, 2016
Fix #599 by allowing subclasses of string and unicode in sys.path
@undingen undingen merged commit 7e58677 into pyston:master Jan 4, 2016
@undingen
Copy link
Contributor

undingen commented Jan 4, 2016

LGTM, thanks for the patch!
Sorry for the late response but kmod and me where both on holiday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants