Pending Removal in Python 3.15¶
http.server.CGIHTTPRequestHandler
will be removed along with its related--cgi
flag topython -m http.server
. It was obsolete and rarely used. No direct replacement exists. Anything is better than CGI to interface a web server with a request handler.locale
:locale.getdefaultlocale()
was deprecated in Python 3.11 and originally planned for removal in Python 3.13 (gh-90817), but removal has been postponed to Python 3.15. Uselocale.setlocale()
,locale.getencoding()
andlocale.getlocale()
instead. (Contributed by Hugo van Kemenade in gh-111187.)pathlib
:pathlib.PurePath.is_reserved()
is deprecated and scheduled for removal in Python 3.15. From Python 3.13 onwards, useos.path.isreserved
to detect reserved paths on Windows.platform
:java_ver()
is deprecated and will be removed in 3.15. It was largely untested, had a confusing API, and was only useful for Jython support. (Contributed by Nikita Sobolev in gh-116349.)threading
: Passing any arguments tothreading.RLock()
is now deprecated. C version allows any numbers of args and kwargs, but they are just ignored. Python version does not allow any arguments. All arguments will be removed fromthreading.RLock()
in Python 3.15. (Contributed by Nikita Sobolev in gh-102029.)-
The undocumented keyword argument syntax for creating
NamedTuple
classes (NT = NamedTuple("NT", x=int)
) is deprecated, and will be disallowed in 3.15. Use the class-based syntax or the functional syntax instead.
-
types.CodeType
: Accessingco_lnotab
was deprecated in PEP 626 since 3.10 and was planned to be removed in 3.12, but it only got a properDeprecationWarning
in 3.12. May be removed in 3.15. (Contributed by Nikita Sobolev in gh-101866.)
-
When using the functional syntax to create a
NamedTuple
class, failing to pass a value to the fields parameter (NT = NamedTuple("NT")
) is deprecated. PassingNone
to the fields parameter (NT = NamedTuple("NT", None)
) is also deprecated. Both will be disallowed in Python 3.15. To create aNamedTuple
class with 0 fields, useclass NT(NamedTuple): pass
orNT = NamedTuple("NT", [])
.
typing.TypedDict
: When using the functional syntax to create aTypedDict
class, failing to pass a value to the fields parameter (TD = TypedDict("TD")
) is deprecated. PassingNone
to the fields parameter (TD = TypedDict("TD", None)
) is also deprecated. Both will be disallowed in Python 3.15. To create aTypedDict
class with 0 fields, useclass TD(TypedDict): pass
orTD = TypedDict("TD", {})
.wave
: Deprecate thegetmark()
,setmark()
andgetmarkers()
methods of thewave.Wave_read
andwave.Wave_write
classes. They will be removed in Python 3.15. (Contributed by Victor Stinner in gh-105096.)