diff options
author | Brandt Bucher <brandtbucher@gmail.com> | 2022-08-05 05:45:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-05 05:45:05 (GMT) |
commit | 5f3c9fda1825737fa7b671b995f84a8ab9a4adb8 (patch) | |
tree | 12ed0c009fe54089ff588e1fd56c1e67ee4a832f /Doc/library/dis.rst | |
parent | 9890f86ae2001d19e7a18fee5b13aa0dd6069aef (diff) | |
download | cpython-5f3c9fda1825737fa7b671b995f84a8ab9a4adb8.zip cpython-5f3c9fda1825737fa7b671b995f84a8ab9a4adb8.tar.gz cpython-5f3c9fda1825737fa7b671b995f84a8ab9a4adb8.tar.bz2 |
GH-90997: Document CACHEs (GH-95694)
Diffstat (limited to 'Doc/library/dis.rst')
-rw-r--r-- | Doc/library/dis.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 68c3d1c..63b064e 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -408,6 +408,24 @@ The Python compiler currently generates the following bytecode instructions. .. versionadded:: 3.11 +.. opcode:: CACHE + + Rather than being an actual instruction, this opcode is used to mark extra + space for the interpreter to cache useful data directly in the bytecode + itself. It is automatically hidden by all ``dis`` utilities, but can be + viewed with ``show_caches=True``. + + Logically, this space is part of the preceding instruction. Many opcodes + expect to be followed by an exact number of caches, and will instruct the + interpreter to skip over them at runtime. + + Populated caches can look like arbitrary instructions, so great care should + be taken when reading or modifying raw, adaptive bytecode containing + quickened data. + + .. versionadded:: 3.11 + + **Unary operations** Unary operations take the top of the stack, apply the operation, and push the |