Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

type(tuple) not working properly #822

Open
dmoisset opened this issue Jun 20, 2019 · 1 comment
Open

type(tuple) not working properly #822

dmoisset opened this issue Jun 20, 2019 · 1 comment

Comments

@dmoisset
Copy link

Expected Behavior

type(tuple) returns an incorrect value

Current Behavior

When I try this on master, this returns the javascript function with the Tuple constructor. I expect this to return the type object.

Steps to reproduce

For reference, this is what cpython does:

>>> print(type(tuple))
<class 'type'>
>>> print(type(tuple) is type)
True

while batavia does the following

>>> print(type(tuple))
function (args, kwargs) {
  if (args.length === 0) {
    return new types.Tuple();
  }

  return new types.Tuple(args[0]);
}
>>> print(type(tuple) is type)
False

Your Environment

Testing on master, revision 71388f5

  • Python Version 3.6.8

  • Operating System and Version: Ubuntu 18.04

@dmoisset
Copy link
Author

dmoisset commented Jun 20, 2019

I did a quick check, it seems to be related to https://github.com/beeware/batavia/blob/eb8ee7a/batavia/builtins/tuple.js#L5 : The tuple.__class__ is set, while other similar functions set the __call__ attribute instead. At least changing that seems to fix the problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant