<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87381>87381</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lldb] tests errors `ModuleNotFoundError: No module named '_lldb'` with Release=Debug on Windows
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
amordo
</td>
</tr>
</table>
<pre>
For example
```
C:\Users\iammorjj\llvm-project\build>python_d bin/lldb-dotest -p TestAddressBreakpoints.py
C:\Program Files\Python312\python_d.exe C:/Users/iammorjj/llvm-project/lldb/test/API/dotest.py --arch x86_64 --build-dir C:/Users/iammorjj/llvm-project/build/lldb-test-build.noindex --executable C:/Users/iammorjj/llvm-project/build/./bin/lldb.exe --compiler C:/Users/iammorjj/llvm-project/build/./bin/clang.exe --dsymutil C:/Users/iammorjj/llvm-project/build/./bin/dsymutil.exe --lldb-libs-dir C:/Users/iammorjj/llvm-project/build/./lib --llvm-tools-dir C:/Users/iammorjj/llvm-project/build/./bin -p TestAddressBreakpoints.py
lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision ee99475068523de185dce0a449b65e684a1e6b73)
clang revision ee99475068523de185dce0a449b65e684a1e6b73
llvm revision ee99475068523de185dce0a449b65e684a1e6b73
Traceback (most recent call last):
File "C:\Users\iammorjj\llvm-project\build\Lib\site-packages\lldb\__init__.py", line 39, in <module>
import _lldb
ModuleNotFoundError: No module named '_lldb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\iammorjj\llvm-project\lldb\test\API\dotest.py", line 8, in <module>
lldbsuite.test.run_suite()
File "C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\dotest.py", line 946, in run_suite
import lldb
File "C:\Users\iammorjj\llvm-project\build\Lib\site-packages\lldb\__init__.py", line 42, in <module>
from . import _lldb
ImportError: cannot import name '_lldb' from partially initialized module 'lldb' (most likely due to a circular import) (C:\Users\iammorjj\llvm-project\build\Lib\site-packages\lldb\__init__.py)
C:\Users\iammorjj\llvm-project\build>
```
It doesn't work neither with `python` nor `python_d`.
Adding `_d` solves the problem (rename from `"C:\Users\iammorjj\llvm-project\build\lib\site-packages\lldb\_lldb.cp312-win_amd64.pyd"` to `"C:\Users\iammorjj\llvm-project\build\lib\site-packages\lldb\_lldb_d.cp312-win_amd64.pyd"`).
```
C:\Users\iammorjj\llvm-project\build>python_d bin/lldb-dotest -p TestAddressBreakpoints.py
C:\Program Files\Python312\python_d.exe C:/Users/iammorjj/llvm-project/lldb/test/API/dotest.py --arch x86_64 --build-dir C:/Users/iammorjj/llvm-project/build/lldb-test-build.noindex --executable C:/Users/iammorjj/llvm-project/build/./bin/lldb.exe --compiler C:/Users/iammorjj/llvm-project/build/./bin/clang.exe --dsymutil C:/Users/iammorjj/llvm-project/build/./bin/dsymutil.exe --lldb-libs-dir C:/Users/iammorjj/llvm-project/build/./lib --llvm-tools-dir C:/Users/iammorjj/llvm-project/build/./bin -p TestAddressBreakpoints.py
lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision ee99475068523de185dce0a449b65e684a1e6b73)
clang revision ee99475068523de185dce0a449b65e684a1e6b73
llvm revision ee99475068523de185dce0a449b65e684a1e6b73
C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\lldbplatformutil.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import packaging
Skipping the following test categories: ['libc++', 'libstdcxx', 'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']
C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py:1520: SyntaxWarning: invalid escape sequence '\l'
"LD_EXTRAS": "-shared -l%s\liblldb.lib" % lib_dir,
C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\decorators.py:1094: SyntaxWarning: invalid escape sequence '\s'
if re.match("%s: 1\s*" % feature, output):
PASS: LLDB (C:\Users\iammorjj\llvm-project\build\bin\clang.exe-x86_64) :: test_address_breakpoints (TestAddressBreakpoints.AddressBreakpointTestCase.test_address_breakpoints)
----------------------------------------------------------------------
Ran 1 test in 4.053s
OK
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='C:\\Users\\iammorjj\\llvm-project\\build\\lldb-test-build.noindex\\functionalities\\breakpoint\\address_breakpoints\\TestAddressBreakpoints.test_address_breakpoints\\Incomplete.log' mode='w' encoding='utf-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.BufferedRandom name='C:\\Users\\iammorjj\\AppData\\Local\\Temp\\tmphalkqt2u'>
C:\Users\iammorjj\llvm-project\build>
```
PS: seems it's regression after
https://github.com/llvm/llvm-project/commit/ae389b2450bd604a3f3bbe5b09b333b2d99801dd#diff-644df201b5e726af9435d4fd88f8f43924506062add78fff02d4dca4fb8f98d7R152
`set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb${LLDB_PYTHON_EXT_SUFFIX}")`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWE1v47bT_zTMhZAgUe-HHBw7xhM03Q2SLNqeBEoc2dxQpEpSif18-j9IyS9ps0WTdnvahbERKfI3M78ZzgxFjeEbCXCJsiuUrS7oaLdKX9JeaaYuGsX2l2ulMexoPwhA0QpFC5RH888PlyhZoGz5xYA2KFty2vdKf_2KsqUQz30waPUVWouyZTNywVByPeztVsma4YZLRNZCsCZgyoKxOBjwIxi7YEyDMVca6NOguLQmHPavpN1ptdG0x2suwEm985hJTFC2POCHsAPs15P1pB1ZH7Vzcs-0m9RAZO3UQGS9uLtBZD1pFQ57HARUt1u8K_M6T3EQeFsCxvXfFzCZP9vrcCeQUCouGexwEMAO2tHSRrxD7QNq6J6PfHrTg6BV_cAFfEDJE1wrqNzMeMzs-9Fy8U_wDhgzpGdD8MZ8jEyHK3jjgZ77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