Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Missing ctypes module for bindc_11.py--sometimes #2486

Open
@rebcabin

Description

@rebcabin

Running standalone, the following all work in the directory integration_tests

lpython bindc_01.py
lpython bindc_02.py
lpython bindc_07.py
lpython bindc_08.py
lpython bindc_09.py
lpython bindc_09b.py
lpython bindc_10.py

However, bindc_11.py produces an error

(lp) ┌─(~/Documents/GitHub/lpython/integration_tests)─────(brian@MacBook-Pro:s001)─┐
└─(19:22:41 on vector-backend)──> lpython bindc_11.py                                                                                    ──(Mon,Feb05)─┘
semantic error: Could not find the module 'ctypes'. If an import path is available, please use the `-I` option to specify it
 --> bindc_11.py:1:1
  |
1 | import numpy, ctypes
  | ^^^^^^^^^^^^^^^^^^^^ 

The module ctypes is not in evidence in the directory tree:

(lp) ┌─(~/Documents/GitHub/lpython/integration_tests)─────(brian@MacBook-Pro:s001)─┐
└─(19:25:05 on vector-backend)──> find .. -name "ctypes.py"                                                                              ──(Mon,Feb05)─┘
(lp) ┌─(~/Documents/GitHub/lpython/integration_tests)

Nor in the lp environment:

(lp) ┌─(~/Documents/GitHub/lpython/integration_tests)─────(brian@MacBook-Pro:s001)─┐
└─(19:28:55 on vector-backend)──> find ~/miniforge3 -name ctypes.py                                                                
(lp) ┌─(~/Documents/GitHub/lpython/integration_tests)

So I have no idea how this could ever work under any circumstances, and no idea how to tell lpython via the -I option how to find ctypes. It's some kind of magical thing

HOWEVER, bindc_11 works under run_tests.py:

(lp) ┌─(~/Documents/GitHub/lpython/integration_tests)─────(brian@MacBook-Pro:s001)─┐
└─(19:24:32 on vector-backend)──> ./run_tests.py 2> /dev/null | grep bindc_11                                                      130 ↵ ──(Mon,Feb05)─┘
        Start  29: bindc_11
 39/323 Test  #29: bindc_11 .........................   Passed    0.09 sec

I have no idea how to find out what actual command that run_tests uses to launch bindc_11 or any other of its tests until I reverse engineer it.

To deepen the mystery, bindc_11 works in CPython:

(lp) ┌─(~/Documents/GitHub/lpython/integration_tests)──────(brian@MacBook-Pro:s001)─┐
└─(19:34:02 on vector-backend)──> PYTHONPATH=".:../src/runtime/lpython:.." LPYTHON_PY_MOD_NAME="" LPYTHON_PY_MOD_PATH="_lpython-tmp-test-cpython" python bindc_11.py
c_void_p(105553171916784)
5 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedseverenot blocker, but causes undesirable workarounds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions