Skip to content

Commit 0c80da4

Browse files
authored
gh-115572: Move codeobject.replace() docs to the data model (#115631)
1 parent 371c970 commit 0c80da4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Doc/library/types.rst

+1-9
Original file line numberDiff line numberDiff line change
@@ -188,22 +188,14 @@ Standard names are defined for the following types:
188188

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

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

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

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

199-
.. method:: CodeType.replace(**kwargs)
200-
201-
Return a copy of the code object with new values for the specified fields.
202-
203-
Code objects are also supported by generic function :func:`copy.replace`.
204-
205-
.. versionadded:: 3.8
206-
207199
.. data:: CellType
208200

209201
The type for cell objects: such objects are used as containers for

Doc/reference/datamodel.rst

+8
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,14 @@ Methods on code objects
12921292
:pep:`626` - Precise line numbers for debugging and other tools.
12931293
The PEP that introduced the :meth:`!co_lines` method.
12941294

1295+
.. method:: codeobject.replace(**kwargs)
1296+
1297+
Return a copy of the code object with new values for the specified fields.
1298+
1299+
Code objects are also supported by the generic function :func:`copy.replace`.
1300+
1301+
.. versionadded:: 3.8
1302+
12951303

12961304
.. _frame-objects:
12971305

0 commit comments

Comments
 (0)