Skip to content

JS Number converted to <Javascript undefined> instead of <class 'float'> for async functions #2321

Closed
@Daniel528

Description

@Daniel528

Hello,

stackblitz where bug is recreated: https://stackblitz.com/edit/js-mndfxt?file=index.js

I am attempting to return a float value from an async javascript function defined through the window and executed with the aio module. Inside the coroutine the python calls the function assigned to the window. The function returns a float which when read in python is of type <Javascript undefined> rather than of type <class 'float'>.

From testing currently it seems:

  • In the same circumstances, numbers returned async which are able to be converted to <class 'int'> are converted to <class 'int'>. It is not included in the stackblitz but I've also checked and strings and bools are converted to their respective types.
  • Functions which return a float synchronously return a value of type <class 'float'>
  • Async functions defined in the python script which return floats return a value of type <class 'float'> not as <Javascript undefined>
  • Where an async javascript function returns an object, where a child property is a float, the float is converted to type <class 'float'>.

Based on the above I am assuming the conversion of number to <Javascript undefined> for floats is a bug and not expected behaviour.

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