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

Ctypes bytecode scanning does not appear to work with Python 3.7 #2760

Closed
ghost opened this Issue Aug 22, 2017 · 4 comments

Comments

Projects
1 participant
@ghost

ghost commented Aug 22, 2017

This is currently a low priority but needs investigation.

@htgoebel htgoebel added the PY3.7 label Aug 22, 2017

@ghost

This comment has been minimized.

ghost commented Dec 6, 2017

I took the liberty of looking into this, and patched iterate instructions to output the information. Here are the instructions for each respective test:

______________________ test_ctypes_CDLL_call[ctypes.CDLL] ______________________
[gw2] linux -- Python 3.7.0 /home/travis/virtualenv/python3.7-dev/bin/python
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fa3e2d8e588>
classname = 'ctypes.CDLL'
    @pytest.mark.parametrize('classname', CTYPES_CLASSNAMES)
    def test_ctypes_CDLL_call(monkeypatch, classname):
        code = "%s('somelib.xxx')" % classname
        res = __scan_code_for_ctypes(code, monkeypatch)
>       assert res == set(['somelib.xxx'])
E       AssertionError: assert set() == {'somelib.xxx'}
E         Extra items in the right set:
E         'somelib.xxx'
E         Full diff:
E         - set()
E         + {'somelib.xxx'}
tests/unit/test_depend_utils.py:40: AssertionError
----------------------------- Captured stdout call -----------------------------
(LOAD_NAME, ctypes)
(LOAD_METHOD, CDLL)
(LOAD_CONST, somelib.xxx)
(CALL_METHOD, 1)
(POP_TOP, None)
(LOAD_CONST, None)
(RETURN_VALUE, None)
None
_____________________ test_ctypes_CDLL_call[ctypes.PyDLL] ______________________
[gw2] linux -- Python 3.7.0 /home/travis/virtualenv/python3.7-dev/bin/python
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fa3e2da34a8>
classname = 'ctypes.PyDLL'
    @pytest.mark.parametrize('classname', CTYPES_CLASSNAMES)
    def test_ctypes_CDLL_call(monkeypatch, classname):
        code = "%s('somelib.xxx')" % classname
        res = __scan_code_for_ctypes(code, monkeypatch)
>       assert res == set(['somelib.xxx'])
E       AssertionError: assert set() == {'somelib.xxx'}
E         Extra items in the right set:
E         'somelib.xxx'
E         Full diff:
E         - set()
E         + {'somelib.xxx'}
tests/unit/test_depend_utils.py:40: AssertionError
----------------------------- Captured stdout call -----------------------------
(LOAD_NAME, ctypes)
(LOAD_METHOD, PyDLL)
(LOAD_CONST, somelib.xxx)
(CALL_METHOD, 1)
(POP_TOP, None)
(LOAD_CONST, None)
(RETURN_VALUE, None)
None
_____________________ test_ctypes_CDLL_call[ctypes.WinDLL] _____________________
[gw0] linux -- Python 3.7.0 /home/travis/virtualenv/python3.7-dev/bin/python
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f782060b978>
classname = 'ctypes.WinDLL'
    @pytest.mark.parametrize('classname', CTYPES_CLASSNAMES)
    def test_ctypes_CDLL_call(monkeypatch, classname):
        code = "%s('somelib.xxx')" % classname
        res = __scan_code_for_ctypes(code, monkeypatch)
>       assert res == set(['somelib.xxx'])
E       AssertionError: assert set() == {'somelib.xxx'}
E         Extra items in the right set:
E         'somelib.xxx'
E         Full diff:
E         - set()
E         + {'somelib.xxx'}
tests/unit/test_depend_utils.py:40: AssertionError
----------------------------- Captured stdout call -----------------------------
(LOAD_NAME, ctypes)
(LOAD_METHOD, WinDLL)
(LOAD_CONST, somelib.xxx)
(CALL_METHOD, 1)
(POP_TOP, None)
(LOAD_CONST, None)
(RETURN_VALUE, None)
None
@ghost

This comment has been minimized.

ghost commented Dec 6, 2017

Also, ref https://bugs.python.org/issue26110 ("Speedup method calls", implemented)

@htgoebel

This comment has been minimized.

Member

htgoebel commented Dec 6, 2017

Thanks, early bird :-)

htgoebel added a commit that referenced this issue Mar 8, 2018

Depend/util: Fix ctypes scanning on Python 3.7
LOAD_METHOD appears to have been added to the
bytecode as one possible option. See gh-2760 for
more details. Closes gh-2760.

@htgoebel htgoebel added this to Todo in Support Python 3.7 Mar 12, 2018

htgoebel added a commit to htgoebel/pyinstaller that referenced this issue Mar 16, 2018

Depend/util: Fix ctypes scanning on Python 3.7
LOAD_METHOD appears to have been added to the
bytecode as one possible option. See pyinstallergh-2760 for
more details. Closes pyinstallergh-2760.

htgoebel added a commit that referenced this issue Mar 20, 2018

depend: util: Fix ctypes scanning for Python 3.7.
LOAD_METHOD appears to have been added to the
bytecode as one possible option. See gh-2760 for
more details. Closes gh-2760.
@htgoebel

This comment has been minimized.

Member

htgoebel commented Jul 9, 2018

Merging #3076 did not automatically close this :-(

@htgoebel htgoebel closed this Jul 9, 2018

Support Python 3.7 automation moved this from Todo to Done Jul 9, 2018

@htgoebel htgoebel added this to the PyInstaller 3.4 milestone Sep 2, 2018

cowo78 pushed a commit to cowo78/pyinstaller that referenced this issue Dec 7, 2018

depend: util: Fix ctypes scanning for Python 3.7.
LOAD_METHOD appears to have been added to the
bytecode as one possible option. See pyinstallergh-2760 for
more details. Closes pyinstallergh-2760.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment