Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd29a5c5

Browse files
committed
Deploying to gh-pages from @7beef77 🚀
1 parent8ff4164 commitd29a5c5

File tree

584 files changed

+5917
-5083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

584 files changed

+5917
-5083
lines changed

‎_sources/c-api/bytes.rst.txt‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,38 @@ called with a non-bytes parameter.
219219
reallocation fails, the original bytes object at *\*bytes* is deallocated,
220220
*\*bytes* is set to ``NULL``,:exc:`MemoryError` is set, and ``-1`` is
221221
returned.
222+
223+
224+
..c:function:: PyObject *PyBytes_Repr(PyObject *bytes, int smartquotes)
225+
226+
Get the string representation of *bytes*. This function is currently used to
227+
implement:meth:`!bytes.__repr__` in Python.
228+
229+
This function does not do type checking; it is undefined behavior to pass
230+
*bytes* as a non-bytes object or ``NULL``.
231+
232+
If *smartquotes* is true, the representation will use a double-quoted string
233+
instead of single-quoted string when single-quotes are present in *bytes*.
234+
For example, the byte string ``'Python'`` would be represented as
235+
``b"'Python'"`` when *smartquotes* is true, or ``b'\'Python\''`` when it is
236+
false.
237+
238+
On success, this function returns a:term:`strong reference` to a
239+
:class:`str` object containing the representation. On failure, this
240+
returns ``NULL`` with an exception set.
241+
242+
243+
..c:function:: PyObject *PyBytes_DecodeEscape(const char *s, Py_ssize_t len, const char *errors, Py_ssize_t unicode, const char *recode_encoding)
244+
245+
Unescape a backslash-escaped string *s*. *s* must not be ``NULL``.
246+
*len* must be the size of *s*.
247+
248+
*errors* must be one of ``"strict"``, ``"replace"``, or ``"ignore"``. If
249+
*errors* is ``NULL``, then ``"strict"`` is used by default.
250+
251+
On success, this function returns a:term:`strong reference` to a Python
252+
:class:`bytes` object containing the unescaped string. On failure, this
253+
function returns ``NULL`` with an exception set.
254+
255+
..versionchanged::3.9
256+
*unicode* and *recode_encoding* are now unused.

‎_sources/c-api/file.rst.txt‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,29 @@ the :mod:`io` APIs instead.
9393
..versionadded::3.8
9494
9595
96+
..c:function:: PyObject *PyFile_OpenCodeObject(PyObject *path)
97+
98+
Open *path* with the mode ``'rb'``. *path* must be a Python:class:`str`
99+
object. The behavior of this function may be overridden by
100+
:c:func:`PyFile_SetOpenCodeHook` to allow for some preprocessing of the
101+
text.
102+
103+
This is analogous to:func:`io.open_code` in Python.
104+
105+
On success, this function returns a:term:`strong reference` to a Python
106+
file object. On failure, this function returns ``NULL`` with an exception
107+
set.
108+
109+
..versionadded::3.8
110+
111+
112+
..c:function:: PyObject *PyFile_OpenCode(const char *path)
113+
114+
Similar to:c:func:`PyFile_OpenCodeObject`, but *path* is a
115+
UTF-8 encoded:c:expr:`const char*`.
116+
117+
..versionadded::3.8
118+
96119
97120
..c:function::intPyFile_WriteObject(PyObject *obj, PyObject *p, int flags)
98121

‎_sources/c-api/float.rst.txt‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,51 @@ Floating-Point Objects
7878
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.
7979
8080
81+
.. c:macro:: Py_INFINITY
82+
83+
This macro expands a to constant expression of type :c:expr:`double`, that
84+
represents the positive infinity.
85+
86+
On most platforms, this is equivalent to the :c:macro:`!INFINITY` macro from
87+
the C11 standard ``<math.h>`` header.
88+
89+
90+
.. c:macro:: Py_NAN
91+
92+
This macro expands a to constant expression of type :c:expr:`double`, that
93+
represents a quiet not-a-number (qNaN) value.
94+
95+
On most platforms, this is equivalent to the :c:macro:`!NAN` macro from
96+
the C11 standard ``<math.h>`` header.
97+
98+
99+
.. c:macro:: Py_MATH_E
100+
101+
The definition (accurate for a:c:expr:`double` type) of the :data:`math.e` constant.
102+
103+
104+
.. c:macro:: Py_MATH_El
105+
106+
High precision (long double) definition of :data:`~math.e` constant.
107+
108+
109+
.. c:macro:: Py_MATH_PI
110+
111+
The definition (accurate for a:c:expr:`double` type) of the :data:`math.pi` constant.
112+
113+
114+
.. c:macro:: Py_MATH_PIl
115+
116+
High precision (long double) definition of :data:`~math.pi` constant.
117+
118+
119+
.. c:macro:: Py_MATH_TAU
120+
121+
The definition (accurate for a:c:expr:`double` type) of the :data:`math.tau` constant.
122+
123+
.. versionadded:: 3.6
124+
125+
81126
.. c:macro:: Py_RETURN_NAN
82127
83128
Return :data:`math.nan` from a function.

‎_sources/c-api/frame.rst.txt‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ See also :ref:`Reflection <reflection>`.
2929
Previously, this type was only available after including
3030
``<frameobject.h>``.
3131

32+
..c:function:: PyFrameObject *PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, PyObject *locals)
33+
34+
Create a new frame object. This function returns a:term:`strong reference`
35+
to the new frame object on success, and returns ``NULL`` with an exception
36+
set on failure.
37+
3238
..c:function::intPyFrame_Check(PyObject *obj)
3339
3440
Return non-zero if *obj* is a frame object.
@@ -161,6 +167,57 @@ See :pep:`667` for more information.
161167
162168
Return non-zero if *obj* is a frame:func:`locals` proxy.
163169
170+
171+
Legacy Local Variable APIs
172+
^^^^^^^^^^^^^^^^^^^^^^^^^^
173+
174+
These APIs are:term:`soft deprecated`. As of Python 3.13, they do nothing.
175+
They exist solely for backwards compatibility.
176+
177+
178+
..c:function::voidPyFrame_LocalsToFast(PyFrameObject *f, int clear)
179+
180+
This function is:term:`soft deprecated` and does nothing.
181+
182+
Prior to Python 3.13, this function would copy the:attr:`~frame.f_locals`
183+
attribute of *f* to the internal "fast" array of local variables, allowing
184+
changes in frame objects to be visible to the interpreter. If *clear* was
185+
true, this function would process variables that were unset in the locals
186+
dictionary.
187+
188+
..versionchanged::3.13
189+
This function now does nothing.
190+
191+
192+
..c:function::voidPyFrame_FastToLocals(PyFrameObject *f)
193+
194+
This function is:term:`soft deprecated` and does nothing.
195+
196+
Prior to Python 3.13, this function would copy the internal "fast" array
197+
of local variables (which is used by the interpreter) to the
198+
:attr:`~frame.f_locals` attribute of *f*, allowing changes in local
199+
variables to be visible to frame objects.
200+
201+
.. versionchanged:: 3.13
202+
This function now does nothing.
203+
204+
205+
.. c:function:: int PyFrame_FastToLocalsWithError(PyFrameObject *f)
206+
207+
This function is:term:`soft deprecated` and does nothing.
208+
209+
Prior to Python 3.13, this function was similar to
210+
:c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and
211+
``-1`` with an exception set on failure.
212+
213+
..versionchanged::3.13
214+
This function now does nothing.
215+
216+
217+
..seealso::
218+
:pep:`667`
219+
220+
164221
Internal Frames
165222
^^^^^^^^^^^^^^^
166223

‎_sources/c-api/intro.rst.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ complete listing.
121121
122122
Return the absolute value of ``x``.
123123

124+
If the result cannot be represented (for example, if ``x`` has
125+
:c:macro:`!INT_MIN` value for:c:expr:`int` type), the behavior is
126+
undefined.
127+
124128
..versionadded::3.3
125129

126130
..c:macro:: Py_ALWAYS_INLINE

‎_sources/c-api/type.rst.txt‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@ Type Objects
116116
.. versionadded:: 3.12
117117
118118
119+
.. c:function:: int PyType_Unwatch(int watcher_id, PyObject *type)
120+
121+
Mark *type* as not watched. This undoes a previous call to
122+
:c:func:`PyType_Watch`. *type* must not be ``NULL``.
123+
124+
An extension should never call this function with a *watcher_id* that was
125+
not returned to it by a previous call to:c:func:`PyType_AddWatcher`.
126+
127+
On success, this function returns ``0``. On failure, this function returns
128+
``-1`` with an exception set.
129+
130+
..versionadded::3.12
131+
132+
119133
..c:type::int (*PyType_WatchCallback)(PyObject *type)
120134
121135
Type of a type-watcher callback function.
@@ -133,6 +147,18 @@ Type Objects
133147
Type features are denoted by single bit flags.
134148
135149
150+
..c:function::intPyType_FastSubclass(PyTypeObject *type, int flag)
151+
152+
Return non-zero if the type object *type* sets the subclass flag *flag*.
153+
Subclass flags are denoted by
154+
:c:macro:`Py_TPFLAGS_*_SUBCLASS <Py_TPFLAGS_LONG_SUBCLASS>`.
155+
This function is used by many ``_Check`` functions for common types.
156+
157+
..seealso::
158+
:c:func:`PyObject_TypeCheck`, which is used as a slower alternative in
159+
``_Check`` functions for types that don't come with subclass flags.
160+
161+
136162
..c:function::intPyType_IS_GC(PyTypeObject *o)
137163
138164
Return true if the type object includes support for the cycle detector; this
@@ -169,12 +195,14 @@ Type Objects
169195
before initialization) and should be paired with :c:func:`PyObject_Free` in
170196
:c:member:`~PyTypeObject.tp_free`.
171197
198+
172199
.. c:function:: PyObject* PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
173200
174201
Generic handler for the:c:member:`~PyTypeObject.tp_new` slot of a type
175202
object. Creates a new instance using the type's
176203
:c:member:`~PyTypeObject.tp_alloc` slot and returns the resulting object.
177204
205+
178206
..c:function::intPyType_Ready(PyTypeObject *type)
179207
180208
Finalize a type object. This should be called on all type objects to finish
@@ -191,13 +219,15 @@ Type Objects
191219
GC protocol itself by at least implementing the
192220
:c:member:`~PyTypeObject.tp_traverse` handle.
193221
222+
194223
..c:function:: PyObject*PyType_GetName(PyTypeObject *type)
195224
196225
Return the type's name. Equivalent to getting the type's
197226
:attr:`~type.__name__` attribute.
198227
199228
..versionadded::3.11
200229
230+
201231
..c:function:: PyObject*PyType_GetQualName(PyTypeObject *type)
202232
203233
Return the type's qualified name. Equivalent to getting the
@@ -213,13 +243,15 @@ Type Objects
213243
214244
..versionadded::3.13
215245
246+
216247
..c:function:: PyObject*PyType_GetModuleName(PyTypeObject *type)
217248
218249
Return the type's module name. Equivalent to getting the
219250
:attr:`type.__module__` attribute.
220251
221252
..versionadded::3.13
222253
254+
223255
..c:function::void*PyType_GetSlot(PyTypeObject *type, int slot)
224256
225257
Return the function pointer stored in the given slot. If the
@@ -236,6 +268,7 @@ Type Objects
236268
:c:func:`PyType_GetSlot` can now accept all types.
237269
Previously, it was limited to:ref:`heap types<heap-types>`.
238270
271+
239272
..c:function:: PyObject*PyType_GetModule(PyTypeObject *type)
240273
241274
Return the module object associated with the given type when the type was
@@ -255,6 +288,7 @@ Type Objects
255288
256289
..versionadded::3.9
257290
291+
258292
..c:function::void*PyType_GetModuleState(PyTypeObject *type)
259293
260294
Return the state of the module object associated with the given type.
@@ -269,6 +303,7 @@ Type Objects
269303
270304
..versionadded::3.9
271305
306+
272307
..c:function:: PyObject*PyType_GetModuleByDef(PyTypeObject *type, struct PyModuleDef *def)
273308
274309
Find the first superclass whose module was created from
@@ -288,6 +323,7 @@ Type Objects
288323
289324
.. versionadded:: 3.11
290325
326+
291327
.. c:function:: int PyType_GetBaseByToken(PyTypeObject *type, void *token, PyTypeObject **result)
292328
293329
Find the first superclass in *type*'s:term:`method resolution order` whose
@@ -306,6 +342,7 @@ Type Objects
306342
307343
..versionadded::3.14
308344
345+
309346
..c:function::intPyUnstable_Type_AssignVersionTag(PyTypeObject *type)
310347
311348
Attempt to assign a version tag to the given type.
@@ -316,6 +353,16 @@ Type Objects
316353
..versionadded::3.12
317354
318355
356+
..c:function::intPyType_SUPPORTS_WEAKREFS(PyTypeObject *type)
357+
358+
Return true if instances of *type* support creating weak references, false
359+
otherwise. This function always succeeds. *type* must not be ``NULL``.
360+
361+
..seealso::
362+
*:ref:`weakrefobjects`
363+
*:py:mod:`weakref`
364+
365+
319366
Creating Heap-Allocated Types
320367
.............................
321368
@@ -364,6 +411,7 @@ The following functions and structs are used to create
364411
365412
.. versionadded:: 3.12
366413
414+
367415
.. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
368416
369417
Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``.
@@ -390,6 +438,7 @@ The following functions and structs are used to create
390438
Creating classes whose metaclass overrides
391439
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
392440
441+
393442
..c:function:: PyObject*PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
394443
395444
Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``.
@@ -411,6 +460,7 @@ The following functions and structs are used to create
411460
Creating classes whose metaclass overrides
412461
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
413462
463+
414464
..c:function:: PyObject*PyType_FromSpec(PyType_Spec *spec)
415465
416466
Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``.
@@ -431,6 +481,7 @@ The following functions and structs are used to create
431481
Creating classes whose metaclass overrides
432482
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
433483
484+
434485
..c:function::intPyType_Freeze(PyTypeObject *type)
435486
436487
Make a type immutable: set the:c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag.
@@ -602,6 +653,7 @@ The following functions and structs are used to create
602653
* :c:data:`Py_tp_token` (for clarity, prefer:c:data:`Py_TP_USE_SPEC`
603654
rather than ``NULL``)
604655
656+
605657
.. c:macro:: Py_tp_token
606658
607659
A :c:member:`~PyType_Slot.slot` that records a static memory layout ID

‎_sources/c-api/typeobj.rst.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,8 +1336,8 @@ and :c:data:`PyType_Type` effectively act as defaults.)
13361336
..c:macro:: Py_TPFLAGS_BASE_EXC_SUBCLASS
13371337
..c:macro:: Py_TPFLAGS_TYPE_SUBCLASS
13381338
1339-
These flags are used by functions such as
1340-
:c:func:`PyLong_Check` to quickly determine if a type is a subclass
1339+
Functions such as:c:func:`PyLong_Check` will call:c:func:`PyType_FastSubclass`
1340+
with one of these flags to quickly determine if a type is a subclass
13411341
of a built-in type; such specific checks are faster than a generic
13421342
check, like:c:func:`PyObject_IsInstance`. Custom types that inherit
13431343
from built-ins should have their:c:member:`~PyTypeObject.tp_flags`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp