OLD | NEW |
1 **************************** | 1 **************************** |
2 What's New In Python 3.6 | 2 What's New In Python 3.6 |
3 **************************** | 3 **************************** |
4 | 4 |
5 :Release: |release| | 5 :Release: |release| |
6 :Date: |today| | 6 :Date: |today| |
7 :Editors: Elvis Pranskevichus <elvis@magic.io>, Yury Selivanov <yury@magic.io> | 7 :Editors: Elvis Pranskevichus <elvis@magic.io>, Yury Selivanov <yury@magic.io> |
8 | 8 |
9 .. Rules for maintenance: | 9 .. Rules for maintenance: |
10 | 10 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 def __init_subclass__(cls, **kwargs): | 344 def __init_subclass__(cls, **kwargs): |
345 super().__init_subclass__(**kwargs) | 345 super().__init_subclass__(**kwargs) |
346 cls.subclasses.append(cls) | 346 cls.subclasses.append(cls) |
347 | 347 |
348 class Plugin1(PluginBase): | 348 class Plugin1(PluginBase): |
349 pass | 349 pass |
350 | 350 |
351 class Plugin2(PluginBase): | 351 class Plugin2(PluginBase): |
352 pass | 352 pass |
| 353 |
| 354 In order to allow zero-argument :func:`super` calls to work correctly from |
| 355 ``__init_subclass__`` implementations, custom metaclasses must ensure that |
| 356 the new ``__classcell__`` namespace entry is propagated to ``type.__new__``. |
353 | 357 |
354 .. seealso:: | 358 .. seealso:: |
355 | 359 |
356 :pep:`487` -- Simpler customization of class creation | 360 :pep:`487` -- Simpler customization of class creation |
357 PEP written and implemented by Martin Teichmann. | 361 PEP written and implemented by Martin Teichmann. |
358 | 362 |
359 :ref:`Feature documentation <class-customization>` | 363 :ref:`Feature documentation <class-customization>` |
360 | 364 |
361 | 365 |
362 .. _whatsnew36-pep487-descriptors: | 366 .. _whatsnew36-pep487-descriptors: |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2228 now includes the group index and the position of the reference. | 2232 now includes the group index and the position of the reference. |
2229 (Contributed by SilentGhost, Serhiy Storchaka in :issue:`25953`.) | 2233 (Contributed by SilentGhost, Serhiy Storchaka in :issue:`25953`.) |
2230 | 2234 |
2231 * :class:`zipfile.ZipFile` will now raise :exc:`NotImplementedError` for | 2235 * :class:`zipfile.ZipFile` will now raise :exc:`NotImplementedError` for |
2232 unrecognized compression values. Previously a plain :exc:`RuntimeError` | 2236 unrecognized compression values. Previously a plain :exc:`RuntimeError` |
2233 was raised. Additionally, calling :class:`~zipfile.ZipFile` methods | 2237 was raised. Additionally, calling :class:`~zipfile.ZipFile` methods |
2234 on a closed ZipFile or calling the :meth:`~zipfile.ZipFile.write` method | 2238 on a closed ZipFile or calling the :meth:`~zipfile.ZipFile.write` method |
2235 on a ZipFile created with mode ``'r'`` will raise a :exc:`ValueError`. | 2239 on a ZipFile created with mode ``'r'`` will raise a :exc:`ValueError`. |
2236 Previously, a :exc:`RuntimeError` was raised in those scenarios. | 2240 Previously, a :exc:`RuntimeError` was raised in those scenarios. |
2237 | 2241 |
| 2242 * when custom metaclasses are combined with zero-argument :func:`super` or |
| 2243 direct references from methods to the implicit ``__class__`` closure |
| 2244 variable, the implicit ``__classcell__`` namespace entry must now be passed |
| 2245 up to ``type.__new__`` for initialisation. Failing to do so will result in |
| 2246 a :exc:`DeprecationWarning` in 3.6 and a :exc:`RuntimeWarning` in the future. |
2238 | 2247 |
2239 Changes in the C API | 2248 Changes in the C API |
2240 -------------------- | 2249 -------------------- |
2241 | 2250 |
2242 * The :c:func:`PyMem_Malloc` allocator family now uses the :ref:`pymalloc alloca
tor | 2251 * The :c:func:`PyMem_Malloc` allocator family now uses the :ref:`pymalloc alloca
tor |
2243 <pymalloc>` rather than the system :c:func:`malloc`. Applications calling | 2252 <pymalloc>` rather than the system :c:func:`malloc`. Applications calling |
2244 :c:func:`PyMem_Malloc` without holding the GIL can now crash. Set the | 2253 :c:func:`PyMem_Malloc` without holding the GIL can now crash. Set the |
2245 :envvar:`PYTHONMALLOC` environment variable to ``debug`` to validate the | 2254 :envvar:`PYTHONMALLOC` environment variable to ``debug`` to validate the |
2246 usage of memory allocators in your application. See :issue:`26249`. | 2255 usage of memory allocators in your application. See :issue:`26249`. |
2247 | 2256 |
(...skipping 26 matching lines...) Expand all Loading... |
2274 have been modified, the new :opcode:`CALL_FUNCTION_EX` and | 2283 have been modified, the new :opcode:`CALL_FUNCTION_EX` and |
2275 :opcode:`BUILD_TUPLE_UNPACK_WITH_CALL` have been added, and | 2284 :opcode:`BUILD_TUPLE_UNPACK_WITH_CALL` have been added, and |
2276 ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and ``MAKE_CLOSURE`` opcodes | 2285 ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and ``MAKE_CLOSURE`` opcodes |
2277 have been removed. | 2286 have been removed. |
2278 (Contributed by Demur Rumed in :issue:`27095`, and Serhiy Storchaka in | 2287 (Contributed by Demur Rumed in :issue:`27095`, and Serhiy Storchaka in |
2279 :issue:`27213`, :issue:`28257`.) | 2288 :issue:`27213`, :issue:`28257`.) |
2280 | 2289 |
2281 * The new :opcode:`SETUP_ANNOTATIONS` and :opcode:`STORE_ANNOTATION` opcodes | 2290 * The new :opcode:`SETUP_ANNOTATIONS` and :opcode:`STORE_ANNOTATION` opcodes |
2282 have been added to support the new :term:`variable annotation` syntax. | 2291 have been added to support the new :term:`variable annotation` syntax. |
2283 (Contributed by Ivan Levkivskyi in :issue:`27985`.) | 2292 (Contributed by Ivan Levkivskyi in :issue:`27985`.) |
OLD | NEW |