Skip to content
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
21 changes: 21 additions & 0 deletions Doc/deprecations/pending-removal-in-3.20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ Pending removal in Python 3.20

(Contributed by Hugo van Kemenade and Stan Ulbrych in :gh:`76007`.)

* The ``__author__``, ``__credits__``, ``__copyright__`` and ``__date__``
attributes have been deprecated in these standard library modules and will
be removed in Python 3.20. Attribution is preserved in the source code
and the version control history.

- :mod:`bz2`
- :mod:`concurrent.futures`
- :mod:`inspect`
- :mod:`io`
- :mod:`json`
- :mod:`logging`
- :mod:`optparse`
- :mod:`platform`
- :mod:`pydoc`
- :mod:`tarfile`
- :mod:`tkinter.ttk`
- :mod:`tokenize`
- :mod:`uuid`

(Contributed by Stan Ulbrych in :gh:`159240`.)

* Deprecations defined by :pep:`829`:

* Warnings are produced for ``import`` lines found in :file:`{name}.pth`
Expand Down
8 changes: 8 additions & 0 deletions Doc/library/test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,14 @@ The :mod:`!test.support` module defines the following functions:

.. versionadded:: 3.6


.. function:: check_deprecated_module_attributes(test_case, module, *names, remove)

Assert that accessing each attribute in *names* on *module* emits a
:exc:`DeprecationWarning` naming the attribute and the Python version
*remove*, given as a ``(major, minor)`` tuple, in which it will be removed.


.. function:: skip_if_broken_multiprocessing_synchronize()

Skip tests if the :mod:`!multiprocessing.synchronize` module is missing, if
Expand Down
23 changes: 23 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,29 @@ New deprecations
3.9, now issues a deprecation warning on use. This property is slated for
removal in 3.21. Use ``ast.Tuple.elts`` instead.

* ``__author__``, ``__credits__``, ``__copyright__`` and ``__date__``:

* The ``__author__``, ``__credits__``, ``__copyright__`` and ``__date__``
attributes have been deprecated in these standard library modules and will
be removed in Python 3.20. Attribution is preserved in the source code
and the version control history.

- :mod:`bz2`
- :mod:`concurrent.futures`
- :mod:`inspect`
- :mod:`io`
- :mod:`json`
- :mod:`logging`
- :mod:`optparse`
- :mod:`platform`
- :mod:`pydoc`
- :mod:`tarfile`
- :mod:`tkinter.ttk`
- :mod:`tokenize`
- :mod:`uuid`

(Contributed by Stan Ulbrych in :gh:`159240`.)

* :mod:`functools`:

* Using a return annotation to infer the dispatch type for
Expand Down
10 changes: 9 additions & 1 deletion Lib/bz2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"open", "compress", "decompress",
"bzlib_version", "bzlib_version_info"]

__author__ = "Nadeem Vawda <nadeem.vawda@gmail.com>"
# Original author: Nadeem Vawda <nadeem.vawda@gmail.com>

from builtins import open as _builtin_open
from compression._common import _streams
import io
import os
lazy import warnings

from _bz2 import (BZ2Compressor, BZ2Decompressor,
bzlib_version, bzlib_version_info)
Expand Down Expand Up @@ -352,3 +353,10 @@ def decompress(data):
"end-of-stream marker was reached")
data = decomp.unused_data
return b"".join(results)


def __getattr__(name):
if name == "__author__":
warnings._deprecated("__author__", remove=(3, 20))
return "Nadeem Vawda <nadeem.vawda@gmail.com>" # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
12 changes: 10 additions & 2 deletions Lib/concurrent/futures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"""Execute computations asynchronously using threads or processes."""

__author__ = 'Brian Quinlan (brian@sweetapp.com)'
# Original author: Brian Quinlan (brian@sweetapp.com)

from concurrent.futures._base import (FIRST_COMPLETED,
FIRST_EXCEPTION,
Expand All @@ -17,6 +17,7 @@
wait,
as_completed)

lazy import warnings
lazy from .process import ProcessPoolExecutor
lazy from .thread import ThreadPoolExecutor

Expand Down Expand Up @@ -48,4 +49,11 @@


def __dir__():
return __all__ + ['__author__', '__doc__']
return __all__ + ['__doc__']


def __getattr__(name):
if name == "__author__":
warnings._deprecated("__author__", remove=(3, 20))
return 'Brian Quinlan (brian@sweetapp.com)' # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
2 changes: 1 addition & 1 deletion Lib/concurrent/futures/_base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.

__author__ = 'Brian Quinlan (brian@sweetapp.com)'
# Original author: Brian Quinlan (brian@sweetapp.com)

import collections
import logging
Expand Down
10 changes: 9 additions & 1 deletion Lib/concurrent/futures/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
_ResultItems in "Result Q"
"""

__author__ = 'Brian Quinlan (brian@sweetapp.com)'
# Original author: Brian Quinlan (brian@sweetapp.com)

import os
from concurrent.futures import _base
Expand All @@ -58,6 +58,7 @@
from functools import partial
import itertools
import sys
lazy import warnings
from traceback import format_exception


Expand Down Expand Up @@ -1065,3 +1066,10 @@ def kill_workers(self):
submitted).
"""
return self._force_shutdown(operation=_KILL)


def __getattr__(name):
if name == "__author__":
warnings._deprecated("__author__", remove=(3, 20))
return 'Brian Quinlan (brian@sweetapp.com)' # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
10 changes: 9 additions & 1 deletion Lib/concurrent/futures/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"""Implements ThreadPoolExecutor."""

__author__ = 'Brian Quinlan (brian@sweetapp.com)'
# Original author: Brian Quinlan (brian@sweetapp.com)

from concurrent.futures import _base
import itertools
Expand All @@ -12,6 +12,7 @@
import types
import weakref
import os
lazy import warnings


_threads_queues = weakref.WeakKeyDictionary()
Expand Down Expand Up @@ -272,3 +273,10 @@ def shutdown(self, wait=True, *, cancel_futures=False):
for t in self._threads:
t.join()
shutdown.__doc__ = _base.Executor.shutdown.__doc__


def __getattr__(name):
if name == "__author__":
warnings._deprecated("__author__", remove=(3, 20))
return 'Brian Quinlan (brian@sweetapp.com)' # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
2 changes: 1 addition & 1 deletion Lib/ctypes/_aix.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
The mode bit RTLD_MEMBER tells initAndLoad() that it needs to use the AIX (SVR3)
naming style.
"""
__author__ = "Michael Felt <aixtools@felt.demon.nl>"
# Original author: Michael Felt <aixtools@felt.demon.nl>

import re
from os import environ, path
Expand Down
13 changes: 11 additions & 2 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

# This module is in the public domain. No warranties.

__author__ = ('Ka-Ping Yee <ping@lfw.org>',
'Yury Selivanov <yselivanov@sprymix.com>')
# Original authors: Ka-Ping Yee,
# Yury Selivanov <yselivanov@sprymix.com>

__all__ = [
"AGEN_CLOSED",
Expand Down Expand Up @@ -160,6 +160,7 @@
import types
import functools
import builtins
lazy import warnings
from keyword import iskeyword
from operator import attrgetter
from collections import namedtuple, OrderedDict
Expand Down Expand Up @@ -3540,5 +3541,13 @@ def _main():
print(getsource(obj))


def __getattr__(name):
if name == "__author__":
warnings._deprecated("__author__", remove=(3, 20))
return ('Ka-Ping Yee',
'Yury Selivanov <yselivanov@sprymix.com>') # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


if __name__ == "__main__":
_main()
24 changes: 18 additions & 6 deletions Lib/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@
"""
# New I/O library conforming to PEP 3116.

__author__ = ("Guido van Rossum <guido@python.org>, "
"Mike Verdone <mike.verdone@gmail.com>, "
"Mark Russell <mark.russell@zen.co.uk>, "
"Antoine Pitrou <solipsis@pitrou.net>, "
"Amaury Forgeot d'Arc <amauryfa@gmail.com>, "
"Benjamin Peterson <benjamin@python.org>")
# Original authors: Mike Verdone <mike.verdone@gmail.com>,
# Mark Russell <mark.russell@zen.co.uk>,
# Antoine Pitrou <solipsis@pitrou.net>,
# Amaury Forgeot d'Arc <amauryfa@gmail.com>,
# Benjamin Peterson <benjamin@python.org>

__all__ = ["BlockingIOError", "open", "open_code", "IOBase", "RawIOBase",
"FileIO", "BytesIO", "StringIO", "BufferedIOBase",
Expand All @@ -52,6 +51,7 @@

import _io
import abc
lazy import warnings

from _collections_abc import _check_methods
from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
Expand Down Expand Up @@ -148,3 +148,15 @@ def __subclasshook__(cls, C):
return NotImplemented

__class_getitem__ = classmethod(GenericAlias)


def __getattr__(name):
if name == "__author__":
warnings._deprecated("__author__", remove=(3, 20))
return ("Guido van Rossum <guido@python.org>, "
"Mike Verdone <mike.verdone@gmail.com>, "
"Mark Russell <mark.russell@zen.co.uk>, "
"Antoine Pitrou <solipsis@pitrou.net>, "
"Amaury Forgeot d'Arc <amauryfa@gmail.com>, "
"Benjamin Peterson <benjamin@python.org>") # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
14 changes: 8 additions & 6 deletions Lib/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@
'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
]

__author__ = 'Bob Ippolito <bob@redivi.com>'
# Original author: Bob Ippolito <bob@redivi.com>

from .decoder import JSONDecoder, JSONDecodeError
from .encoder import JSONEncoder
import codecs
lazy import warnings

_default_encoder = JSONEncoder(
skipkeys=False,
Expand Down Expand Up @@ -387,9 +388,10 @@ def loads(s, *, cls=None, object_hook=None, parse_float=None,


def __getattr__(name):
if name == "__version__":
from warnings import _deprecated

_deprecated("__version__", remove=(3, 20))
return "2.0.9" # Do not change
if name in ("__version__", "__author__"):
warnings._deprecated(name, remove=(3, 20))
return { # Do not change
"__version__": "2.0.9",
"__author__": "Bob Ippolito <bob@redivi.com>",
}[name]
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
9 changes: 4 additions & 5 deletions Lib/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

import threading

__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
# Original author: Vinay Sajip <vinay_sajip@red-dove.com>
__status__ = "production"

#---------------------------------------------------------------------------
Expand Down Expand Up @@ -2371,13 +2371,12 @@ def captureWarnings(capture):


def __getattr__(name):
if name in ("__version__", "__date__"):
from warnings import _deprecated

_deprecated(name, remove=(3, 20))
if name in ("__version__", "__date__", "__author__"):
warnings._deprecated(name, remove=(3, 20))
return { # Do not change
"__version__": "0.5.1.2",
"__date__": "07 February 2010",
"__author__": "Vinay Sajip <vinay_sajip@red-dove.com>",
}[name]

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
Loading
Loading