Skip to content

Node.js is broken when python code returns NaN #22

@gwer

Description

@gwer
const python = pythonBridge();
python`float('nan')`.then(n => console.log(n))

This sent incorrect message to channel and causes unhandleable error:

undefined:1
{"type":"success","value":NaN}
                          ^

SyntaxError: Unexpected token N in JSON at position 26
    at JSON.parse (<anonymous>)
    at Pipe.channel.onread (internal/child_process.js:472:28)

If value contains NaN we'll get the same error (python`{"a": float('nan')}`.then(n => console.log(n))).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions