Skip to content

Commit c5cfcdf

Browse files
gh-67041: Allow to distinguish between empty and not defined URI components (GH-123305)
Changes in the urllib.parse module: * Add option missing_as_none in urlparse(), urlsplit() and urldefrag(). If it is true, represent not defined components as None instead of an empty string. * Add option keep_empty in urlunparse() and urlunsplit(). If it is true, keep empty non-None components in the resulting string.
1 parent 67535ab commit c5cfcdf

File tree

6 files changed

+755
-323
lines changed

6 files changed

+755
-323
lines changed

Doc/library/urllib.parse.rst

Lines changed: 136 additions & 76 deletions
Large diffs are not rendered by default.

Doc/whatsnew/3.15.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,18 @@ unittest
836836
(Contributed by Garry Cairns in :gh:`134567`.)
837837

838838

839+
urllib.parse
840+
------------
841+
842+
* Add the *missing_as_none* parameter to :func:`~urllib.parse.urlparse`,
843+
:func:`~urllib.parse.urlsplit` and :func:`~urllib.parse.urldefrag` functions.
844+
Add the *keep_empty* parameter to :func:`~urllib.parse.urlunparse` and
845+
:func:`~urllib.parse.urlunsplit` functions.
846+
This allows to distinguish between empty and not defined URI components
847+
and preserve empty components.
848+
(Contributed by Serhiy Storchaka in :gh:`67041`.)
849+
850+
839851
venv
840852
----
841853

0 commit comments

Comments
 (0)