Skip to content

GH-99005: More intrinsics #100774

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 3 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 3 additions & 19 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,6 @@ The Python compiler currently generates the following bytecode instructions.
Unary operations take the top of the stack, apply the operation, and push the
result back on the stack.

.. opcode:: UNARY_POSITIVE

Implements ``TOS = +TOS``.


.. opcode:: UNARY_NEGATIVE

Expand Down Expand Up @@ -906,13 +902,6 @@ iterations of the loop.
.. versionadded:: 3.6


.. opcode:: LIST_TO_TUPLE

Pops a list from the stack and pushes a tuple containing the same values.

.. versionadded:: 3.9


.. opcode:: LIST_EXTEND (i)

Calls ``list.extend(TOS1[-i], TOS)``. Used to build lists.
Expand Down Expand Up @@ -1372,14 +1361,6 @@ iterations of the loop.
.. versionadded:: 3.11


.. opcode:: ASYNC_GEN_WRAP

Wraps the value on top of the stack in an ``async_generator_wrapped_value``.
Used to yield in async generators.

.. versionadded:: 3.11


.. opcode:: HAVE_ARGUMENT

This is not really an opcode. It identifies the dividing line between
Expand Down Expand Up @@ -1411,6 +1392,9 @@ iterations of the loop.
* ``1`` Prints the argument to standard out. Used in the REPL.
* ``2`` Performs ``import *`` for the named module.
* ``3`` Extracts the return value from a ``StopIteration`` exception.
* ``4`` Wraps an aync generator value
* ``5`` Performs the unary ``+`` operation
* ``6`` Converts a list to a tuple

.. versionadded:: 3.12

Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_genobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {

extern PyObject *_PyGen_yf(PyGenObject *);
extern PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
extern PyObject *_PyAsyncGenValueWrapperNew(PyObject *);
extern PyObject *_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);

/* runtime lifecycle */

Expand Down
5 changes: 4 additions & 1 deletion Include/internal/pycore_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
#define INTRINSIC_PRINT 1
#define INTRINSIC_IMPORT_STAR 2
#define INTRINSIC_STOPITERATION_ERROR 3
#define INTRINSIC_ASYNC_GEN_WRAP 4
#define INTRINSIC_UNARY_POSITIVE 5
#define INTRINSIC_LIST_TO_TUPLE 6

#define MAX_INTRINSIC_1 3
#define MAX_INTRINSIC_1 6

typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value);

Expand Down
56 changes: 28 additions & 28 deletions Include/internal/pycore_opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

117 changes: 57 additions & 60 deletions Include/opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading