-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix problems with import and zipimport in particular #31
base: master
Are you sure you want to change the base?
Conversation
Not sure the exact bit of code that you are talking about, but sounds like a job for *args ? |
This cures the constructor-related exception on attempts at importing modules, but there are still problems with PyZipImporter. Also improved some comments.
@stuaxo When I write This stuff is an example of how Jython makes Python objects. It's clever, and not terribly well explained anywhere, but the best explanation I know is here: https://wiki.python.org/jython/PythonTypesInJava. The problem referred to is that However, this doesn't suddenly make Jython 3 work, so there's more to find. |
We use java.nio.Path extensively to achieve platform independence and to support (and preserve) relative paths exactly as CPython does. Because Jython does not yet work well enough to run standard unit tests, we start a thorough Java-based test.
Getting quite nice conformance now with CPython as far as construction of a zipimporter goes:
We copy CPython, which does not have absolute file paths in the _files cache. Use of relative paths has generally been problematic in Jython, although it's what CPython does extensively. We have our own idea of the current directory, and some complex path manipulation using it, because it seemed Java would not pay attention to the changed value of the current working directory in property |
The test expresses the behaviour of get_data in CPython 3.5.2, and fails in every call at present (on Windows), so is disabled in the unit test.
Also re-named some local members. The objective is (only) to be clear about the specification of the methods, how it works internally. Un-expose some methods that do not have CPython counterparts. All preparatory to systematic tests.
Test against careful observation of equivalent behaviour in CPython, when a .py file name should be returned and when a .class.
There are many more things I'd like to change in |
Beginning work on the failure that happens on startup of Jython. First commit is just whitespace and comment. The actual problem is that the constructor has 3 args, but is called (correctly) with just the archive path.
I can fix this by moving some path-wrangling from
__new__
into a one-arg constructor. However, shouldn't__new__
be called rather than the constructor by reflection? But that's what's on sys.path_hooks.