8000 GH-106008: Make implicit boolean conversions explicit by brandtbucher · Pull Request #106003 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-106008: Make implicit boolean conversions explicit #106003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jun 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Docs
  • Loading branch information
brandtbucher committed Jun 23, 2023
commit a76f11dcceb1ba9d28e72d21f2a8eccf0fc16507
20 changes: 20 additions & 0 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ result back on the stack.

Implements ``STACK[-1] = not STACK[-1]``.

.. versionchanged:: 3.13
This instruction now requires an exact :class:`bool` operand.


.. opcode:: UNARY_INVERT

Expand All @@ -548,6 +551,13 @@ result back on the stack.
.. versionadded:: 3.5


.. opcode:: TO_BOOL

Implements ``STACK[-1] = bool(STACK[-1])``.

.. versionadded:: 3.13


**Binary and in-place operations**

Binary operations remove the top two items from the stack (``STACK[-1]`` and
Expand Down Expand Up @@ -1130,6 +1140,10 @@ iterations of the loop.
``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set
(``opname & 16``), the result should be coerced to ``bool``.

.. versionchanged:: 3.13
The fifth-lowest bit of the oparg now indicates a forced conversion to
:class:`bool`.


.. opcode:: IS_OP (invert)

Expand Down Expand Up @@ -1192,6 +1206,9 @@ iterations of the loop.
.. versionchanged:: 3.12
This is no longer a pseudo-instruction.

.. versionchanged:: 3.13
This instruction now requires an exact :class:`bool` operand.

.. opcode:: POP_JUMP_IF_FALSE (delta)

If ``STACK[-1]`` is false, increments the bytecode counter by *delta*.
Expand All @@ -1205,6 +1222,9 @@ iterations of the loop.
.. versionchanged:: 3.12
This is no longer a pseudo-instruction.

.. versionchanged:: 3.13
This instruction now requires an exact :class:`bool` operand.

.. opcode:: POP_JUMP_IF_NOT_NONE (delta)

If ``STACK[-1]`` is not ``None``, increments the bytecode counter by *delta*.
Expand Down
0