Pebaz / nimporter

Compile Nim Extensions for Python On Import!
MIT License
824 stars 33 forks source link

exclude_dirs, cryptic error when exclude_dirs specified as a set #31

Closed phdye closed 1 year ago

phdye commented 4 years ago

While exclude_dirs supplied to build_nim_extensions() clearly should be a list, it would seem excusable for a user to specify it as a set in the light that _find_extensions() does:

def _find_extensions(cls, path, exclude_dirs=set()):  

Unfortunately, one then gets the following cryptic error: Traceback (most recent call last): File "setup.py", line 9, in modules = nimporter.build_nim_extensions(exclude_dirs={}) File "/home/phdyex/.local/lib/python3.8/site-packages/nimporter.py", line 1081, in build_nim_extensions ext = cls._build_nim_extension(extension, root) File "/home/phdyex/.local/lib/python3.8/site-packages/nimporter.py", line 979, in _build_nim_extension return NimCompiler.compile_nim_extension( File "/home/phdyex/.local/lib/python3.8/site-packages/nimporter.py", line 465, in compile_nim_extension raise NimCompileException(errors[0]) nimporter.NimCompileException: type mismatch: got <int literal(5), int literal(5)> | if exp[i].kind in nnkCallKinds + {nnkDotExpr, nnkBracketExpr}: | let callVar = newIdentNode(":c" & $counter) -> result.assigns.add getAst(asgn(callVar, paramAst)) | result.check[i] = callVar | result.printOuts.add getAst(print(argStr, callVar))

At /home/phdyex/.choosenim/toolchains/nim-1.2.0/lib/pure/unittest.nim 650:43

I will create a PR to catch this scenario and raise an informative exception.

SekouDiaoNlp commented 2 years ago

Bump! @phdye is it still an issue you care about?

Pebaz commented 1 year ago

Closing as this is no longer a supported function in version 2.0.0