Message276296
Grabbing the recently released Python 3.6.0b1, I tried running one of my test suites, but found that some assertions were failing to assert when the package was loaded as a zip file (such as with pytest-runner installed dependencies). I distilled the issue to this:
$ cat > mod.py
def test(val):
assert(val)
print(val)
$ zip mod.zip mod.py
updating: mod.py (deflated 20%)
$ rm mod.py
$ python
Python 3.6.0b1 (v3.6.0b1:5b0ca4ed5e2f, Sep 12 2016, 09:24:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('mod.zip')
>>> import mod
>>> mod.test(False)
False
>>> mod.__loader__
<zipimporter object "mod.zip">
>>> sys.flags.optimize
0
I would have expected the call to mod.test to have raised an AssertionError, and on Python 3.5 it does.
I searched the what's new and didn't see anything advertising this change, so I suspect it's an unintentional regression.
I'm including Brett for his familiarity with importlib, but welcome re-assignment.
If I can do more to help, let me know. |
|
Date |
User |
Action |
Args |
2016-09-13 16:19:15 | jaraco | set | recipients:
+ jaraco, brett.cannon, ned.deily |
2016-09-13 16:19:15 | jaraco | set | messageid: <1473783555.8.0.563951024179.issue28131@psf.upfronthosting.co.za> |
2016-09-13 16:19:15 | jaraco | link | issue28131 messages |
2016-09-13 16:19:15 | jaraco | create | |
|