cpython/Lib
Petr Viktorin c62c9e518b
[3.10] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179) (GH-113186) (GH-118177) (GH-118229)
The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] https://github.com/python/cpython/issues/61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2024-05-07 11:56:13 +02:00
..
asyncio [3.10] gh-116773: Fix overlapped memory corruption crash (GH-116774) (GH-117079) 2024-03-27 16:24:34 +01:00
collections Fix minor details in the Counter docs (GH-31029) (GH-31072) 2022-02-01 23:28:07 -06:00
concurrent gh-94440: Fix issue of ProcessPoolExecutor shutdown hanging (GH-94468) 2023-03-15 22:08:11 -07:00
ctypes [3.10] [3.11] gh-99952: fix refcount issues in ctypes.Structure from_param() result (GH-101339) (#101340) 2023-02-04 12:09:29 -08:00
curses
dbm
distutils [3.10] Fix typos in the Lib directory (GH-28775) (GH-28804) 2021-10-07 11:49:47 -04:00
email [3.10] gh-101021: Document binary parameters as bytes (GH-101024). (#101052) 2023-01-14 21:31:59 -08:00
encodings [3.11] gh-98433: Fix quadratic time idna decoding. (GH-99092) (GH-99222) 2022-11-07 19:23:16 -08:00
ensurepip [3.10] gh-101997: Update bundled pip version to 23.0.1 (GH-101998). (#102241) 2023-03-28 10:57:55 +02:00
html gh-100210: Correct the comment link for unescaping HTML (GH-100212) 2023-02-19 02:41:53 -08:00
http [3.10] gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (GH-104067) (#104119) 2023-05-09 15:21:53 +00:00
idlelib [3.10] gh-97032: avoid test_squeezer crash on macOS buildbots (#115508) 2024-02-19 13:43:38 +00:00
importlib [3.10] gh-99130: Apply bugfixes from importlib_metadata 4.11.4. (#99132) 2022-11-10 16:59:38 +01:00
json gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961) 2022-09-25 01:20:53 -07:00
lib2to3 bpo-46542: test_lib2to3 uses support.infinite_recursion() (GH-31035) 2022-01-31 12:03:40 -08:00
logging [3.10] gh-99811: Use correct variable to search for time in format string (GH-99812) (GH-99852) 2022-11-28 19:17:31 +00:00
msilib [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511) 2021-09-29 12:36:59 +01:00
multiprocessing bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684) 2022-12-02 10:13:33 +00:00
pydoc_data Python 3.10.14 2024-03-19 22:46:16 +01:00
site-packages
sqlite3 gh-100553: Improve accuracy of sqlite3.Row iter test (GH-100555) 2022-12-27 17:16:53 -08:00
test [3.10] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179) (GH-113186) (GH-118177) (GH-118229) 2024-05-07 11:56:13 +02:00
tkinter gh-57762: fix misleading tkinter.Tk docstring (GH-98837) 2022-12-22 15:03:38 -08:00
turtledemo gh-91212: Fixed flickering when the tracer is turned off (GH-95129) 2022-09-29 00:09:16 -07:00
unittest gh-100739: Respect mock spec when checking for unsafe prefixes (GH-100740) 2023-01-04 15:11:46 -08:00
urllib [3.10] gh-115197: Stop resolving host in urllib.request proxy bypass (GH-115210) (GH-116070) 2024-03-19 11:53:33 +01:00
venv [3.10] gh-93858: Prevent error when activating venv in nested fish instances (GH-93931) (GH-98403) 2022-10-18 16:39:06 +01:00
wsgiref gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961) 2022-09-25 01:20:53 -07:00
xml [3.10] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623) (GH-116270) 2024-03-07 00:02:55 +01:00
xmlrpc bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765) (GH-28934) 2021-10-13 19:59:45 +02:00
zoneinfo [3.10] Fix typos in documentation and comments (GH-102374) (#102377) 2023-03-02 16:45:01 +00:00
__future__.py Set the release for __future__.annotations to 3.11 (#25596) 2021-04-25 17:09:24 +01:00
__phello__.foo.py
_aix_support.py
_bootsubprocess.py
_collections_abc.py [3.10] gh-98852: Fix subscription of types.GenericAlias instances (GH-98920) (GH-98969) 2022-11-01 20:14:38 +02:00
_compat_pickle.py
_compression.py bpo-41486: Faster bz2/lzma/zlib via new output buffering (GH-21740) 2021-04-27 23:58:54 -07:00
_markupbase.py
_osx_support.py [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511) 2021-09-29 12:36:59 +01:00
_py_abc.py
_pydecimal.py bpo-43475: Fix the Python implementation of hash of Decimal NaN (GH-26679) 2021-06-13 07:05:28 -07:00
_pyio.py bpo-25415: Remove confusing sentence from IOBase docstrings (PR-31631) 2022-03-04 10:33:57 -08:00
_sitebuiltins.py bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25189) 2021-04-06 11:18:41 +09:00
_strptime.py
_threading_local.py
_weakrefset.py bpo-44962: Fix a race in WeakKeyDict, WeakValueDict and WeakSet when two threads attempt to commit the last pending removal (GH-27921) 2021-08-28 11:09:21 -07:00
abc.py Clarify the order of a stacked abstractmethod (GH-26892) 2021-06-27 11:50:38 -07:00
aifc.py
antigravity.py
argparse.py gh-101979: argparse: fix a bug where parentheses in metavar argument of add_argument() were dropped (GH-102318) 2023-03-05 07:16:14 -08:00
ast.py gh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422) 2022-11-22 03:06:26 -08:00
asynchat.py [3.10] bpo-47022: Document asynchat, asyncore and smtpd removals in 3.12 (GH-31891) (#31997) 2022-03-20 22:38:01 +02:00
asyncore.py [3.10] bpo-47022: Document asynchat, asyncore and smtpd removals in 3.12 (GH-31891) (#31997) 2022-03-20 22:38:01 +02:00
base64.py
bdb.py gh-101517: make bdb avoid looking up in linecache with lineno=None (GH-101787) 2023-02-10 09:24:30 -08:00
binhex.py
bisect.py
bz2.py bpo-45475: Revert __iter__ optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016) 2021-10-18 20:15:48 -07:00
calendar.py bpo-46266: Add calendar day of week constants to __all__ (GH-30412) (GH-30424) 2022-01-23 02:00:11 +01:00
cgi.py bpo-41139: Deprecate cgi.log() (GH-25625) 2021-04-29 11:36:04 +09:00
cgitb.py bpo-44740: Lowercase "internet" and "web" where appropriate. (GH-27378) (GH-27380) 2021-07-27 00:34:32 +02:00
chunk.py
cmd.py
code.py
codecs.py gh-51511: Note that codecs.open()'s encoding parameter affects automatic conversion to binary mode (GH-94370) 2022-10-21 16:28:25 -07:00
codeop.py gh-96052: codeop: fix handling compiler warnings in incomplete input (GH-96132) 2022-09-25 01:21:21 -07:00
colorsys.py
compileall.py bpo-40447: accept all path-like objects in compileall.compile_file (GH-19883) 2022-12-23 12:39:55 -08:00
configparser.py [3.10] gh-100520: Fix rst markup in configparser docstrings (GH-100524) (#100534) 2022-12-26 21:12:56 +05:30
contextlib.py [3.10] bpo-44594: fix (Async)ExitStack handling of __context__ (gh-27089) (GH-28730) 2021-10-04 23:21:34 -07:00
contextvars.py
copy.py gh-90494: Reject 6th element of the __reduce__() tuple (GH-93609) (GH-93632) 2022-06-10 15:59:39 +02:00
copyreg.py bpo-44676: Serialize the union type using only public API (GH-27323) (GH-27340) 2021-07-24 22:35:33 +03:00
cProfile.py gh-103935: Use io.open_code() when executing code in trace and profile modules (GH-103947) 2023-04-27 22:44:07 +01:00
crypt.py gh-95231: Disable md5 & crypt modules if FIPS is enabled (GH-94742) 2022-08-30 00:59:56 -07:00
csv.py bpo-43625: Enhance csv sniffer has_headers() to be more accurate (GH-26939) (GH-27494) 2021-07-30 19:30:09 +02:00
dataclasses.py [3.10] gh-102947: Improve traceback when calling fields() on a non-dataclass (#102948) (#102954) 2023-03-23 15:13:05 +00:00
datetime.py Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582) 2022-05-14 08:01:53 -07:00
decimal.py
difflib.py Correct method name typo (GH-91970) 2022-04-27 15:19:43 -07:00
dis.py [3.10] bpo-45757: Fix bug where dis produced an incorrect oparg on EXTENDED_ARG before a no-arg opcode (GH-29480) (GH-29506) 2021-11-09 22:05:30 +00:00
doctest.py [3.10] bpo-28249: fix lineno location for empty DocTest instances (GH-30498) (#92981) 2022-05-19 21:16:57 +02:00
enum.py bpo-44559: [Enum] restore fixes lost in 3.9 reversion (GH-29114) 2021-10-20 19:48:37 -07:00
filecmp.py bpo-42958: Improve description of shallow= in filecmp.cmp docs (GH-27166) 2021-08-04 13:03:33 -07:00
fileinput.py [3.10] gh-101961 fileinput.hookcompressed should not set the encoding value for the binary mode (gh-102068) (#102099) 2023-02-21 12:39:30 +09:00
fnmatch.py gh-89973: Fix re.error in the fnmatch module. (GH-93072) 2022-06-05 02:39:03 -07:00
fractions.py bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779) 2021-03-21 21:30:55 -05:00
ftplib.py
functools.py [3.10] bpo-46032: Check types in singledispatch's register() at declaration time (GH-30050) (GH-30254) 2021-12-25 16:12:32 +02:00
genericpath.py
getopt.py
getpass.py update docstring for win_getpass to reflect code changes (GH-24967) 2021-05-04 00:08:09 -07:00
gettext.py
glob.py bpo-44482: Fix very unlikely resource leak in glob in non-CPython implementations (GH-26843) (GH-26872) 2021-06-23 13:28:08 +03:00
graphlib.py [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511) 2021-09-29 12:36:59 +01:00
gzip.py bpo-45475: Revert __iter__ optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016) 2021-10-18 20:15:48 -07:00
hashlib.py bpo-43880: Show DeprecationWarnings for deprecated ssl module features (GH-25455) 2021-04-19 07:27:10 +02:00
heapq.py
hmac.py bpo-40645: use C implementation of HMAC (GH-24920) 2021-03-27 06:55:03 -07:00
imaplib.py
imghdr.py
imp.py bpo-43720: Update import-related stdlib deprecation messages to say they will be removed in Python 3.12 (GH-25167) 2021-04-03 15:31:15 -07:00
inspect.py [3.10] gh-85267: Improvements to inspect.signature __text_signature__ handling (GH-98796) (#100393) 2022-12-20 21:25:18 -08:00
io.py bpo-43680: Deprecate io.OpenWrapper (GH-25357) 2021-04-14 03:24:33 +02:00
ipaddress.py [3.10] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179) (GH-113186) (GH-118177) (GH-118229) 2024-05-07 11:56:13 +02:00
keyword.py
linecache.py gh-92336: linecache.getline should not raise exceptions on decoding errors (GH-94410) 2022-06-30 02:46:27 -07:00
locale.py bpo-34311: Add locale.localize (GH-15275) 2021-04-12 14:17:40 +02:00
lzma.py bpo-45475: Revert __iter__ optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016) 2021-10-18 20:15:48 -07:00
mailbox.py
mailcap.py [3.10] gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993) (GH-93543) 2022-09-20 13:12:35 +02:00
mimetypes.py bpo-20392: Fix inconsistency with uppercase file extensions in mimetypes.guess_type (GH-30229) 2022-03-15 08:14:19 -07:00
modulefinder.py
netrc.py bpo-43733: netrc try to use UTF-8 before using locale encoding. (GH-25781) 2021-05-02 14:01:02 +09:00
nntplib.py
ntpath.py [3.10] bpo-44817: Ignore additional errors in ntpath.realpath (GH-27574) (GH-100023) 2022-12-08 01:02:28 -08:00
nturl2path.py bpo-43607: Fix urllib handling of Windows paths with \\?\ prefix (GH-25539) 2021-04-23 18:02:47 +01:00
numbers.py gh-68163: Correct conversion of Rational instances to float (GH-25619) (GH-96557) 2022-09-04 13:40:24 +01:00
opcode.py bpo-43754: Eliminate bindings for partial pattern matches (GH-25229) 2021-05-02 13:02:10 -07:00
operator.py bpo-44558: Match countOf is/== treatment to c (GH-27007) 2021-07-07 06:50:41 -07:00
optparse.py
os.py gh-57179: Add note on symlinks for os.walk (GH-94799) 2022-10-07 20:15:08 -07:00
pathlib.py gh-93156 - fix negative indexing into absolute pathlib.PurePath().parents (GH-93273) 2022-06-03 14:53:00 -07:00
pdb.py [3.10] GH-101673: Fix pdb bug where local variable changes are lost after longlist (#101674) (#102633) 2023-03-13 14:24:01 +00:00
pickle.py gh-90494: Reject 6th element of the __reduce__() tuple (GH-93609) (GH-93632) 2022-06-10 15:59:39 +02:00
pickletools.py
pipes.py Change type check to isinstance in pipes (GH-27291) (GH-27416) 2021-07-28 16:08:51 +02:00
pkgutil.py [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511) 2021-09-29 12:36:59 +01:00
platform.py gh-97966: Restore prior expectation that uname_result._fields and ._asdict would include the processor. (gh-98343) 2022-11-26 05:52:12 -08:00
plistlib.py gh-101992: update pstlib module documentation (GH-102133) 2023-03-04 22:36:07 -08:00
poplib.py
posixpath.py [3.10] gh-96192: fix os.ismount() to use a path that is str or bytes (GH-96194) (#99456) 2023-01-22 05:19:10 -08:00
pprint.py bpo-45557: Fix underscore_numbers in pprint.pprint(). (GH-29129) 2021-10-21 14:16:59 -07:00
profile.py gh-103935: Use io.open_code() when executing code in trace and profile modules (GH-103947) 2023-04-27 22:44:07 +01:00
pstats.py [3.10] Fix type annotation of pstats.FunctionProfile.ncalls (GH-96741) (#96836) 2022-10-05 14:57:26 -07:00
pty.py bpo-26228: [doc] Adapt PTY documentation updates from GH-4167 (GH-27754) 2021-08-13 04:21:06 -07:00
py_compile.py bpo-45428: Fix reading filenames from stdin in py_compile (GH-28848) 2021-10-15 05:14:35 -07:00
pyclbr.py bpo-40443: Remove unused imports (GH-25429) 2021-04-16 11:26:06 +02:00
pydoc.py [3.10] bpo-40296: Fix supporting generic aliases in pydoc (GH-30253). (GH-31976) 2022-03-18 20:46:31 +02:00
queue.py gh-90879: Fix missing parameter for put_nowait() (GH-91514) 2022-04-14 02:18:31 -07:00
quopri.py
random.py bpo-44018: random.seed() no longer mutates its inputs (GH-25856) (GH-25872) 2021-05-03 19:45:30 -07:00
re.py [3.10] bpo-44559: [Enum] revert enum module to 3.9 (GH-27010) 2021-07-03 21:08:42 -07:00
reprlib.py
rlcompleter.py bpo-44752: refactor part of rlcompleter.Completer.attr_matches (GH-27433) (GH-27447) 2021-07-29 17:44:42 +02:00
runpy.py bpo-26792: Improve docstrings of runpy module run_functions (GH-30729) 2022-04-29 11:45:43 -07:00
sched.py
secrets.py
selectors.py
shelve.py
shlex.py
shutil.py [3.10] gh-102950: Implement PEP 706 – Filter for tarfile.extractall (GH-102953) (GH-104128) 2023-05-10 13:43:00 +02:00
signal.py [3.10] bpo-27718: Fix help for the signal module (GH-30063) (GH-30080) 2021-12-13 12:14:51 +02:00
site.py [3.10] gh-113659: Skip hidden .pth files (GH-113660) (GH-114145) 2024-01-18 14:39:30 +01:00
smtpd.py [3.10] bpo-47022: Document asynchat, asyncore and smtpd removals in 3.12 (GH-31891) (#31997) 2022-03-20 22:38:01 +02:00
smtplib.py bpo-43124: Fix smtplib multiple CRLF injection (GH-25987) 2021-08-29 07:43:39 -07:00
sndhdr.py
socket.py Fix broken link to MSDN (GH-102355) 2023-03-13 06:41:01 -07:00
socketserver.py
sre_compile.py [3.10] gh-91575: Update case-insensitive matching in re to the latest Unicode version (GH-91580). (GH-91661) 2022-04-22 21:44:05 +03:00
sre_constants.py [3.10] gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070) (GH-92073) 2022-04-30 15:33:39 +03:00
sre_parse.py [3.10] gh-91700: Validate the group number in conditional expression in RE (GH-91702) (GH-91831) 2022-04-22 21:09:30 +03:00
ssl.py [3.10] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-108344) (#108350) 2023-08-23 12:10:14 +02:00
stat.py
statistics.py [3.10] [ GH-99155: Fix NormalDist pickle with 0 and 1 protocols (GH-99156). (GH-99188) (GH-99190) 2022-11-07 04:16:54 -06:00
string.py
stringprep.py
struct.py
subprocess.py Apply suggestions from code review 2023-02-08 15:45:17 -08:00
sunau.py
symtable.py Change list to view object (GH-93661) 2022-06-11 04:13:38 -07:00
sysconfig.py [3.10] Fix typos in the Lib directory (GH-28775) (GH-28804) 2021-10-07 11:49:47 -04:00
tabnanny.py gh-97639: Remove tokenize.NL check from tabnanny (GH-97640) 2022-10-03 19:07:10 -07:00
tarfile.py [3.10] gh-107845: Fix symlink handling for tarfile.data_filter (GH-107846) (#108210) 2023-08-22 18:02:30 +01:00
telnetlib.py
tempfile.py [3.10] gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930) (GH-112840) 2024-01-17 14:49:56 +01:00
textwrap.py
this.py
threading.py fix threading.Event.isSet() docstring (GH-96297) 2022-08-26 22:30:41 -07:00
timeit.py
token.py bpo-43822: Improve syntax errors for missing commas (GH-25377) 2021-04-15 21:38:45 +01:00
tokenize.py bpo-44667: Treat correctly lines ending with comments and no newlines in the Python tokenizer (GH-27499) (GH-27500) 2021-08-02 11:43:45 +02:00
trace.py gh-103935: Use io.open_code() when executing code in trace and profile modules (GH-103947) 2023-04-27 22:44:07 +01:00
traceback.py [3.10] gh-89412: Add missing attributes (added in 3.10) to traceback module docs (GH-105046) (#105329) 2023-06-05 19:02:31 +02:00
tracemalloc.py
tty.py
turtle.py gh-101100: Fix Sphinx warnings in turtle module (GH-102340) 2023-03-13 04:11:34 -07:00
types.py bpo-45664: Fix resolve_bases() and new_class() for GenericAlias instance as a base (GH-29298) 2021-12-05 13:26:37 -08:00
typing.py Correct typo in typing.py (GH-100423) 2022-12-22 03:43:55 -08:00
uu.py [3.10] gh-99889: Fix directory traversal security flaw in uu.decode() (GH-104096) (#104330) 2023-05-09 09:46:47 -07:00
uuid.py gh-98415: Fix uuid.getnode() ifconfig implementation (GH-98423) 2022-11-02 12:22:19 -07:00
warnings.py
wave.py
weakref.py bpo-44962: Fix a race in WeakKeyDict, WeakValueDict and WeakSet when two threads attempt to commit the last pending removal (GH-27921) 2021-08-28 11:09:21 -07:00
webbrowser.py bpo-44740: Lowercase "internet" and "web" where appropriate. (GH-27378) (GH-27380) 2021-07-27 00:34:32 +02:00
xdrlib.py
zipapp.py
zipfile.py [3.10] gh-109858: Protect zipfile from "quoted-overlap" zipbomb (GH-110016) (GH-113914) 2024-01-17 14:50:10 +01:00
zipimport.py [3.10] GH-87235: Make sure "python /dev/fd/9 9</path/to/script.py" works on macOS (GH-99768) (#99817) 2023-03-28 14:13:37 +02:00