Skip to content

Update fork #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 89 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
b7f4811
gh-103091: Add PyUnstable_Type_AssignVersionTag (#103095)
swtaarrs Apr 24, 2023
4996efb
GH-102973: Slim down Fedora packages in the dev container (#103283)
hroncok Apr 24, 2023
385d8d2
Removed unnecessary escaping of asterisks (#103714)
richard-hajek Apr 24, 2023
68f5836
gh-87452: Improve the Popen.returncode docs
zitterbewegung Apr 24, 2023
d2745fe
gh-103765: Fix 'Warning: py:class reference target not found: ModuleS…
jaimealonso Apr 24, 2023
3d29eda
gh-103746: Test `types.UnionType` and `Literal` types together (#103747)
sobolevn Apr 24, 2023
7ef614c
gh-91687: modernize dataclass example typing (#103773)
alago1 Apr 24, 2023
f8abfa3
gh-103323: Get the "Current" Thread State from a Thread-Local Variabl…
ericsnowcurrently Apr 24, 2023
0421ed4
GH-65022: Fix description of copyreg.pickle function (#102656)
furkanonder Apr 24, 2023
dfc5c41
gh-94518: Port 23-argument `_posixsubprocess.fork_exec` to Argument C…
arhadthedev Apr 24, 2023
ab25c7e
Revert "Add tests for empty range equality (#103751)" (#103770)
terryjreedy Apr 24, 2023
cb157a1
GH-103727: Avoid advancing tokenizer too far in f-string mode (GH-103…
lysnikolaou Apr 24, 2023
6751a4a
gh-87092: fix a few cases of incorrect error handling in compiler (#1…
iritkatriel Apr 24, 2023
ed948e0
gh-103776: Remove explicit uses of $(SHELL) from Makefile (GH-103778)
zware Apr 24, 2023
5b404d6
gh-94300: Update datetime.strptime documentation (#95318)
howiezhao Apr 24, 2023
2aa22f7
gh-99032: datetime docs: Encoding is no longer relevant (#93365)
wjandrea Apr 24, 2023
58b6be3
gh-99184: Bypass instance attribute access in `repr` of `weakref.ref`…
sobolevn Apr 24, 2023
04ea048
gh-102498 Clean up unused variables and imports in the email module …
JosephSBoyle Apr 24, 2023
518050c
gh-103780: Use patch instead of mock in asyncio unix events test (#10…
itamaro Apr 24, 2023
1c01f8d
gh-101517: fix line number propagation in code generated for except* …
iritkatriel Apr 24, 2023
79ae019
gh-101100: Fix Sphinx warnings in `argparse` module (#103289)
hugovk Apr 24, 2023
ae25855
gh-103492: Clarify SyntaxWarning with literal comparison (#103493)
hauntsaninja Apr 24, 2023
19e4f75
gh-100227: Only Use deepfreeze for the Main Interpreter (gh-103794)
ericsnowcurrently Apr 24, 2023
22bed58
gh-103791: Make contextlib.suppress also act on exceptions within an …
ambv Apr 24, 2023
0dc8b50
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)
carljm Apr 24, 2023
209a0a7
gh-95795: Move types.next_version_tag to PyInterpreterState (gh-102343)
ericsnowcurrently Apr 24, 2023
d94b3a6
gh-103673: Add missing ForkingUnixStreamServer and ForkingUnixDatagra…
jb2170 Apr 24, 2023
01be52e
gh-103801: Tools/wasm linting and formatting (#103796)
dversoza Apr 24, 2023
df3173d
gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)
ericsnowcurrently Apr 24, 2023
8291ae3
GH-103805: Lib test f541 linting issue fix (#103812)
rodolfomp123 Apr 24, 2023
0f23eda
gh-103810: Fix broken references in dataclasses (#103811)
olgarithms Apr 24, 2023
d96cd44
gh-103765: Remove pkgutil.rst from .nitignore (GH-103797)
jaimealonso Apr 24, 2023
b51da99
Also fail DO-NOT-MERGE when "awaiting changes" or "awaiting change re…
ambv Apr 24, 2023
3df3b91
gh-82814: fix shutil access error on WSL (#103790)
alago1 Apr 25, 2023
57f8f9a
gh-103718: Correctly set f-string buffers in all cases (GH-103815)
lysnikolaou Apr 25, 2023
b934f97
gh-103636: add enums for days and months in calendar module (GH-103642)
Agent-Hellboy Apr 25, 2023
d862799
gh-100227: Add a Granular Lock for _PyRuntime.imports.extensions.dict…
ericsnowcurrently Apr 25, 2023
0acea96
gh-103826: fix unused variable warning introduced in gh-102343 (#103825)
sunmy2019 Apr 25, 2023
c9134fb
DOC: remove reference to OpenSolaris (#102671)
partev Apr 25, 2023
8330580
gh-103726: Set up gcc-10 for ASAN (gh-103728)
corona10 Apr 25, 2023
c8c3956
gh-102950: Adjust tarfile filter tests for systems that don't set the…
encukou Apr 25, 2023
32bea69
gh-51574: Make tempfile.mkdtemp() always return absolute paths (#94612)
kj7rrv Apr 25, 2023
cef542c
gh-103721: Improve cross-references for generic-alias docs (#103838)
AlexWaygood Apr 25, 2023
ef25feb
gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)
carljm Apr 25, 2023
86aa8a5
GH-103804: Add test for dis.findlinestarts (#103806)
jkchandalia Apr 25, 2023
c986412
gh-99352: Ensure HTTPSConnection is available before exercising htt…
orsenthil Apr 26, 2023
31acfd7
gh-103578: Fix pdb reading code with non-utf8 encoding (#103581)
gaogaotiantian Apr 26, 2023
2763994
gh-74940: Allow fallback to UTF-8 encoding on systems with no locales…
gordonmessmer Apr 26, 2023
438b811
gh-103872: Update bundled pip version to 23.1.2 (gh-103873)
pfmoore Apr 26, 2023
214e568
gh-103875: Use ascii and latin1 singletons in deepfreeze (#103876)
oraluben Apr 26, 2023
1c0a9c5
gh-101786: Clarify docs that asyncio.Server.sockets is a socket-like …
willingc Apr 26, 2023
6c4124d
gh-103879: Fix refleak in super specialization (#103882)
JelleZijlstra Apr 26, 2023
81cf94c
Docs build: Add upper bounds to transitive dependencies (#103860)
AlexWaygood Apr 26, 2023
1461a22
Add willingc to CODEOWNERS for asyncio (#103885)
willingc Apr 26, 2023
d45225b
GH-99944: Make dis display the value of oparg of KW_NAMES (#103856)
jkchandalia Apr 26, 2023
37e3755
gh-91441: Clarify the docs of asyncio.loop.subprocess_exec() (#91442)
tifv Apr 26, 2023
28a05f4
gh-101879: docs - italicize argument in smtplib.SMPT() description (#…
OTheDev Apr 26, 2023
222c63f
gh-103015: Add entrypoint keyword param to sqlite3.Connection.load_ex…
erlend-aasland Apr 26, 2023
bb8aa7a
gh-103489: Add get/set config methods to sqlite3.Connection (#103506)
erlend-aasland Apr 26, 2023
842daa5
gh-103884: Docs CI: Only attempt nit-picky PR annotations for PRs (#1…
hugovk Apr 26, 2023
e901588
Update MAC_address wikipedia URL in comments (#29019)
180909 Apr 26, 2023
44010d0
gh-48241: Clarify URL needs to be encoded when provided to urlopen an…
mblahay Apr 26, 2023
a3a5b4b
gh-60436: fix curses textbox backspace/del (#103783)
aidanmelen Apr 26, 2023
dc3f975
gh-103629: Update typing.Unpack docs in compliance with PEP 692 (#103…
franekmagiera Apr 26, 2023
76632b8
gh-62432: unittest runner: Exit code 5 if no tests were run (#102051)
stefanor Apr 27, 2023
9169a56
gh-103656: Transfer f-string buffers to parser to avoid use-after-fre…
lysnikolaou Apr 27, 2023
1d99e9e
gh-89415: Add source-specific multicast constants to socket module (#…
rmehyde Apr 27, 2023
ce2383e
gh-103883: Doc: Move PyUnicode_FromObject doc (#103913)
methane Apr 27, 2023
dff8e5d
gh-103880: Fix `assertRaises` usage in `test_genericalias` (GH-103916)
sobolevn Apr 27, 2023
78942ec
gh-103607: Fix `pause_reading` to work when called from `connection_m…
Itayazolay Apr 27, 2023
63842bd
gh-103590: do not wrap a single exception raised from a try-except* (…
iritkatriel Apr 27, 2023
e9c7772
gh-103092: Isolate _ctypes, part 1 (#103893)
erlend-aasland Apr 27, 2023
8a0c7f1
gh-103583: Isolate CJK codec modules (#103869)
erlend-aasland Apr 27, 2023
b701dce
gh-102765: Update ntpath.isdir/isfile/islink/exists to use GetFileInf…
finnagin Apr 27, 2023
a5308e1
GH-90750: Use datetime.fromisocalendar in _strptime (#103802)
pganssle Apr 27, 2023
0b7fd8f
GH-103857: Deprecate utcnow and utcfromtimestamp (#103858)
pganssle Apr 27, 2023
44b5c21
GH-103903: Test the minimum Sphinx version in CI (#103904)
AA-Turner Apr 27, 2023
8def5ef
gh-102628: Fix sqlite3 CLI prompt for Windows console users (#103898)
erlend-aasland Apr 27, 2023
72adaba
gh-87092: update CODEOWNERS for split of compile.c to 3 files (#103941)
iritkatriel Apr 27, 2023
bf0b8a9
gh-98822: Add missing test directories to TESTSUBDIRS (#103942)
erlend-aasland Apr 27, 2023
d50f01a
gh-103935: Use `io.open_code()` when executing code in trace and prof…
gaogaotiantian Apr 27, 2023
2cf945b
Docs: fix dunders with too many underscores (#103955)
erlend-aasland Apr 27, 2023
56c7176
gh-102628: Fix sqlite3 CLI prompt in IDLE on Windows (#103945)
erlend-aasland Apr 27, 2023
d2e2e53
gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)
ericsnowcurrently Apr 27, 2023
424a785
gh-94673: Fix _PyTypes_InitTypes() and get_type_attr_as_size() (gh-10…
ericsnowcurrently Apr 28, 2023
67d140d
gh-83925: Make asyncio.subprocess communicate similar to non-asyncio …
marmarek Apr 28, 2023
52cedc5
Fix typo in math.log docstring (#103943)
westurner Apr 28, 2023
30216b6
gh-100021: Document that sqlite3's executemany() discards resulting r…
erlend-aasland Apr 28, 2023
81387fe
GH-103804: Add test for dis.disco (#103901)
jkchandalia Apr 28, 2023
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
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=7.0.0
ENV WASMTIME_CPU_ARCH=x86_64

RUN dnf -y --nodocs install git clang xz python3-blurb dnf-plugins-core && \
dnf -y --nodocs builddep python3 && \
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
dnf -y --nodocs --setopt=install_weak_deps=False builddep python3 && \
dnf -y clean all

RUN mkdir ${WASI_SDK_PATH} && \
Expand Down
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
configure* @erlend-aasland @corona10

# asyncio
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc

# Core
**/*context* @1st1
Expand All @@ -25,6 +25,8 @@ Objects/frameobject.c @markshannon
Objects/call.c @markshannon
Python/ceval.c @markshannon
Python/compile.c @markshannon @iritkatriel
Python/assemble.c @markshannon @iritkatriel
Python/flowgraph.c @markshannon @iritkatriel
Python/ast_opt.c @isidentical
Lib/test/test_patma.py @brandtbucher
Lib/test/test_peepholer.py @brandtbucher
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ jobs:
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
- name: Install Dependencies
run: sudo ./.github/workflows/posix-deps-apt.sh
- name: Set up GCC-10 for ASAN
uses: egor-tensin/setup-gcc@v1
with:
version: 10
- name: Configure OpenSSL env vars
run: |
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ jobs:

# Add pull request annotations for Sphinx nitpicks (missing references)
- name: 'Get list of changed files'
if: github.event_name == 'pull_request'
id: changed_files
uses: Ana06/[email protected]
with:
filter: "Doc/**"
- name: 'Build changed files in nit-picky mode'
if: github.event_name == 'pull_request'
continue-on-error: true
run: |
# Mark files the pull request modified
Expand All @@ -77,6 +79,26 @@ jobs:
# Build docs with the '-n' (nit-picky) option, convert warnings to errors (-W)
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1

# This build doesn't use problem matchers or check annotations
# It also does not run 'make check', as sphinx-lint is not installed into the
# environment.
build_doc_oldest_supported_sphinx:
name: 'Docs (Oldest Sphinx)'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: 'Set up Python'
uses: actions/setup-python@v4
with:
python-version: '3.11' # known to work with Sphinx 3.2
cache: 'pip'
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
- name: 'Install build dependencies'
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
- name: 'Build HTML documentation'
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html

# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
doctest:
name: 'Doctest'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/require-pr-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
label:
name: DO-NOT-MERGE
name: DO-NOT-MERGE / unresolved review
runs-on: ubuntu-latest
timeout-minutes: 10

Expand All @@ -15,4 +15,4 @@ jobs:
with:
mode: exactly
count: 0
labels: "DO-NOT-MERGE"
labels: "DO-NOT-MERGE, awaiting changes, awaiting change review"
5 changes: 3 additions & 2 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ JOBS = auto
PAPER =
SOURCES =
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
REQUIREMENTS = requirements.txt
SPHINXERRORHANDLING = -W

# Internal variables.
Expand Down Expand Up @@ -154,8 +155,8 @@ venv:
echo "To recreate it, remove it first with \`make clean-venv'."; \
else \
$(PYTHON) -m venv $(VENVDIR); \
$(VENVDIR)/bin/python3 -m pip install -U pip setuptools; \
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
echo "The venv has been created in the $(VENVDIR) directory"; \
fi

Expand Down
9 changes: 9 additions & 0 deletions Doc/c-api/type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ Type Objects

.. versionadded:: 3.11

.. c:function:: int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)

Attempt to assign a version tag to the given type.

Returns 1 if the type already had a valid version tag or a new one was
assigned, or 0 if a new tag could not be assigned.

.. versionadded:: 3.12


Creating Heap-Allocated Types
.............................
Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)

.. data:: Py_TPFLAGS_MANAGED_DICT

This bit indicates that instances of the class have a ``__dict___``
This bit indicates that instances of the class have a ``__dict__``
attribute, and that the space for the dictionary is managed by the VM.

If this flag is set, :const:`Py_TPFLAGS_HAVE_GC` should also be set.
Expand Down
18 changes: 9 additions & 9 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,15 @@ APIs:
arguments.


.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)

Copy an instance of a Unicode subtype to a new true Unicode object if
necessary. If *obj* is already a true Unicode object (not a subtype),
return the reference with incremented refcount.

Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.


.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, \
const char *encoding, const char *errors)

Expand Down Expand Up @@ -616,15 +625,6 @@ APIs:
.. versionadded:: 3.3


.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj)

Copy an instance of a Unicode subtype to a new true Unicode object if
necessary. If *obj* is already a true Unicode object (not a subtype),
return the reference with incremented refcount.

Objects other than Unicode or its subtypes will cause a :exc:`TypeError`.


Locale Encoding
"""""""""""""""

Expand Down
7 changes: 7 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@
if venvdir is not None:
exclude_patterns.append(venvdir + '/*')

nitpick_ignore = [
# Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
# be resolved, as the method is currently undocumented. For context, see
# https://github.com/python/cpython/pull/103289.
('py:meth', '_SubParsersAction.add_parser'),
]

# Disable Docutils smartquotes for several translations
smartquotes_excludes = {
'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], 'builders': ['man', 'text'],
Expand Down
29 changes: 29 additions & 0 deletions Doc/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# We have upper bounds on our transitive dependencies here
# To avoid new releases unexpectedly breaking our build.
# This file can be updated on an ad-hoc basis,
# though it will probably have to be updated
# whenever Doc/requirements.txt is updated.

# Direct dependencies of Sphinx
babel<3
colorama<0.5
imagesize<1.5
Jinja2<3.2
packaging<24
# Pygments==2.15.0 breaks CI
Pygments<2.16,!=2.15.0
requests<3
snowballstemmer<3
sphinxcontrib-applehelp<1.1
sphinxcontrib-devhelp<1.1
sphinxcontrib-htmlhelp<2.1
sphinxcontrib-jsmath<1.1
sphinxcontrib-qthelp<1.1
sphinxcontrib-serializinghtml<1.2

# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
MarkupSafe<2.2

# Direct dependencies of sphinx-lint
polib<1.3
regex<2024
16 changes: 9 additions & 7 deletions Doc/howto/argparse.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
.. _argparse-tutorial:

*****************
Argparse Tutorial
*****************

:author: Tshepang Mbambo

.. _argparse-tutorial:
.. currentmodule:: argparse

This tutorial is intended to be a gentle introduction to :mod:`argparse`, the
recommended command-line parsing module in the Python standard library.

.. note::

There are two other modules that fulfill the same task, namely
:mod:`getopt` (an equivalent for :c:func:`getopt` from the C
:mod:`getopt` (an equivalent for ``getopt()`` from the C
language) and the deprecated :mod:`optparse`.
Note also that :mod:`argparse` is based on :mod:`optparse`,
and therefore very similar in terms of usage.
Expand Down Expand Up @@ -137,13 +139,13 @@ And running the code:

Here is what's happening:

* We've added the :meth:`add_argument` method, which is what we use to specify
* We've added the :meth:`~ArgumentParser.add_argument` method, which is what we use to specify
which command-line options the program is willing to accept. In this case,
I've named it ``echo`` so that it's in line with its function.

* Calling our program now requires us to specify an option.

* The :meth:`parse_args` method actually returns some data from the
* The :meth:`~ArgumentParser.parse_args` method actually returns some data from the
options specified, in this case, ``echo``.

* The variable is some form of 'magic' that :mod:`argparse` performs for free
Expand Down Expand Up @@ -256,7 +258,7 @@ Here is what is happening:

* To show that the option is actually optional, there is no error when running
the program without it. Note that by default, if an optional argument isn't
used, the relevant variable, in this case :attr:`args.verbosity`, is
used, the relevant variable, in this case ``args.verbosity``, is
given ``None`` as a value, which is the reason it fails the truth
test of the :keyword:`if` statement.

Expand Down Expand Up @@ -299,7 +301,7 @@ Here is what is happening:
We even changed the name of the option to match that idea.
Note that we now specify a new keyword, ``action``, and give it the value
``"store_true"``. This means that, if the option is specified,
assign the value ``True`` to :data:`args.verbose`.
assign the value ``True`` to ``args.verbose``.
Not specifying it implies ``False``.

* It complains when you specify a value, in true spirit of what flags
Expand Down Expand Up @@ -698,7 +700,7 @@ Conflicting options

So far, we have been working with two methods of an
:class:`argparse.ArgumentParser` instance. Let's introduce a third one,
:meth:`add_mutually_exclusive_group`. It allows for us to specify options that
:meth:`~ArgumentParser.add_mutually_exclusive_group`. It allows for us to specify options that
conflict with each other. Let's also change the rest of the program so that
the new functionality makes more sense:
we'll introduce the ``--quiet`` option,
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/__main__.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ This is where using the ``if __name__ == '__main__'`` code block comes in
handy. Code within this block won't run unless the module is executed in the
top-level environment.

Putting as few statements as possible in the block below ``if __name___ ==
Putting as few statements as possible in the block below ``if __name__ ==
'__main__'`` can improve code clarity and correctness. Most often, a function
named ``main`` encapsulates the program's primary behavior::

Expand Down
26 changes: 20 additions & 6 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ arguments will never be treated as file references.

.. versionchanged:: 3.12
:class:`ArgumentParser` changed encoding and errors to read arguments files
from default (e.g. :func:`locale.getpreferredencoding(False)` and
from default (e.g. :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
``"strict"``) to :term:`filesystem encoding and error handler`.
Arguments file should be encoded in UTF-8 instead of ANSI Codepage on Windows.

Expand Down Expand Up @@ -1191,7 +1191,7 @@ done downstream after the arguments are parsed.
For example, JSON or YAML conversions have complex error cases that require
better reporting than can be given by the ``type`` keyword. A
:exc:`~json.JSONDecodeError` would not be well formatted and a
:exc:`FileNotFound` exception would not be handled at all.
:exc:`FileNotFoundError` exception would not be handled at all.

Even :class:`~argparse.FileType` has its limitations for use with the ``type``
keyword. If one argument uses *FileType* and then a subsequent argument fails,
Expand Down Expand Up @@ -1445,7 +1445,7 @@ Action classes
Action classes implement the Action API, a callable which returns a callable
which processes arguments from the command-line. Any object which follows
this API may be passed as the ``action`` parameter to
:meth:`add_argument`.
:meth:`~ArgumentParser.add_argument`.

.. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \
type=None, choices=None, required=False, help=None, \
Expand Down Expand Up @@ -1723,7 +1723,7 @@ Sub-commands
:class:`ArgumentParser` supports the creation of such sub-commands with the
:meth:`add_subparsers` method. The :meth:`add_subparsers` method is normally
called with no arguments and returns a special action object. This object
has a single method, :meth:`~ArgumentParser.add_parser`, which takes a
has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a
command name and any :class:`ArgumentParser` constructor arguments, and
returns an :class:`ArgumentParser` object that can be modified as usual.

Expand Down Expand Up @@ -1789,7 +1789,7 @@ Sub-commands
for that particular parser will be printed. The help message will not
include parent parser or sibling parser messages. (A help message for each
subparser command, however, can be given by supplying the ``help=`` argument
to :meth:`add_parser` as above.)
to :meth:`~_SubParsersAction.add_parser` as above.)

::

Expand Down Expand Up @@ -2157,7 +2157,7 @@ the populated namespace and the list of remaining argument strings.

.. warning::
:ref:`Prefix matching <prefix-matching>` rules apply to
:meth:`parse_known_args`. The parser may consume an option even if it's just
:meth:`~ArgumentParser.parse_known_args`. The parser may consume an option even if it's just
a prefix of one of its known options, instead of leaving it in the remaining
arguments list.

Expand Down Expand Up @@ -2295,3 +2295,17 @@ A partial upgrade path from :mod:`optparse` to :mod:`argparse`:

* Replace the OptionParser constructor ``version`` argument with a call to
``parser.add_argument('--version', action='version', version='<the version>')``.

Exceptions
----------

.. exception:: ArgumentError

An error from creating or using an argument (optional or positional).

The string value of this exception is the message, augmented with
information about the argument that caused it.

.. exception:: ArgumentTypeError

Raised when something goes wrong converting a command line string to a type.
Loading