What’s new in Python 3.15¶
- Editor:
TBD
This article explains the new features in Python 3.15, compared to 3.14.
For full details, see the changelog.
Note
Prerelease users should be aware that this document is currently in draft form. It will be updated substantially as Python 3.15 moves towards release, so it’s worth checking back even after reading earlier versions.
Summary — release highlights¶
New features¶
Other language changes¶
Several error messages incorrectly using the term “argument” have been corrected. (Contributed by Stan Ulbrych in gh-133382.)
New modules¶
None yet.
Improved modules¶
ssl¶
Indicate through
ssl.HAS_PSK_TLS13
whether thessl
module supports “External PSKs” in TLSv1.3, as described in RFC 9258. (Contributed by Will Childs-Klein in gh-133624.)
Optimizations¶
module_name¶
TODO
Deprecated¶
module_name: TODO
Removed¶
sysconfig¶
Removed the check_home parameter of
sysconfig.is_python_build()
. (Contributed by Filipe Laíns in gh-92897.)
typing¶
The undocumented keyword argument syntax for creating
NamedTuple
classes (for example,Point = NamedTuple("Point", x=int, y=int)
) is no longer supported. Use the class-based syntax or the functional syntax instead. (Contributed by Bénédikt Tran in gh-133817.)Using
TD = TypedDict("TD")
orTD = TypedDict("TD", None)
to construct aTypedDict
type with zero field is no longer supported. Useclass TD(TypedDict): pass
orTD = TypedDict("TD", {})
instead. (Contributed by Bénédikt Tran in gh-133823.)
wave¶
Removed the
getmark()
,setmark()
andgetmarkers()
methods of theWave_read
andWave_write
classes, which were deprecated since Python 3.13. (Contributed by Bénédikt Tran in gh-133873.)
Porting to Python 3.15¶
This section lists previously described changes and other bugfixes that may require changes to your code.
Build changes¶
C API changes¶
New features¶
TODO
Porting to Python 3.15¶
sqlite3.Connection
APIs has been cleaned up.All parameters of
sqlite3.connect()
except database are now keyword-only.The first three parameters of methods
create_function()
andcreate_aggregate()
are now positional-only.The first parameter of methods
set_authorizer()
,set_progress_handler()
andset_trace_callback()
is now positional-only.
(Contributed by Serhiy Storchaka in gh-133595.)
Deprecated C APIs¶
TODO
Removed C APIs¶
Remove deprecated
PyUnicode
functions:PyUnicode_AsDecodedObject()
: UsePyCodec_Decode()
instead.PyUnicode_AsDecodedUnicode()
: UsePyCodec_Decode()
instead; Note that some codecs (for example, “base64”) may return a type other thanstr
, such asbytes
.PyUnicode_AsEncodedObject()
: UsePyCodec_Encode()
instead.PyUnicode_AsEncodedUnicode()
: UsePyCodec_Encode()
instead; Note that some codecs (for example, “base64”) may return a type other thanbytes
, such asstr
.
(Contributed by Stan Ulbrych in gh-133612)
PyImport_ImportModuleNoBlock()
: deprecated alias ofPyImport_ImportModule()
. (Contributed by Bénédikt Tran in gh-133644.)
The following functions are removed in favor of PyConfig_Get()
.
The pythoncapi-compat project can be used to get PyConfig_Get()
on Python 3.13 and older.
Python initialization functions:
Py_GetExecPrefix()
: usePyConfig_Get("base_exec_prefix")
(sys.base_exec_prefix
) instead. UsePyConfig_Get("exec_prefix")
(sys.exec_prefix
) if virtual environments need to be handled.Py_GetPath()
: usePyConfig_Get("module_search_paths")
(sys.path
) instead.Py_GetPrefix()
: usePyConfig_Get("base_prefix")
(sys.base_prefix
) instead. UsePyConfig_Get("prefix")
(sys.prefix
) if virtual environments need to be handled.Py_GetProgramFullPath()
: usePyConfig_Get("executable")
(sys.executable
) instead.Py_GetProgramName()
: usePyConfig_Get("executable")
(sys.executable
) instead.Py_GetPythonHome()
: usePyConfig_Get("home")
or thePYTHONHOME
environment variable instead.
(Contributed by Bénédikt Tran in gh-133644.)