Skip to content

concoredocker.java ZMQ sends Python literals, Python expects JSON, interop breaks on non-numeric data #492

@avinxshKD

Description

@avinxshKD

Python's ZMQ transport (concore_base.py) uses send_json()/recv_json() , JSON on the wire. Java's ZMQ (added in #483) serializes with toPythonLiteral() and parses with literalEval(), Python-literal format on the wire.

For pure numeric lists like [0.0, 1.5, 2.3] both formats look identical, so it works. The moment you have a boolean or null in the payload:

  • Java sends [0.0, True, None] => Python's json.loads throws JSONDecodeError
  • Python sends [0.0, true, null] => Java's literalEval hits parseKeyword("true") => IllegalArgumentException

Fix is Java-side only:

Add a toJsonLiteral() serializer (mirrors toPythonLiteral() but outputs true/false/null/double-quoted strings)
Use it in the ZMQ write() path
Extend parseKeyword() in Parser to also accept true/false/null so Java can receive from both formats

File I/O stays Python-literal (unchanged), only ZMQ path changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions