yglukhov / nimpy

Nim - Python bridge
MIT License
1.47k stars 61 forks source link

to_json with Python booleans/None #165

Closed ggonnella closed 4 years ago

ggonnella commented 4 years ago

I noticed that using to_json with a Python boolean produces a JInt node and not a JBool node, as I would expect. And for a python None value, it produces a JStr "None", and not a JNull JsonNode.

Vindaar commented 4 years ago

I think this is just on oversight on my part maybe. It's possible there was a technical reason, which I can't remember right now. If @yglukhov doesn't do so first, I'll take a look at it ~today.

ggonnella commented 4 years ago

I wrote a pull request to handle this. However, some tests fail on my system when I execute "nimble test" (regardless of the code in the PR). https://github.com/yglukhov/nimpy/pull/166

ggonnella commented 4 years ago

PS for the reference, this is the error msg I have when running nimble test (both in the master branch and in my PR branch):

command line(1, 2) Error: 'none', 'boehm' or 'refc' expected, but 'arc' found
stack trace: (most recent call last)
/tmp/nimblecache/nimscriptapi.nim(165, 16)
/home/gonnella/nimpy/nimpy_28324.nims(89, 11) testTask
/home/gonnella/nimpy/nimpy_28324.nims(57, 12) runTests
/home/gonnella/tools/miniconda/3/lib/system/nimscript.nim(252, 7) exec
/home/gonnella/tools/miniconda/3/lib/system/nimscript.nim(252, 7) Error: unhandled exception: FAILED: nim c --threads:on --app:lib --gc:arc --passc:-g --out:tests/custommodulename.so tests/custommodulename.nim [OSError]
     Error: Exception raised during nimble script execution
yglukhov commented 4 years ago

Fixed in #166