Distributive-Network/PythonMonkey

Sometimes `x.constructor.name` is empty string when it's a string in NodeJS

Closed this issue · 1 comments

Issue type

Bug

How did you install PythonMonkey?

Source

OS platform and distribution

Ubuntu 22.04.4 LTS x86_64

Python version (python --version)

3.10

PythonMonkey version (pip show pythonmonkey)

0.7.2.dev10+2e3274d

Bug Description

Hey I noticed when using the dcp-client js library, if I instantiate a job and check the constructor's name - it is undefined. Doing the same in nodejs works fine

Standalone code to reproduce the issue

#! /usr/bin/env python3
import pythonmonkey as pm

async def run_job():
    compute = pm.globalThis.dcp.compute
    job = compute['for']([], '')

    ctor_name_fn = pm.eval('x=>x.constructor.name')

    print(ctor_name_fn(job)) # prints empty string
    print(ctor_name_fn(job) == '')

dcp_client = pm.require('dcp-client')
dcp_client['init'](run_job)

Relevant log output or backtrace

""

Additional info if applicable

I thought this worked before - but I couldn't reproduce it on an older version, so take it with one or two grains of salt.

What branch of PythonMonkey were you developing on? (If applicable)

main

This prints just fine for me, please make sure to get the latest from main

Job
False