Skip to content

[3.11] gh-115572: Move codeobject.replace() docs to the data model … #115632

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 2 commits into from
Feb 18, 2024
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
8 changes: 1 addition & 7 deletions Doc/library/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,14 @@ Standard names are defined for the following types:

.. index:: pair: built-in function; compile

The type for code objects such as returned by :func:`compile`.
The type of :ref:`code objects <code-objects>` such as returned by :func:`compile`.

.. audit-event:: code.__new__ code,filename,name,argcount,posonlyargcount,kwonlyargcount,nlocals,stacksize,flags types.CodeType

Note that the audited arguments may not match the names or positions
required by the initializer. The audit event only occurs for direct
instantiation of code objects, and is not raised for normal compilation.

.. method:: CodeType.replace(**kwargs)

Return a copy of the code object with new values for the specified fields.

.. versionadded:: 3.8

.. data:: CellType

The type for cell objects: such objects are used as containers for
Expand Down
6 changes: 6 additions & 0 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,12 @@ Methods on code objects
:pep:`626` - Precise line numbers for debugging and other tools.
The PEP that introduced the :meth:`!co_lines` method.

.. method:: codeobject.replace(**kwargs)

Return a copy of the code object with new values for the specified fields.

.. versionadded:: 3.8


.. _frame-objects:

Expand Down