| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -190,11 +190,16 @@ Creating Heap-Allocated Types | |||
| 190 | 190 | The following functions and structs are used to create | |
| 191 | 191 | :ref:`heap types <heap-types>`. | |
| 192 | 192 | ||
| 193 | - .. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) | ||
| 193 | + .. c:function:: PyObject* PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) | ||
| 194 | 194 | ||
| 195 | - Creates and returns a :ref:`heap type <heap-types>` from the *spec* | ||
| 195 | + Create and return a :ref:`heap type <heap-types>` from the *spec* | ||
| 196 | 196 | (:const:`Py_TPFLAGS_HEAPTYPE`). | |
| 197 | 197 | ||
| 198 | + The metaclass *metaclass* is used to construct the resulting type object. | ||
| 199 | + When *metaclass* is ``NULL``, the default :c:type:`PyType_Type` is used | ||
| 200 | + instead. Note that metaclasses that override | ||
| 201 | + :c:member:`~PyTypeObject.tp_new` are not supported. | ||
| 202 | + | ||
| 198 | 203 | The *bases* argument can be used to specify base classes; it can either | |
| 199 | 204 | be only one class or a tuple of classes. | |
| 200 | 205 | If *bases* is ``NULL``, the *Py_tp_bases* slot is used instead. | |
@@ -210,22 +215,29 @@ The following functions and structs are used to create | |||
| 210 | 215 | ||
| 211 | 216 | This function calls :c:func:`PyType_Ready` on the new type. | |
| 212 | 217 | ||
| 218 | + .. versionadded:: 3.12 | ||
| 219 | + | ||
| 220 | + .. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) | ||
| 221 | + | ||
| 222 | + Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``. | ||
| 223 | + | ||
| 213 | 224 | .. versionadded:: 3.9 | |
| 214 | 225 | ||
| 215 | 226 | .. versionchanged:: 3.10 | |
| 216 | 227 | ||
| 217 | 228 | The function now accepts a single class as the *bases* argument and | |
| 218 | 229 | ``NULL`` as the ``tp_doc`` slot. | |
| 219 | 230 | ||
| 231 | + | ||
| 220 | 232 | .. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases) | |
| 221 | 233 | ||
| 222 | - Equivalent to ``PyType_FromModuleAndSpec(NULL, spec, bases)``. | ||
| 234 | + Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``. | ||
| 223 | 235 | ||
| 224 | 236 | .. versionadded:: 3.3 | |
| 225 | 237 | ||
| 226 | 238 | .. c:function:: PyObject* PyType_FromSpec(PyType_Spec *spec) | |
| 227 | 239 | ||
| 228 | - Equivalent to ``PyType_FromSpecWithBases(spec, NULL)``. | ||
| 240 | + Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``. | ||
| 229 | 241 | ||
| 230 | 242 | .. c:type:: PyType_Spec | |
| 231 | 243 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2071,7 +2071,7 @@ flag set. | |||
| 2071 | 2071 | ||
| 2072 | 2072 | This is done by filling a :c:type:`PyType_Spec` structure and calling | |
| 2073 | 2073 | :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, | |
| 2074 | - or :c:func:`PyType_FromModuleAndSpec`. | ||
| 2074 | + :c:func:`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`. | ||
| 2075 | 2075 | ||
| 2076 | 2076 | ||
| 2077 | 2077 | .. _number-structs: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1101,6 +1101,9 @@ need: | |||
| 1101 | 1101 | | Current process name when using ``multiprocessing`` | Set ``logging.logMultiprocessing`` to ``False``. | | |
| 1102 | 1102 | | to manage multiple processes. | | | |
| 1103 | 1103 | +-----------------------------------------------------+---------------------------------------------------+ | |
| 1104 | + | Current :class:`asyncio.Task` name when using | Set ``logging.logAsyncioTasks`` to ``False``. | | ||
| 1105 | + | ``asyncio``. | | | ||
| 1106 | + +-----------------------------------------------------+---------------------------------------------------+ | ||
| 1104 | 1107 | ||
| 1105 | 1108 | Also note that the core logging module only includes the basic handlers. If | |
| 1106 | 1109 | you don't import :mod:`logging.handlers` and :mod:`logging.config`, they won't | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -375,6 +375,8 @@ The :mod:`locale` module defines the following exception and functions: | |||
| 375 | 375 | The default setting is determined by calling :func:`getdefaultlocale`. | |
| 376 | 376 | *category* defaults to :const:`LC_ALL`. | |
| 377 | 377 | ||
| 378 | + .. deprecated:: 3.11 3.13 | ||
| 379 | + | ||
| 378 | 380 | ||
| 379 | 381 | .. function:: strcoll(string1, string2) | |
| 380 | 382 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -872,10 +872,14 @@ the options available to you. | |||
| 872 | 872 | +----------------+-------------------------+-----------------------------------------------+ | |
| 873 | 873 | | threadName | ``%(threadName)s`` | Thread name (if available). | | |
| 874 | 874 | +----------------+-------------------------+-----------------------------------------------+ | |
| 875 | + | taskName | ``%(taskName)s`` | :class:`asyncio.Task` name (if available). | | ||
| 876 | + +----------------+-------------------------+-----------------------------------------------+ | ||
| 875 | 877 | ||
| 876 | 878 | .. versionchanged:: 3.1 | |
| 877 | 879 | *processName* was added. | |
| 878 | 880 | ||
| 881 | + .. versionchanged:: 3.12 | ||
| 882 | + *taskName* was added. | ||
| 879 | 883 | ||
| 880 | 884 | .. _logger-adapter: | |
| 881 | 885 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1327,6 +1327,14 @@ Match objects support the following methods and attributes: | |||
| 1327 | 1327 | >>> m[2] # The second parenthesized subgroup. | |
| 1328 | 1328 | 'Newton' | |
| 1329 | 1329 | ||
| 1330 | + Named groups are supported as well:: | ||
| 1331 | + | ||
| 1332 | + >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Isaac Newton") | ||
| 1333 | + >>> m['first_name'] | ||
| 1334 | + 'Isaac' | ||
| 1335 | + >>> m['last_name'] | ||
| 1336 | + 'Newton' | ||
| 1337 | + | ||
| 1330 | 1338 | .. versionadded:: 3.6 | |
| 1331 | 1339 | ||
| 1332 | 1340 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments