Skip to content

Commit 83bb82f

Browse files
committed
Add JSBigInt description
1 parent efdb684 commit 83bb82f

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

peps/pep-0818.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,11 @@ JavaScript object.
793793
794794
``IS_CALLABLE``
795795
Signals whether the ``typeof`` the JavaScript object is ``"function"``. If
796-
present, used to implement ``__call__`` on the ``JSProxy``.
796+
present, used to implement ``__call__`` on the ``JSProxy``. Any keyword
797+
arguments will be put into a JavaScript object and passed as the last
798+
argument to the JavaScript function. It will also be used to implement a
799+
`new` method such that ``jscallable.new(*args, **kwargs)`` is shorthand for
800+
``Reflect.construct(jsfunction, *args, **kwargs)``.
797801
798802
``IS_ERROR``
799803
Signals whether the JavaScript object is an ``Error``. If so, the
@@ -945,7 +949,7 @@ The ``JSProxy`` base class has the following shape:
945949

946950
.. code:: python
947951
948-
class JSProxy(metaclass=_JsProxyMetaClass):
952+
class JSProxy(metaclass=_JSProxyMetaClass):
949953
def __eq__(self, other: JSProxy) -> bool:
950954
...
951955
@@ -1265,7 +1269,14 @@ This has the following properties:
12651269

12661270
``JSProxy``: This is ``type(run_js("({})"))``
12671271

1268-
``JSBigInt``
1272+
``JSBigInt``: This is a subclass of ``int`` that behaves in all ways identical
1273+
to ``int`` except that it is guaranteed to be converted to a ``BigInt`` when
1274+
passed to JavaScript. Otherwise, only ``int``s that are bigger than ``2**53``
1275+
are converted to ``BigInt``, and smaller ``int``s are converted to ``number``.
1276+
If the left operand on a binary op or the leftmost operand of `pow` is a
1277+
``BigInt``, the operation returns a ``BigInt``. If the leftmost operand is an
1278+
``int`` the return value will be an ``int``.
1279+
12691280

12701281

12711282
The ``jstypes.code`` Module

0 commit comments

Comments
 (0)